Skip to content

Commit

Permalink
[SX127x] Fixed getRSSI overload for PhysicalLayer (#1064)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgromes committed Apr 13, 2024
1 parent d778233 commit c11ac47
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/modules/SX127x/SX1272.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
9 changes: 8 additions & 1 deletion src/modules/SX127x/SX1272.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions src/modules/SX127x/SX1278.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 8 additions & 1 deletion src/modules/SX127x/SX1278.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c11ac47

Please sign in to comment.