@@ -342,13 +342,14 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
342342 Waveform& wave = waveform.pins [pin];
343343
344344 const uint32_t overshootCcys = now - wave.nextEventCcy ;
345- if (static_cast <int32_t >(overshootCcys) >= 0 ) {
346- if (WaveformMode::EXPIRES == wave.mode && wave.nextEventCcy == wave.expiryCcy ) {
347- // Disable any waveforms that are done
348- waveform.enabled &= ~(1UL << pin);
349- busyPins &= ~(1UL << pin);
350- }
351- else {
345+ if (WaveformMode::EXPIRES == wave.mode && wave.nextEventCcy == wave.expiryCcy &&
346+ static_cast <int32_t >(overshootCcys) >= 0 ) {
347+ // Disable any waveforms that are done
348+ waveform.enabled &= ~(1UL << pin);
349+ busyPins &= ~(1UL << pin);
350+ }
351+ else {
352+ if (static_cast <int32_t >(overshootCcys) >= 0 ) {
352353 uint32_t nextEdgeCcy;
353354 if (waveform.states & (1UL << pin)) {
354355 // active configuration and forward are 100% duty
@@ -410,17 +411,17 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
410411 (WaveformMode::EXPIRES == wave.mode && static_cast <int32_t >(nextEdgeCcy - wave.expiryCcy ) > 0 ) ?
411412 wave.expiryCcy : nextEdgeCcy;
412413 }
413- }
414414
415- if (static_cast <int32_t >(wave.nextEventCcy - isrTimeoutCcy) >= 0 ) {
416- busyPins &= ~(1UL << pin);
417- if (static_cast <int32_t >(waveform.nextEventCcy - wave.nextEventCcy ) > 0 ) {
418- waveform.nextEventCcy = wave.nextEventCcy ;
419- waveform.nextPin = pin;
415+ if (static_cast <int32_t >(wave.nextEventCcy - isrTimeoutCcy) >= 0 ) {
416+ busyPins &= ~(1UL << pin);
417+ if (static_cast <int32_t >(waveform.nextEventCcy - wave.nextEventCcy ) > 0 ) {
418+ waveform.nextEventCcy = wave.nextEventCcy ;
419+ waveform.nextPin = pin;
420+ }
421+ }
422+ else if (static_cast <int32_t >(isrNextEventCcy - wave.nextEventCcy ) > 0 ) {
423+ isrNextEventCcy = wave.nextEventCcy ;
420424 }
421- }
422- else if (static_cast <int32_t >(isrNextEventCcy - wave.nextEventCcy ) > 0 ) {
423- isrNextEventCcy = wave.nextEventCcy ;
424425 }
425426
426427 now = getScaledCcyCount (isrStartCcy);
0 commit comments