Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e5c19ff

Browse filesBrowse files
committed
Don't ever skip off duty, no matter if late or infinitely short.
1 parent 3b28ee5 commit e5c19ff
Copy full SHA for e5c19ff

File tree

Expand file treeCollapse file tree

1 file changed

+13
-24
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-24
lines changed

‎cores/esp8266/core_esp8266_waveform.cpp

Copy file name to clipboardExpand all lines: cores/esp8266/core_esp8266_waveform.cpp
+13-24Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -359,36 +359,21 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
359359
// active configuration and forward are 100% duty
360360
if (wave.periodCcys == wave.dutyCcys) {
361361
wave.nextPeriodCcy += periodCcys;
362-
waveNextEventCcy = wave.endDutyCcy = wave.nextPeriodCcy;
362+
wave.endDutyCcy = wave.nextPeriodCcy;
363363
}
364364
else {
365365
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;
373-
}
374-
else {
375-
wave.adjDutyCcys = overshootCcys;
376-
waveNextEventCcy = wave.nextPeriodCcy;
377-
}
366+
wave.adjDutyCcys += overshootCcys;
378367
}
379-
else {
380-
waveNextEventCcy = wave.nextPeriodCcy;
368+
waveform.states ^= pinBit;
369+
if (16 == pin) {
370+
GP16O = 0;
381371
}
382-
if (waveNextEventCcy == wave.nextPeriodCcy) {
383-
waveform.states ^= pinBit;
384-
if (16 == pin) {
385-
GP16O = 0;
386-
}
387-
else {
388-
GPOC = pinBit;
389-
}
372+
else {
373+
GPOC = pinBit;
390374
}
391375
}
376+
waveNextEventCcy = wave.nextPeriodCcy;
392377
}
393378
else {
394379
if (!wave.dutyCcys) {
@@ -400,8 +385,12 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
400385
int32_t dutyCcys = scaleCcys(wave.dutyCcys);
401386
if (dutyCcys > wave.adjDutyCcys) {
402387
dutyCcys -= wave.adjDutyCcys;
388+
wave.adjDutyCcys = 0;
389+
}
390+
else {
391+
wave.adjDutyCcys -= dutyCcys;
392+
dutyCcys = 0;
403393
}
404-
wave.adjDutyCcys = 0;
405394
wave.endDutyCcy = now + dutyCcys;
406395
if (static_cast<int32_t>(wave.endDutyCcy - wave.nextPeriodCcy) >= 0) {
407396
wave.endDutyCcy = wave.nextPeriodCcy;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.