From bd061ac2eec1fe6efcf4e1d4c483112c48c50101 Mon Sep 17 00:00:00 2001 From: thejonesyboy Date: Fri, 23 Oct 2020 10:25:33 +0800 Subject: [PATCH] fix: Incorrect time delay conversion breaks remote_transmitter_esp8266.cpp (#1322) * Incorrect time delay conversion breaks remote_transmitter_esp8266.cpp I'm unsure why the conversion from microseconds into whole millseconds and remaining microseconds is done using a value of 16383, rather than 1000. This breaks the "on", "off" times, as well as the repeat wait_time if the period is more than 16383 microseconds. I have confirmed behaviour with an oscilloscope. See https://community.home-assistant.io/t/infrared-remote-transmitter-not-working/232825 * Update esphome/core/helpers.cpp Co-authored-by: Guillermo Ruffino Co-authored-by: Guillermo Ruffino --- esphome/core/helpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 78a62a5e86..38b80d85fb 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -178,8 +178,8 @@ void delay_microseconds_accurate(uint32_t usec) { if (usec <= 16383UL) { delayMicroseconds(usec); } else { - delay(usec / 16383UL); - delayMicroseconds(usec % 16383UL); + delay(usec / 1000UL); + delayMicroseconds(usec % 1000UL); } }