From 33480235d61210a38c9c7e0c60291fce16132ff2 Mon Sep 17 00:00:00 2001 From: StevenCellist Date: Thu, 27 Jun 2024 17:38:29 +0200 Subject: [PATCH] [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); }