mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 01:39:30 +02:00
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:
commit
bc2e49fb5d
1 changed files with 11 additions and 0 deletions
|
@ -67,7 +67,18 @@ void register_transmitter(Transmitter* transmitter) {
|
||||||
void init_serial() {
|
void init_serial() {
|
||||||
// Init Serial monitor
|
// Init Serial monitor
|
||||||
Serial.begin(115200);
|
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) {}
|
while (!Serial) {}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectivity_loop(void*) {
|
void connectivity_loop(void*) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue