mirror of
https://github.com/wled/WLED.git
synced 2025-07-14 14:26:33 +00:00
Fix for 0 duration/reset runtime.
This commit is contained in:
parent
ebe9499e97
commit
4e0cf380be
@ -182,7 +182,7 @@ void Segment::deallocateData() {
|
|||||||
void Segment::resetIfRequired() {
|
void Segment::resetIfRequired() {
|
||||||
if (reset) {
|
if (reset) {
|
||||||
if (leds && !Segment::_globalLeds) { free(leds); leds = nullptr; }
|
if (leds && !Segment::_globalLeds) { free(leds); leds = nullptr; }
|
||||||
if (_t) _t->_dur = 0;
|
//if (_t) { delete _t; _t = nullptr; transitional = false; }
|
||||||
next_time = 0; step = 0; call = 0; aux0 = 0; aux1 = 0;
|
next_time = 0; step = 0; call = 0; aux0 = 0; aux1 = 0;
|
||||||
reset = false; // setOption(SEG_OPTION_RESET, false);
|
reset = false; // setOption(SEG_OPTION_RESET, false);
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ void Segment::startTransition(uint16_t dur) {
|
|||||||
uint16_t Segment::progress() {
|
uint16_t Segment::progress() {
|
||||||
if (!transitional || !_t) return 0xFFFFU;
|
if (!transitional || !_t) return 0xFFFFU;
|
||||||
uint32_t timeNow = millis();
|
uint32_t timeNow = millis();
|
||||||
if (timeNow - _t->_start > _t->_dur) return 0xFFFFU;
|
if (timeNow - _t->_start > _t->_dur || _t->_dur == 0) return 0xFFFFU;
|
||||||
return (timeNow - _t->_start) * 0xFFFFU / _t->_dur;
|
return (timeNow - _t->_start) * 0xFFFFU / _t->_dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,7 +880,11 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
|||||||
for (uint8_t i = 0; i < strip.getSegmentsNum(); i++) {
|
for (uint8_t i = 0; i < strip.getSegmentsNum(); i++) {
|
||||||
Segment& seg = strip.getSegment(i);
|
Segment& seg = strip.getSegment(i);
|
||||||
if (i != selectedSeg && (singleSegment || !seg.isActive() || !seg.isSelected())) continue; // skip non main segments if not applying to all
|
if (i != selectedSeg && (singleSegment || !seg.isActive() || !seg.isSelected())) continue; // skip non main segments if not applying to all
|
||||||
if (fxModeChanged) { seg.mode = effectIn; seg.markForReset(); }
|
if (fxModeChanged) {
|
||||||
|
seg.startTransition(strip.getTransition());
|
||||||
|
seg.mode = effectIn;
|
||||||
|
// TODO: we should load defaults here as well
|
||||||
|
}
|
||||||
if (speedChanged) seg.speed = speedIn;
|
if (speedChanged) seg.speed = speedIn;
|
||||||
if (intensityChanged) seg.intensity = intensityIn;
|
if (intensityChanged) seg.intensity = intensityIn;
|
||||||
if (paletteChanged) {
|
if (paletteChanged) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user