Skip to content

Commit d742df8

Browse files
Make stopWaveform call interrupt callable (#5248)
* Make stopWaveform call interrupt callable Match the behavior of pre-2.4.2 PWM by allowing stopWaveform to be called from an interrupt. Fixes #5247 * Move to O2, save ~500 bytes of code The actual runtime difference of -O2 vs -O3 is quite small, but -O3 takes ~500 more bytes of code (~300 more in IRAM, ~200 more in PMEM).
1 parent 2eb5b56 commit d742df8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: cores/esp8266/core_esp8266_waveform.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include "core_esp8266_waveform.h"
4242

4343
// Need speed, not size, here
44-
#pragma GCC optimize ("O3")
44+
#pragma GCC optimize ("O2")
4545

4646
// Maximum delay between IRQs
4747
#define MAXIRQUS (10000)
@@ -137,7 +137,7 @@ static void initTimer() {
137137
timerRunning = true;
138138
}
139139

140-
static void deinitTimer() {
140+
static void ICACHE_RAM_ATTR deinitTimer() {
141141
timer1_attachInterrupt(NULL);
142142
timer1_disable();
143143
timer1_isr_init();
@@ -202,7 +202,7 @@ int startWaveform(uint8_t pin, uint32_t timeHighUS, uint32_t timeLowUS, uint32_t
202202
}
203203

204204
// Stops a waveform on a pin
205-
int stopWaveform(uint8_t pin) {
205+
int ICACHE_RAM_ATTR stopWaveform(uint8_t pin) {
206206
// Can't possibly need to stop anything if there is no timer active
207207
if (!timerRunning) {
208208
return false;

0 commit comments

Comments
 (0)