[SX1278] New getInstRSSI to get current RSSI
This commit is contained in:
parent
9dae818033
commit
04e24ab9d1
2 changed files with 42 additions and 0 deletions
|
@ -421,6 +421,39 @@ float SX1278::getRSSI(bool skipReceive) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float SX1278::getInstRSSI(bool skipReceive) {
|
||||||
|
if(getActiveModem() == RADIOLIB_SX127X_LORA) {
|
||||||
|
// for LoRa, get current RSSI
|
||||||
|
float currentRSSI;
|
||||||
|
|
||||||
|
// RSSI calculation uses different constant for low-frequency and high-frequency ports
|
||||||
|
if(_freq < 868.0) {
|
||||||
|
currentRSSI = -164 + _mod->SPIgetRegValue(RADIOLIB_SX127X_REG_RSSI_VALUE);
|
||||||
|
} else {
|
||||||
|
currentRSSI = -157 + _mod->SPIgetRegValue(RADIOLIB_SX127X_REG_RSSI_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(currentRSSI);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// enable listen mode
|
||||||
|
if(!skipReceive) {
|
||||||
|
startReceive();
|
||||||
|
}
|
||||||
|
|
||||||
|
// read the value for FSK
|
||||||
|
float rssi = (float)_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_RSSI_VALUE_FSK) / -2.0;
|
||||||
|
|
||||||
|
// set mode back to standby
|
||||||
|
if(!skipReceive) {
|
||||||
|
standby();
|
||||||
|
}
|
||||||
|
|
||||||
|
// return the value
|
||||||
|
return(rssi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int16_t SX1278::setCRC(bool enable, bool mode) {
|
int16_t SX1278::setCRC(bool enable, bool mode) {
|
||||||
if(getActiveModem() == RADIOLIB_SX127X_LORA) {
|
if(getActiveModem() == RADIOLIB_SX127X_LORA) {
|
||||||
// set LoRa CRC
|
// set LoRa CRC
|
||||||
|
|
|
@ -257,6 +257,15 @@ class SX1278: public SX127x {
|
||||||
*/
|
*/
|
||||||
float getRSSI(bool skipReceive = false);
|
float getRSSI(bool skipReceive = false);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Gets current signal strength indicator of for LoRa modem, or current RSSI level for FSK modem.
|
||||||
|
|
||||||
|
\param skipReceive Set to true to skip putting radio in receive mode for the RSSI measurement in FKS/OOK mode.
|
||||||
|
|
||||||
|
\returns Current packet RSSI for LoRa modem, or FSK modem.
|
||||||
|
*/
|
||||||
|
float getInstRSSI(bool skipReceive = false);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Enables/disables CRC check of received packets.
|
\brief Enables/disables CRC check of received packets.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue