Fix PWM crashes on ESP8266

Vendor in the ESP8266 Arduino core PWM library, with a fix for a nasty
NMI crash bug.  Sometimes the NMI return instruction seems to fail,
resulting in an infinite loop as the PC gets stuck.  Work around this
by backing up and restoring the PC if needed.
This commit is contained in:
Will Miles
2024-06-27 21:30:05 -04:00
parent 57b01c2711
commit ff39a8db3f
3 changed files with 718 additions and 0 deletions

View File

@@ -8,6 +8,8 @@
#include "soc/rtc_cntl_reg.h"
#endif
extern "C" void usePWMFixedNMI();
/*
* Main WLED class implementation. Mostly initialization and connection logic
*/
@@ -408,6 +410,10 @@ void WLED::setup()
DEBUG_PRINTF_P(PSTR("TX power: %d/%d\n"), WiFi.getTxPower(), txPower);
#endif
#ifdef ESP8266
usePWMFixedNMI(); // link the NMI fix
#endif
#if defined(WLED_DEBUG) && !defined(WLED_DEBUG_HOST)
pinManager.allocatePin(hardwareTX, true, PinOwner::DebugOut); // TX (GPIO1 on ESP32) reserved for debug output
#endif