diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 4b285fae..3088c9e8 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -22,6 +22,7 @@ int16_t SX126x::begin(float bw, uint8_t sf, uint8_t cr, uint8_t syncWord, float _preambleLength = preambleLength; _tcxoDelay = 0; _headerType = SX126X_LORA_HEADER_EXPLICIT; + _implicitLen = 0xFF; // reset the module and verify startup int16_t state = reset(); @@ -1170,12 +1171,14 @@ uint32_t SX126x::getTimeOnAir(size_t len) { } } -int16_t implicitHeader(size_t len) { - return setHeaderType(SX126X_LORA_HEADER_IMPLICIT, len); +void implicitHeader(size_t len) { + _headerType = SX126X_LORA_HEADER_IMPLICIT; + _implicitLen = len; } -int16_t explicitHeader() { - return setHeaderType(SX126X_LORA_HEADER_EXPLICIT); +void explicitHeader() { + _headerType = SX126X_LORA_HEADER_EXPLICIT; + _implicitLen = 0xFF; } 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); } -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) { // calculate symbol length and enable low data rate optimization, if needed if(ldro == 0xFF) { diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index 56563382..8aee4741 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -795,7 +795,7 @@ class SX126x: public PhysicalLayer { \returns \ref status_codes */ - int16_t implicitHeader(size_t len); + void implicitHeader(size_t len); /*! \brief Set explicit header mode for future reception/transmission. @@ -804,7 +804,7 @@ class SX126x: public PhysicalLayer { \returns \ref status_codes */ - int16_t explicitHeader(); + void explicitHeader(); #ifndef RADIOLIB_GODMODE protected: #endif @@ -838,7 +838,6 @@ class SX126x: public PhysicalLayer { int16_t setFrequencyRaw(float freq); int16_t setOptimalHiPowerPaConfig(int8_t* inOutPower); int16_t setPacketMode(uint8_t mode, uint8_t len); - int16_t setHeaderType(uint8_t headerType, size_t len = 0xFF) // fixes to errata int16_t fixSensitivity(); @@ -864,6 +863,8 @@ class SX126x: public PhysicalLayer { uint32_t _tcxoDelay; + size_t _implicitLen; + int16_t config(uint8_t modem); // common low-level SPI interface