diff --git a/src/modules/SX127x/SX127x.cpp b/src/modules/SX127x/SX127x.cpp index 29980071..2b2be9c2 100644 --- a/src/modules/SX127x/SX127x.cpp +++ b/src/modules/SX127x/SX127x.cpp @@ -1184,6 +1184,13 @@ int16_t SX127x::setCrcFiltering(bool crcOn) { } } +int16_t SX127x::setRSSIThreshold(float value) { + if (value < 127.5 || value > 0) + return RADIOLIB_ERR_INVALID_RSSI_THRESHOLD; + + return _mod->SPIsetRegValue(RADIOLIB_SX127X_REG_RSSI_THRESH, (uint8_t)(-2.0 * value), 7, 0); +} + int16_t SX127x::setRSSIConfig(uint8_t smoothingSamples, int8_t offset) { // check active modem if(getActiveModem() != RADIOLIB_SX127X_FSK_OOK) { diff --git a/src/modules/SX127x/SX127x.h b/src/modules/SX127x/SX127x.h index 996776c9..b322df57 100644 --- a/src/modules/SX127x/SX127x.h +++ b/src/modules/SX127x/SX127x.h @@ -1227,6 +1227,15 @@ class SX127x: public PhysicalLayer { */ int16_t setDIOPreambleDetect(bool usePreambleDetect); + /*! + \brief Sets the RSSI value above which the RSSI interrupt is signaled + + \param value A value between -127.5 and 0 inclusive + + \returns \ref status_codes + */ + int16_t setRSSIThreshold(float value); + #if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL) protected: #endif