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 GitHub
parent 5f619e6f01
commit e50644edee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -178,8 +178,8 @@ void delay_microseconds_accurate(uint32_t usec) {
if (usec <= 16383UL) { if (usec <= 16383UL) {
delayMicroseconds(usec); delayMicroseconds(usec);
} else { } else {
delay(usec / 16383UL); delay(usec / 1000UL);
delayMicroseconds(usec % 16383UL); delayMicroseconds(usec % 1000UL);
} }
} }