Skip to content

Commit 3979734

Browse files
committed
Early firing the ISR causes interruption to other waveforms, let it pick up new starts at next regular interval.
1 parent 6f18d5c commit 3979734

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cores/esp8266/core_esp8266_waveform.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,7 @@ int startWaveformClockCycles(uint8_t pin, uint32_t highCcys, uint32_t lowCcys,
186186
if (!waveform.timer1Running) {
187187
initTimer();
188188
}
189-
else if (T1V > IRQLATENCYCCYS) {
190-
// Must not interfere if Timer is due shortly
191-
timer1_write(IRQLATENCYCCYS);
192-
}
189+
// The ISR pulls updates on the next waveform interval
193190
}
194191
else {
195192
wave.mode = WaveformMode::INFINITE; // turn off possible expiry to make update atomic from NMI
@@ -259,7 +256,7 @@ static IRAM_ATTR void timer1Interrupt() {
259256
const bool isCPU2X = CPU2X & 1;
260257
if ((waveform.toSetBits && !(waveform.enabled & waveform.toSetBits)) || waveform.toDisableBits) {
261258
// Handle enable/disable requests from main app.
262-
waveform.enabled = (waveform.enabled & ~waveform.toDisableBits) | waveform.toSetBits; // Set the requested waveforms on/off
259+
waveform.enabled = (waveform.enabled | waveform.toSetBits) & ~waveform.toDisableBits; // Set the requested waveforms on/off
263260
// Find the first GPIO being generated by checking GCC's find-first-set (returns 1 + the bit of the first 1 in an int32_t)
264261
waveform.toDisableBits = 0;
265262
}

0 commit comments

Comments
 (0)