fixed the broken fade out when the watchdog kicks in
This commit is contained in:
1 parent
a9957bc695
commit
c1d7ba4b3d
1 file changed
+4
-1
@@ -183,7 +183,9 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------- Slew-rate limiting (smooth 1-second transitions) --------
|
// -------- Slew-rate limiting (only when NOT in watchdog mode) --------
|
||||||
|
if (millis() - lastPacketTime <= watchdogTimeout) {
|
||||||
|
|
||||||
unsigned long now = millis();
|
unsigned long now = millis();
|
||||||
float progress = (float)(now - slewStartTime) / (float)slewDuration;
|
float progress = (float)(now - slewStartTime) / (float)slewDuration;
|
||||||
if (progress > 1.0f) progress = 1.0f;
|
if (progress > 1.0f) progress = 1.0f;
|
||||||
@@ -197,6 +199,7 @@ void loop() {
|
|||||||
|
|
||||||
ledcWrite(pwmPins[ch], duty);
|
ledcWrite(pwmPins[ch], duty);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -------- Watchdog fade-to-zero (UDP-based) --------
|
// -------- Watchdog fade-to-zero (UDP-based) --------
|
||||||
if (millis() - lastPacketTime > watchdogTimeout) {
|
if (millis() - lastPacketTime > watchdogTimeout) {
|
||||||
|
|||||||
Reference in new issue
Block a user