8000 Small refactoring, remove code path that is never taken even at 3x25k… · dok-net/arduino-esp8266@3b28ee5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b28ee5

Browse files
committed
Small refactoring, remove code path that is never taken even at 3x25kHz/1023 PWM.
1 parent 9eb92f0 commit 3b28ee5

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

cores/esp8266/core_esp8266_waveform.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -362,22 +362,19 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
362362
waveNextEventCcy = wave.endDutyCcy = wave.nextPeriodCcy;
363363
}
364364
else {
365-
if (wave.autoPwm && static_cast<int32_t>(now - wave.nextPeriodCcy) >= 0) {
366-
wave.endDutyCcy += periodCcys - overshootCcys;
367-
wave.nextPeriodCcy += periodCcys;
368-
if (static_cast<int32_t>(now - wave.endDutyCcy) >= 0) {
369-
waveNextEventCcy = wave.nextPeriodCcy;
365+
if (wave.autoPwm) {
366+
if (static_cast<int32_t>(now - wave.nextPeriodCcy) >= 0) {
367+
wave.endDutyCcy += periodCcys - overshootCcys;
368+
wave.nextPeriodCcy += periodCcys;
369+
waveNextEventCcy = wave.endDutyCcy;
370+
// adapt expiry such that it occurs during intended cycle
371+
if (WaveformMode::EXPIRES == wave.mode)
372+
wave.expiryCcy += periodCcys;
370373
}
371374
else {
372-
waveNextEventCcy = wave.endDutyCcy;
375+
wave.adjDutyCcys = overshootCcys;
376+
waveNextEventCcy = wave.nextPeriodCcy;
373377
}
374-
// adapt expiry such that it occurs during intended cycle
375-
if (WaveformMode::EXPIRES == wave.mode)
376-
wave.expiryCcy += periodCcys;
377-
}
378-
else if (wave.autoPwm) {
379-
wave.adjDutyCcys = overshootCcys;
380-
waveNextEventCcy = wave.nextPeriodCcy;
381378
}
382379
else {
383380
waveNextEventCcy = wave.nextPeriodCcy;

0 commit comments

Comments
 (0)
0