Merge pull request #1529 from jonny5532/feature/fix-serialless-on-esp32s3

Wait at most 100ms for Serial in init_serial on 2CAN so it will boot without USB
This commit is contained in:
Daniel Öster 2025-09-12 22:40:53 +03:00 committed by GitHub
commit bc2e49fb5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,7 +67,18 @@ void register_transmitter(Transmitter* transmitter) {
void init_serial() {
// Init Serial monitor
Serial.begin(115200);
#if HW_LILYGO2CAN
// Wait up to 100ms for Serial to be available. On the ESP32S3 Serial is
// provided by the USB controller, so will only work if the board is connected
// to a computer.
for (int i = 0; i < 10; i++) {
if (Serial)
break;
delay(10);
}
#else
while (!Serial) {}
#endif
}
void connectivity_loop(void*) {