mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 00:58:40 +00:00
Consume pre-existing socket_wake before sleeping
This commit is contained in:
@@ -74,6 +74,13 @@ void socket_delay(uint32_t ms) {
|
||||
yield();
|
||||
return;
|
||||
}
|
||||
// If a wake was already signalled, consume it and return immediately
|
||||
// instead of going to sleep. This avoids losing a wake that arrived
|
||||
// between loop iterations.
|
||||
if (s_socket_woke) {
|
||||
s_socket_woke = false;
|
||||
return;
|
||||
}
|
||||
s_socket_woke = false;
|
||||
s_delay_expired = false;
|
||||
// Set a one-shot timer to wake us after the timeout.
|
||||
|
||||
Reference in New Issue
Block a user