millis() rollover fix for effects
This commit is contained in:
parent
c3df9e6270
commit
b890b5f0dc
@ -648,6 +648,7 @@ class WS2812FX {
|
||||
calcGammaTable(float),
|
||||
trigger(void),
|
||||
setSegment(uint8_t n, uint16_t start, uint16_t stop, uint8_t grouping = 0, uint8_t spacing = 0, uint16_t offset = UINT16_MAX),
|
||||
restartRuntime(),
|
||||
resetSegments(),
|
||||
makeAutoSegments(),
|
||||
fixInvalidSegments(),
|
||||
|
@ -606,6 +606,12 @@ void WS2812FX::setSegment(uint8_t n, uint16_t i1, uint16_t i2, uint8_t grouping,
|
||||
_segment_runtimes[n].reset();
|
||||
}
|
||||
|
||||
void WS2812FX::restartRuntime() {
|
||||
for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) {
|
||||
_segment_runtimes[i].reset();
|
||||
}
|
||||
}
|
||||
|
||||
void WS2812FX::resetSegments() {
|
||||
for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) if (_segments[i].name) delete _segments[i].name;
|
||||
mainSegment = 0;
|
||||
|
@ -320,7 +320,7 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
|
||||
byte lowestActive = 99;
|
||||
for (byte s = 0; s < strip.getMaxSegments(); s++)
|
||||
{
|
||||
WS2812FX::Segment sg = strip.getSegment(s);
|
||||
WS2812FX::Segment &sg = strip.getSegment(s);
|
||||
if (sg.isActive())
|
||||
{
|
||||
if (lowestActive == 99) lowestActive = s;
|
||||
@ -486,7 +486,7 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme
|
||||
JsonArray seg = root.createNestedArray("seg");
|
||||
for (byte s = 0; s < strip.getMaxSegments(); s++)
|
||||
{
|
||||
WS2812FX::Segment sg = strip.getSegment(s);
|
||||
WS2812FX::Segment &sg = strip.getSegment(s);
|
||||
if (sg.isActive())
|
||||
{
|
||||
JsonObject seg0 = seg.createNestedObject();
|
||||
|
@ -120,6 +120,7 @@ void WLED::loop()
|
||||
if (lastMqttReconnectAttempt > millis()) {
|
||||
rolloverMillis++;
|
||||
lastMqttReconnectAttempt = 0;
|
||||
strip.restartRuntime();
|
||||
}
|
||||
if (millis() - lastMqttReconnectAttempt > 30000) {
|
||||
lastMqttReconnectAttempt = millis();
|
||||
|
Loading…
Reference in New Issue
Block a user