Skip to content

Commit 2618813

Browse files
author
Hasnain Virk
committed
Ack timeout must be at least 2 seconds
While calculating ack timeout, we were ending up getting a random value which may become less than 2 seconds. This is not allowed as per v1.0.2 specification. To fix the issue we now take the random number from 0 to 2000 ms and then add that to the fixed 2000 ms ack timeout value, guaranteeing a value at least equal to 2000 ms.
1 parent f76436c commit 2618813

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

features/lorawan/lorastack/phy/LoRaPHY.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,8 +628,7 @@ uint16_t LoRaPHY::get_maximum_frame_counter_gap()
628628
uint32_t LoRaPHY::get_ack_timeout()
629629
{
630630
uint16_t ack_timeout_rnd = phy_params.ack_timeout_rnd;
631-
return (phy_params.ack_timeout
632-
+ get_random(-ack_timeout_rnd, ack_timeout_rnd));
631+
return (phy_params.ack_timeout + get_random(0, ack_timeout_rnd));
633632
}
634633

635634
uint32_t LoRaPHY::get_default_rx2_frequency()

0 commit comments

Comments
 (0)