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.
pull/10326/head
Hasnain Virk 2019-03-22 15:12:37 +02:00 committed by Martin Kojtal
parent 8e298cc98d
commit 1f322d23eb
1 changed files with 1 additions and 2 deletions

View File

@ -630,8 +630,7 @@ uint16_t LoRaPHY::get_maximum_frame_counter_gap()
uint32_t LoRaPHY::get_ack_timeout()
{
uint16_t ack_timeout_rnd = phy_params.ack_timeout_rnd;
return (phy_params.ack_timeout
+ get_random(-ack_timeout_rnd, ack_timeout_rnd));
return (phy_params.ack_timeout + get_random(0, ack_timeout_rnd));
}
uint32_t LoRaPHY::get_default_rx2_frequency()