From 5510d3aeb5e83dd3071c8a3b9651c52306fc89f2 Mon Sep 17 00:00:00 2001 From: Jonny Date: Fri, 12 Sep 2025 20:07:25 +0100 Subject: [PATCH] Wait at most 100ms for Serial in init_serial on 2CAN so it will boot without USB --- Software/Software.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Software/Software.cpp b/Software/Software.cpp index 95f25ed8..19cb5382 100644 --- a/Software/Software.cpp +++ b/Software/Software.cpp @@ -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*) {