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 <glm.net@gmail.com>

Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
thejonesyboy 2020-10-23 10:25:33 +08:00 committed by Guillermo Ruffino
parent dd3e821857
commit bd061ac2ee

View File

@ -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);
}
}