Merge pull request #1324 from meshtastic/nRF-serialinit

Wait up to 2 seconds for port being connected.
This commit is contained in:
Thomas Göttgens 2022-03-25 23:16:19 +01:00 committed by GitHub
commit 7aeca185f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,16 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port)
// setDestination(&noopPrint); for testing, try turning off 'all' debug output and see what leaks
Port.begin(SERIAL_BAUD);
#ifdef NRF52_SERIES
time_t timeout = millis();
while (!Port) {
if ((millis() - timeout) < 2000) {
delay(100);
} else {
break;
}
}
#endif
emitRebooted();
}