From 1f981b699433b323b4d4e6ddab77d45371b5db3d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 19 Aug 2026 14:38:56 -0500 Subject: [PATCH] Describe the conservative wake condition in the on_edge doc comment --- esphome/components/uart/software_serial_rx_decoder.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/uart/software_serial_rx_decoder.h b/esphome/components/uart/software_serial_rx_decoder.h index 6c09258183..b4be2c7b59 100644 --- a/esphome/components/uart/software_serial_rx_decoder.h +++ b/esphome/components/uart/software_serial_rx_decoder.h @@ -47,8 +47,10 @@ class SoftwareSerialRxDecoder { } /// ISR: the line changed to `level` at cycle `now`. - /// Returns true when the main loop should be woken: a byte was pushed, or the - /// line went idle high mid frame and finalize() is needed to complete the byte. + /// Returns true when the main loop should be woken: a byte was pushed, or a frame + /// is open and the line is high, in which case finalize() may be needed. That is + /// deliberately conservative; a data 1 and the idle tail are indistinguishable at + /// the edge, and repeat wakes are cheap because the wake flag is already set. bool ESPHOME_ALWAYS_INLINE on_edge(uint32_t now, bool level) { const bool last_level = this->last_level_; // Two edges collapsed into one interrupt: skip it so the run is still