diff --git a/src/modules/SX127x/SX1278.cpp b/src/modules/SX127x/SX1278.cpp index d3206f49..6ff917bc 100644 --- a/src/modules/SX127x/SX1278.cpp +++ b/src/modules/SX127x/SX1278.cpp @@ -416,7 +416,7 @@ int16_t SX1278::setDataShapingOOK(uint8_t sh) { return(state); } -float SX1278::getRSSI() { +float SX1278::getRSSI(bool skip_activation) { if(getActiveModem() == SX127X_LORA) { // for LoRa, get RSSI of the last packet float lastPacketRSSI; @@ -439,13 +439,15 @@ float SX1278::getRSSI() { } else { // enable listen mode - startReceive(); + if(!skip_activation) + startReceive(); // read the value for FSK float rssi = (float)_mod->SPIgetRegValue(SX127X_REG_RSSI_VALUE_FSK) / -2.0; // set mode back to standby - standby(); + if(!skip_activation) + standby(); // return the value return(rssi); diff --git a/src/modules/SX127x/SX1278.h b/src/modules/SX127x/SX1278.h index 70f06092..5be83794 100644 --- a/src/modules/SX127x/SX1278.h +++ b/src/modules/SX127x/SX1278.h @@ -248,9 +248,11 @@ class SX1278: public SX127x { /*! \brief Gets recorded signal strength indicator of the latest received packet for LoRa modem, or current RSSI level for FSK modem. + \param skip_activation in OOK/FSK mode this function will put receiver un receive mode and in standby. Make it TRUE if you don't want this behaviour. + \returns Last packet RSSI for LoRa modem, or current RSSI level for FSK modem. */ - float getRSSI(); + float getRSSI(bool skip_activation=false); /*! \brief Enables/disables CRC check of received packets.