From 53fa89d0e39d92c332f7c67a301d9de66eaec853 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 27 Dec 2025 21:27:34 -1000 Subject: [PATCH] tweaks --- esphome/components/esp8266/const.py | 2 +- esphome/components/esp8266/waveform_stubs.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/esphome/components/esp8266/const.py b/esphome/components/esp8266/const.py index 162305da0c..d03dad2f0e 100644 --- a/esphome/components/esp8266/const.py +++ b/esphome/components/esp8266/const.py @@ -23,7 +23,7 @@ def require_waveform() -> None: to save ~580 bytes of RAM (wvfState 512B + pwmState 68B). Example: - from esphome.components.esp8266.const import require_waveform + from .const import require_waveform async def to_code(config): require_waveform() diff --git a/esphome/components/esp8266/waveform_stubs.cpp b/esphome/components/esp8266/waveform_stubs.cpp index 374e472c4c..1e4df9be1e 100644 --- a/esphome/components/esp8266/waveform_stubs.cpp +++ b/esphome/components/esp8266/waveform_stubs.cpp @@ -6,21 +6,22 @@ // we exclude core_esp8266_waveform_pwm.cpp from the build to save ~580 bytes // of RAM (wvfState 512B + pwmState 68B). // -// However, digitalWrite() unconditionally calls stopWaveform() and _stopPWM() -// to ensure any active waveform is stopped before changing pin state. -// These stubs satisfy those calls when the real waveform code is excluded. +// These stubs satisfy calls from the Arduino GPIO code when the real +// waveform implementation is excluded. #include +namespace esphome::esp8266 { + extern "C" { -// Called by digitalWrite() to stop any waveform on a pin +// Called by Arduino GPIO code to stop any waveform on a pin int stopWaveform(uint8_t pin) { (void) pin; return 1; // Success (no waveform to stop) } -// Called by digitalWrite() to stop any PWM on a pin +// Called by Arduino GPIO code to stop any PWM on a pin bool _stopPWM(uint8_t pin) { (void) pin; return false; // No PWM was running @@ -28,4 +29,6 @@ bool _stopPWM(uint8_t pin) { } // extern "C" +} // namespace esphome::esp8266 + #endif // USE_ESP8266_WAVEFORM_STUBS