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 09debed

Browse filesBrowse files
committed
Minor code simplification.
1 parent 53f7bb9 commit 09debed
Copy full SHA for 09debed

File tree

Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed

‎cores/esp8266/core_esp8266_waveform.cpp

Copy file name to clipboardExpand all lines: cores/esp8266/core_esp8266_waveform.cpp
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
337337
busyPins ^= pinBit;
338338
}
339339
else {
340-
const uint32_t overshootCcys = now - waveNextEventCcy;
341-
if (static_cast<int32_t>(overshootCcys) >= 0) {
340+
const int32_t overshootCcys = now - waveNextEventCcy;
341+
if (overshootCcys >= 0) {
342342
const int32_t periodCcys = scaleCcys(wave.periodCcys);
343343
if (waveform.states & pinBit) {
344344
// active configuration and forward are 100% duty
@@ -361,12 +361,11 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
361361
waveNextEventCcy = wave.nextPeriodCcy;
362362
}
363363
else {
364+
wave.nextPeriodCcy += periodCcys;
364365
if (!wave.dutyCcys) {
365-
wave.nextPeriodCcy += periodCcys;
366366
wave.endDutyCcy = wave.nextPeriodCcy;
367367
}
368368
else {
369-
wave.nextPeriodCcy += periodCcys;
370369
int32_t dutyCcys = scaleCcys(wave.dutyCcys);
371370
if (dutyCcys > wave.adjDutyCcys) {
372371
dutyCcys -= wave.adjDutyCcys;
@@ -377,7 +376,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() {
377376
dutyCcys = 0;
378377
}
379378
wave.endDutyCcy = now + dutyCcys;
380-
if (static_cast<int32_t>(wave.endDutyCcy - wave.nextPeriodCcy) >= 0) {
379+
if (static_cast<int32_t>(wave.endDutyCcy - wave.nextPeriodCcy) > 0) {
381380
wave.endDutyCcy = wave.nextPeriodCcy;
382381
}
383382
waveform.states |= pinBit;

0 commit comments

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