mirror of
https://github.com/esphome/esphome.git
synced 2026-10-06 10:56:43 +00:00
[usb_uart][nextion][feedback][whirlpool][packet_transport][he60r][hc8][runtime_stats] Fix millis() wrapping bugs (#14474)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
co-authored by
Claude Opus 4.6
J. Nick Koston
parent
b0be02e16d
commit
3392e4d73b
@@ -171,8 +171,8 @@ void USBUartChannel::flush() {
|
||||
// Safe to call from the main loop only.
|
||||
// The 100 ms timeout guards against a device that stops responding mid-flush;
|
||||
// in that case the main loop is blocked for the full duration.
|
||||
uint32_t deadline = millis() + 100; // 100 ms safety timeout
|
||||
while ((!this->output_queue_.empty() || this->output_started_.load()) && millis() < deadline) {
|
||||
uint32_t start = millis(); // 100 ms safety timeout
|
||||
while ((!this->output_queue_.empty() || this->output_started_.load()) && millis() - start < 100) {
|
||||
// Kick start_output() in case data arrived but no transfer is in flight yet.
|
||||
this->parent_->start_output(this);
|
||||
yield();
|
||||
|
||||
Reference in New Issue
Block a user