We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e247c2 commit 440c444Copy full SHA for 440c444
cores/esp8266/core_esp8266_waveform.cpp
@@ -353,14 +353,14 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
353
}
354
else {
355
int32_t dutyCcys = scaleCcys(wave.dutyCcys);
356
- if (dutyCcys > wave.adjDutyCcys) {
+ if (dutyCcys <= wave.adjDutyCcys) {
357
+ dutyCcys >>= 1;
358
+ wave.adjDutyCcys -= dutyCcys;
359
+ }
360
+ else if (wave.adjDutyCcys) {
361
dutyCcys -= wave.adjDutyCcys;
362
wave.adjDutyCcys = 0;
363
- else {
- wave.adjDutyCcys -= dutyCcys;
- dutyCcys = 0;
- }
364
wave.endDutyCcy = now + dutyCcys;
365
if (static_cast<int32_t>(wave.endDutyCcy - wave.nextPeriodCcy) > 0) {
366
wave.endDutyCcy = wave.nextPeriodCcy;
0 commit comments