From ce8e6fdfb031b92acf020cef201a9607fc56be31 Mon Sep 17 00:00:00 2001 From: jgromes Date: Tue, 25 Jun 2024 16:56:26 +0100 Subject: [PATCH 1/2] [SX126x] Added missing PHY getRSSI (#1132) --- src/modules/SX126x/SX126x.cpp | 4 ++++ src/modules/SX126x/SX126x.h | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/modules/SX126x/SX126x.cpp b/src/modules/SX126x/SX126x.cpp index 50eeaca1..591346d4 100644 --- a/src/modules/SX126x/SX126x.cpp +++ b/src/modules/SX126x/SX126x.cpp @@ -1327,6 +1327,10 @@ float SX126x::getDataRate() const { return(this->dataRateMeasured); } +float SX126x::getRSSI() { + return(this->getRSSI(true)); +} + float SX126x::getRSSI(bool packet) { if(packet) { // get last packet RSSI from packet status diff --git a/src/modules/SX126x/SX126x.h b/src/modules/SX126x/SX126x.h index d66351bb..f05e5d9a 100644 --- a/src/modules/SX126x/SX126x.h +++ b/src/modules/SX126x/SX126x.h @@ -917,11 +917,18 @@ class SX126x: public PhysicalLayer { float getDataRate() const; /*! - \brief GetsRSSI (Recorded Signal Strength Indicator). + \brief Gets recorded signal strength indicator. + Overload with packet mode enabled for PhysicalLayer compatibility. + \returns RSSI value in dBm. + */ + float getRSSI() override; + + /*! + \brief Gets RSSI (Recorded Signal Strength Indicator). \param packet Whether to read last packet RSSI, or the current value. \returns RSSI value in dBm. */ - float getRSSI(bool packet = true); + float getRSSI(bool packet); /*! \brief Gets SNR (Signal to Noise Ratio) of the last received packet. Only available for LoRa modem. From 33480235d61210a38c9c7e0c60291fce16132ff2 Mon Sep 17 00:00:00 2001 From: StevenCellist Date: Thu, 27 Jun 2024 17:38:29 +0200 Subject: [PATCH 2/2] [LoRaWAN] Fix JoinRequest dwelltime calculation --- src/protocols/LoRaWAN/LoRaWAN.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/protocols/LoRaWAN/LoRaWAN.cpp b/src/protocols/LoRaWAN/LoRaWAN.cpp index 4cac3fdb..bd12c06f 100644 --- a/src/protocols/LoRaWAN/LoRaWAN.cpp +++ b/src/protocols/LoRaWAN/LoRaWAN.cpp @@ -510,7 +510,8 @@ int16_t LoRaWANNode::activateOTAA(uint8_t joinDr, LoRaWANJoinEvent_t *joinEvent) RADIOLIB_ASSERT(state); if(this->dwellTimeEnabledUp) { - RadioLibTime_t toa = this->phyLayer->getTimeOnAir(RADIOLIB_LORAWAN_JOIN_REQUEST_LEN); + // calculate JoinRequest time-on-air in milliseconds + RadioLibTime_t toa = this->phyLayer->getTimeOnAir(RADIOLIB_LORAWAN_JOIN_REQUEST_LEN) / 1000; if(toa > this->dwellTimeUp) { return(RADIOLIB_ERR_DWELL_TIME_EXCEEDED); }