Refactor SerialConsole to simplify timeout handling (#10802)
Removed conditional compilation for timeout check on supported architectures.
This commit is contained in:
co-authored by
GitHub
parent
f273d3f875
commit
3778fb021c
@@ -65,8 +65,6 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port), con
|
|||||||
Port.setRX(SERIAL2_RX);
|
Port.setRX(SERIAL2_RX);
|
||||||
#endif
|
#endif
|
||||||
Port.begin(SERIAL_BAUD);
|
Port.begin(SERIAL_BAUD);
|
||||||
#if defined(ARCH_NRF52) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(ARCH_RP2040) || \
|
|
||||||
defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
|
|
||||||
time_t timeout = millis();
|
time_t timeout = millis();
|
||||||
while (!Port) {
|
while (!Port) {
|
||||||
if (Throttle::isWithinTimespanMs(timeout, FIVE_SECONDS_MS)) {
|
if (Throttle::isWithinTimespanMs(timeout, FIVE_SECONDS_MS)) {
|
||||||
@@ -75,7 +73,6 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port), con
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if !ARCH_PORTDUINO
|
#if !ARCH_PORTDUINO
|
||||||
emitRebooted();
|
emitRebooted();
|
||||||
#endif
|
#endif
|
||||||
@@ -150,4 +147,4 @@ void SerialConsole::log_to_serial(const char *logLevel, const char *format, va_l
|
|||||||
emitLogRecord(ll, thread ? thread->ThreadName.c_str() : "", format, arg);
|
emitLogRecord(ll, thread ? thread->ThreadName.c_str() : "", format, arg);
|
||||||
} else
|
} else
|
||||||
RedirectablePrint::log_to_serial(logLevel, format, arg);
|
RedirectablePrint::log_to_serial(logLevel, format, arg);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user