From a24e9b849e1ac4fe2bcc9d61145c2e3e246c8ac1 Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda Date: Sat, 16 Nov 2024 20:07:57 -0500 Subject: [PATCH] Use a while loop or the buffer can overflow in high noise enviroments --- esphome/components/remote_receiver/remote_receiver_esp32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/remote_receiver/remote_receiver_esp32.cpp b/esphome/components/remote_receiver/remote_receiver_esp32.cpp index 6575db10e7..e5880dbeac 100644 --- a/esphome/components/remote_receiver/remote_receiver_esp32.cpp +++ b/esphome/components/remote_receiver/remote_receiver_esp32.cpp @@ -113,7 +113,7 @@ void RemoteReceiverComponent::loop() { ESP_LOGW(TAG, "RMT buffer overflow!"); this->store_.overflow = false; } - if (this->store_.buffer_write != this->store_.buffer_read) { + while (this->store_.buffer_write != this->store_.buffer_read) { rmt_rx_done_event_data_t *event = (rmt_rx_done_event_data_t *) (this->store_.buffer + this->store_.buffer_read); uint32_t event_size = sizeof(rmt_rx_done_event_data_t); uint32_t next_read = this->store_.buffer_read + event_size + event->num_symbols * sizeof(rmt_symbol_word_t);