switch to recoding implicit length for use JIT

This commit is contained in:
Callan Bryant 2020-01-10 09:38:49 +00:00
parent b7d97341b4
commit 3bea627df4
No known key found for this signature in database
GPG key ID: C31FA9DF3ACBFFAA
2 changed files with 11 additions and 20 deletions

View file

@ -22,6 +22,7 @@ int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float
_preambleLength = preambleLength; _preambleLength = preambleLength;
_tcxoDelay = 0; _tcxoDelay = 0;
_headerType = SX126X_LORA_HEADER_EXPLICIT; _headerType = SX126X_LORA_HEADER_EXPLICIT;
_implicitLen = 0xFF;
// reset the module and verify startup // reset the module and verify startup
int16_t state = reset(); int16_t state = reset();
@ -1170,12 +1171,14 @@ uint32_t SX126x::getTimeOnAir(size_t len) {
} }
} }
int16_t implicitHeader(size_t len) { void implicitHeader(size_t len) {
return setHeaderType(SX126X_LORA_HEADER_IMPLICIT, len); _headerType = SX126X_LORA_HEADER_IMPLICIT;
_implicitLen = len;
} }
int16_t explicitHeader() { void explicitHeader() {
return setHeaderType(SX126X_LORA_HEADER_EXPLICIT); _headerType = SX126X_LORA_HEADER_EXPLICIT;
_implicitLen = 0xFF;
} }
int16_t SX126x::setTCXO(float voltage, uint32_t delay) { int16_t SX126x::setTCXO(float voltage, uint32_t delay) {
@ -1354,19 +1357,6 @@ int16_t SX126x::setPacketMode(uint8_t mode, uint8_t len) {
return(state); return(state);
} }
int16_t SX126x::setHeaderType(uint8_t headerType, size_t len) {
// set requested packet mode
int16_t state = setPacketParams(_preambleLength, _crcType, len, headerType);
if(state != ERR_NONE) {
return(state);
}
// update cached value
_headerType = headerType;
return(state);
}
int16_t SX126x::setModulationParams(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro) { int16_t SX126x::setModulationParams(uint8_t sf, uint8_t bw, uint8_t cr, uint8_t ldro) {
// calculate symbol length and enable low data rate optimization, if needed // calculate symbol length and enable low data rate optimization, if needed
if(ldro == 0xFF) { if(ldro == 0xFF) {

View file

@ -795,7 +795,7 @@ class SX126x: public PhysicalLayer {
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t implicitHeader(size_t len); void implicitHeader(size_t len);
/*! /*!
\brief Set explicit header mode for future reception/transmission. \brief Set explicit header mode for future reception/transmission.
@ -804,7 +804,7 @@ class SX126x: public PhysicalLayer {
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t explicitHeader(); void explicitHeader();
#ifndef RADIOLIB_GODMODE #ifndef RADIOLIB_GODMODE
protected: protected:
#endif #endif
@ -838,7 +838,6 @@ class SX126x: public PhysicalLayer {
int16_t setFrequencyRaw(float freq); int16_t setFrequencyRaw(float freq);
int16_t setOptimalHiPowerPaConfig(int8_t* inOutPower); int16_t setOptimalHiPowerPaConfig(int8_t* inOutPower);
int16_t setPacketMode(uint8_t mode, uint8_t len); int16_t setPacketMode(uint8_t mode, uint8_t len);
int16_t setHeaderType(uint8_t headerType, size_t len = 0xFF)
// fixes to errata // fixes to errata
int16_t fixSensitivity(); int16_t fixSensitivity();
@ -864,6 +863,8 @@ class SX126x: public PhysicalLayer {
uint32_t _tcxoDelay; uint32_t _tcxoDelay;
size_t _implicitLen;
int16_t config(uint8_t modem); int16_t config(uint8_t modem);
// common low-level SPI interface // common low-level SPI interface