MKRNB
MKRNB copied to clipboard
Missing timeout argument in NBUDP::endPacket(), default value of 200ms sometimes too low
I ran into timing issues while using NBUDP, specifically using endPacket()
. Sometimes it returned true (successful) sometimes false (not successful).
After some debugging I realized, that the call MODEM.waitForResponse()
does not use any argument, so it takes the default value of 200ms from ModemClass
.
This is too low in my case. While sometimes it takes the modem only around 20-40ms to respond to AT+USOST
, sometimes it reaches 210-240ms, resulting in a timeout, even though the packet has been sent.
The setTimeout
method does not help in this case, as the value is not used as an argument when calling waitForResponse()
.
As a simple solution I hard-coded a value >200 into the call in endPacket()
. Obvisouly it would be better if it had already a realistic value such as in all other calls of waitForResponse()
in that file (begin()
, stop()
, parsePacket()
).
Edit: The ublox manual for the SARA-R4 says on page 446 that +USOST
should take less than 11s. That sounds like a lot. For now I use 1000ms and it works fine.
Cheers and thanks a lot for this wonderful library.