Skip to content

Commit 2fc2f47

Browse files
committed
ESP8266PWM: Annotate sources
Add additional clarification as to the original source URL and the specific local patches.
1 parent ff39a8d commit 2fc2f47

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/ESP8266PWM/src/core_esp8266_waveform_pwm.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* esp8266_waveform imported from platform source code
22
Modified for WLED to work around a fault in the NMI handling,
33
which can result in the system locking up and hard WDT crashes.
4+
5+
Imported from https://github.com/esp8266/Arduino/blob/7e0d20e2b9034994f573a236364e0aef17fd66de/cores/esp8266/core_esp8266_waveform_pwm.cpp
46
*/
57

68
/*
@@ -497,6 +499,7 @@ static inline IRAM_ATTR uint32_t earliest(uint32_t a, uint32_t b) {
497499
return (da < db) ? a : b;
498500
}
499501

502+
// ----- @willmmiles begin patch -----
500503
// NMI crash workaround
501504
// Sometimes the NMI fails to return, stalling the CPU. When this happens,
502505
// the next NMI gets a return address /inside the NMI handler function/.
@@ -519,6 +522,7 @@ static inline IRAM_ATTR void nmiCrashWorkaround() {
519522
__asm__ __volatile__("wsr %0,epc3; wsr %1,eps3"::"a"(epc3_backup),"a"(eps3_backup));
520523
}
521524
}
525+
// ----- @willmmiles end patch -----
522526

523527

524528
// The SDK and hardware take some time to actually get to our NMI code, so
@@ -540,7 +544,9 @@ static inline IRAM_ATTR void nmiCrashWorkaround() {
540544
#define MINIRQTIME microsecondsToClockCycles(6)
541545

542546
static IRAM_ATTR void timer1Interrupt() {
547+
// ----- @willmmiles begin patch -----
543548
nmiCrashWorkaround();
549+
// ----- @willmmiles end patch -----
544550

545551
// Flag if the core is at 160 MHz, for use by adjust()
546552
bool turbo = (*(uint32_t*)0x3FF00014) & 1 ? true : false;

0 commit comments

Comments
 (0)