Skip to content

Commit e553d4f

Browse files
authored
Update TheThingsNetwork.cpp
When the MCU baud rate is different from default it is necessary to "autobaud" again after the module reset. Also, the response message after a reset is not readble if the MCU is working on a different baud rate. For this reason it it neccessary to issue another "autobaud" and a SYS_GET_VER to leave unchanged the behaviour of this function, that is the reply with module informations.
1 parent ab36f4d commit e553d4f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/TheThingsNetwork.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,12 @@ void TheThingsNetwork::autoBaud()
401401

402402
void TheThingsNetwork::reset(bool adr)
403403
{
404-
if (!baudDetermined)
405-
{
406-
autoBaud();
407-
}
408-
404+
autoBaud();
409405
size_t length = readResponse(SYS_TABLE, SYS_RESET, buffer, sizeof(buffer));
410406

407+
autoBaud();
408+
length = readResponse(SYS_TABLE, SYS_TABLE, SYS_GET_VER, buffer, sizeof(buffer));
409+
411410
// buffer contains "RN2xx3[xx] x.x.x ...", splitting model from version
412411
char *model = strtok(buffer, " ");
413412
debugPrintIndex(SHOW_MODEL, model);

0 commit comments

Comments
 (0)