File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -301,10 +301,6 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
301
301
302
302
int32_t overshootCcys = now - wave.nextEventCcy ;
303
303
if (overshootCcys >= 0 ) {
304
- if (!wave.autoPwm ) {
305
- // for best effort hard timings
306
- overshootCcys = 0 ;
307
- }
308
304
if (WaveformMode::EXPIRES == wave.mode && wave.nextEventCcy == wave.expiryCcy ) {
309
305
// Disable any waveforms that are done
310
306
waveform.enabled ^= 1UL << pin;
@@ -315,6 +311,11 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
315
311
const uint32_t idleCcys = wave.periodCcys - wave.dutyCcys ;
316
312
uint32_t fwdPeriods = static_cast <uint32_t >(overshootCcys) >= idleCcys ?
317
313
((overshootCcys + wave.dutyCcys ) / wave.periodCcys ) : 0 ;
314
+ if (fwdPeriods && !wave.autoPwm ) {
315
+ // for best effort hard timings - allow only limited duty cycle floating
316
+ fwdPeriods = 0 ;
317
+ overshootCcys = 0 ;
318
+ }
318
319
uint32_t nextEdgeCcy;
319
320
if (waveform.states & (1UL << pin)) {
320
321
// up to and including this period 100% duty
You can’t perform that action at this time.
0 commit comments