From c11ac4703b3b5fc45c3594c41ac1bb21f6d03375 Mon Sep 17 00:00:00 2001 From: jgromes Date: Sat, 13 Apr 2024 21:21:33 +0200 Subject: [PATCH] [SX127x] Fixed getRSSI overload for PhysicalLayer (#1064) --- src/modules/SX127x/SX1272.cpp | 4 ++++ src/modules/SX127x/SX1272.h | 9 ++++++++- src/modules/SX127x/SX1278.cpp | 4 ++++ src/modules/SX127x/SX1278.h | 9 ++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/modules/SX127x/SX1272.cpp b/src/modules/SX127x/SX1272.cpp index 808d55d2..003a1cc2 100644 --- a/src/modules/SX127x/SX1272.cpp +++ b/src/modules/SX127x/SX1272.cpp @@ -419,6 +419,10 @@ int16_t SX1272::setDataShapingOOK(uint8_t sh) { return(state); } +float SX1272::getRSSI() { + return(SX1272::getRSSI(true, false)); +} + float SX1272::getRSSI(bool packet, bool skipReceive) { return(SX127x::getRSSI(packet, skipReceive, -139)); } diff --git a/src/modules/SX127x/SX1272.h b/src/modules/SX127x/SX1272.h index 5ea92db5..37e468ee 100644 --- a/src/modules/SX127x/SX1272.h +++ b/src/modules/SX127x/SX1272.h @@ -231,13 +231,20 @@ class SX1272: public SX127x { */ int16_t setDataShapingOOK(uint8_t sh); + /*! + \brief Gets recorded signal strength indicator. + Overload with packet mode enabled for PhysicalLayer compatibility. + \returns RSSI value in dBm. + */ + float getRSSI(); + /*! \brief Gets recorded signal strength indicator. \param packet Whether to read last packet RSSI, or the current value. LoRa mode only, ignored for FSK. \param skipReceive Set to true to skip putting radio in receive mode for the RSSI measurement in FSK/OOK mode. \returns RSSI value in dBm. */ - float getRSSI(bool packet = true, bool skipReceive = false); + float getRSSI(bool packet, bool skipReceive = false); /*! \brief Enables/disables CRC check of received packets. diff --git a/src/modules/SX127x/SX1278.cpp b/src/modules/SX127x/SX1278.cpp index cefb352c..22c24303 100644 --- a/src/modules/SX127x/SX1278.cpp +++ b/src/modules/SX127x/SX1278.cpp @@ -448,6 +448,10 @@ int16_t SX1278::setDataShapingOOK(uint8_t sh) { return(state); } +float SX1278::getRSSI() { + return(SX1278::getRSSI(true, false)); +} + float SX1278::getRSSI(bool packet, bool skipReceive) { int16_t offset = -157; if(frequency < 868.0) { diff --git a/src/modules/SX127x/SX1278.h b/src/modules/SX127x/SX1278.h index 979edb75..371b1660 100644 --- a/src/modules/SX127x/SX1278.h +++ b/src/modules/SX127x/SX1278.h @@ -243,13 +243,20 @@ class SX1278: public SX127x { */ int16_t setDataShapingOOK(uint8_t sh); + /*! + \brief Gets recorded signal strength indicator. + Overload with packet mode enabled for PhysicalLayer compatibility. + \returns RSSI value in dBm. + */ + float getRSSI(); + /*! \brief Gets recorded signal strength indicator. \param packet Whether to read last packet RSSI, or the current value. LoRa mode only, ignored for FSK. \param skipReceive Set to true to skip putting radio in receive mode for the RSSI measurement in FSK/OOK mode. \returns RSSI value in dBm. */ - float getRSSI(bool packet = true, bool skipReceive = false); + float getRSSI(bool packet, bool skipReceive = false); /*! \brief Enables/disables CRC check of received packets.