SX1278::getRSSI() modified for OOK so it wont require an activation

This commit is contained in:
Christophe Painchaud 2021-03-19 23:29:59 +01:00
parent f049a4bc98
commit b9e897409e
2 changed files with 8 additions and 4 deletions

View file

@ -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,12 +439,14 @@ float SX1278::getRSSI() {
} else {
// enable listen mode
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
if(!skip_activation)
standby();
// return the value

View file

@ -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.