From 63d8a902d556d932560008b1537e10da5ff52a2b Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sun, 15 Jan 2023 15:21:39 +0100 Subject: [PATCH] Loading defaults on "fxdef". --- wled00/FX_fcn.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index b53541a4..147f625b 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -459,18 +459,21 @@ void Segment::setMode(uint8_t fx, bool loadDefaults) { // load default values from effect string if (loadDefaults) { int16_t sOpt; - sOpt = extractModeDefaults(fx, "sx"); if (sOpt >= 0) speed = sOpt; - sOpt = extractModeDefaults(fx, "ix"); if (sOpt >= 0) intensity = sOpt; - sOpt = extractModeDefaults(fx, "c1"); if (sOpt >= 0) custom1 = sOpt; - sOpt = extractModeDefaults(fx, "c2"); if (sOpt >= 0) custom2 = sOpt; - sOpt = extractModeDefaults(fx, "c3"); if (sOpt >= 0) custom3 = sOpt; + sOpt = extractModeDefaults(fx, "sx"); speed = (sOpt >= 0) ? sOpt : DEFAULT_SPEED; + sOpt = extractModeDefaults(fx, "ix"); intensity = (sOpt >= 0) ? sOpt : DEFAULT_INTENSITY; + sOpt = extractModeDefaults(fx, "c1"); custom1 = (sOpt >= 0) ? sOpt : DEFAULT_C1; + sOpt = extractModeDefaults(fx, "c2"); custom2 = (sOpt >= 0) ? sOpt : DEFAULT_C2; + sOpt = extractModeDefaults(fx, "c3"); custom3 = (sOpt >= 0) ? sOpt : DEFAULT_C3; + sOpt = extractModeDefaults(fx, "o1"); check1 = (sOpt >= 0) ? (bool)sOpt : false; + sOpt = extractModeDefaults(fx, "o2"); check2 = (sOpt >= 0) ? (bool)sOpt : false; + sOpt = extractModeDefaults(fx, "o3"); check3 = (sOpt >= 0) ? (bool)sOpt : false; sOpt = extractModeDefaults(fx, "m12"); if (sOpt >= 0) map1D2D = constrain(sOpt, 0, 7); sOpt = extractModeDefaults(fx, "si"); if (sOpt >= 0) soundSim = constrain(sOpt, 0, 7); sOpt = extractModeDefaults(fx, "rev"); if (sOpt >= 0) reverse = (bool)sOpt; sOpt = extractModeDefaults(fx, "mi"); if (sOpt >= 0) mirror = (bool)sOpt; // NOTE: setting this option is a risky business sOpt = extractModeDefaults(fx, "rY"); if (sOpt >= 0) reverse_y = (bool)sOpt; sOpt = extractModeDefaults(fx, "mY"); if (sOpt >= 0) mirror_y = (bool)sOpt; // NOTE: setting this option is a risky business - sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0) setPalette(sOpt); + sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0) setPalette(sOpt); //else setPalette(0); } stateChanged = true; // send UDP/WS broadcast }