mirror of
https://github.com/esphome/esphome.git
synced 2026-02-06 01:22:47 +08:00
[remote_transmitter] Fix ESP8266 timing by using busy loop (#13172)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -40,13 +40,10 @@ void RemoteTransmitterComponent::await_target_time_() {
|
||||
if (this->target_time_ == 0) {
|
||||
this->target_time_ = current_time;
|
||||
} else if ((int32_t) (this->target_time_ - current_time) > 0) {
|
||||
#if defined(USE_LIBRETINY) || defined(USE_RP2040)
|
||||
// busy loop is required for libretiny and rp2040 as interrupts are disabled
|
||||
// busy loop is required as interrupts are disabled and delayMicroseconds()
|
||||
// may not work correctly in interrupt-disabled contexts on all platforms
|
||||
while ((int32_t) (this->target_time_ - micros()) > 0)
|
||||
;
|
||||
#else
|
||||
delayMicroseconds(this->target_time_ - current_time);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user