Defaults cleanup.
This commit is contained in:
parent
59cb9ba344
commit
24fda89665
@ -179,7 +179,15 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
|
||||
// load default values from effect string if effect is selected without
|
||||
// any other effect parameter (i.e. effect clicked in UI)
|
||||
if (elem[F("sx")].isNull() && elem[F("ix")].isNull() && elem["pal"].isNull() && elem[F("c1")].isNull() && elem[F("c2")].isNull() && elem[F("c3")].isNull()) {
|
||||
if (!elem["fx"].isNull() // effect must not be empty
|
||||
&& elem[F("sx")].isNull()
|
||||
&& elem[F("ix")].isNull()
|
||||
&& elem["pal"].isNull()
|
||||
&& elem[F("c1")].isNull()
|
||||
&& elem[F("c2")].isNull()
|
||||
&& elem[F("c3")].isNull())
|
||||
{
|
||||
// compatibility mode begin
|
||||
char buf[5]; // dummy buffer
|
||||
for (int i=0; i<5; i++) {
|
||||
uint8_t *var;
|
||||
@ -193,19 +201,20 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
extractModeSlider(fx, i, buf, 4, var);
|
||||
}
|
||||
extractModeSlider(fx, 255, buf, 4, &seg.palette);
|
||||
//end compatibility mode
|
||||
int16_t sOpt;
|
||||
sOpt = extractModeDefaults(fx, SET_F("sx")); if (sOpt >= 0) seg.speed = sOpt;
|
||||
sOpt = extractModeDefaults(fx, SET_F("ix")); if (sOpt >= 0) seg.intensity = sOpt;
|
||||
sOpt = extractModeDefaults(fx, SET_F("c1")); if (sOpt >= 0) seg.custom1 = sOpt;
|
||||
sOpt = extractModeDefaults(fx, SET_F("c2")); if (sOpt >= 0) seg.custom2 = sOpt;
|
||||
sOpt = extractModeDefaults(fx, SET_F("c3")); if (sOpt >= 0) seg.custom3 = sOpt;
|
||||
sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0) seg.palette = sOpt;
|
||||
sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0 && sOpt < strip.getPaletteCount()) seg.palette = sOpt;
|
||||
sOpt = extractModeDefaults(fx, SET_F("mp12")); if (sOpt >= 0) seg.map1D2D = sOpt & 0x03;
|
||||
sOpt = extractModeDefaults(fx, SET_F("ssim")); if (sOpt >= 0) seg.soundSim = sOpt & 0x07;
|
||||
sOpt = extractModeDefaults(fx, "rev"); if (sOpt >= 0) seg.setOption(SEG_OPTION_REVERSED, (bool)sOpt);
|
||||
sOpt = extractModeDefaults(fx, SET_F("mi")); if (sOpt >= 0) seg.setOption(SEG_OPTION_MIRROR, (bool)sOpt);
|
||||
sOpt = extractModeDefaults(fx, SET_F("rY")); if (sOpt >= 0) seg.setOption(SEG_OPTION_REVERSED_Y, (bool)sOpt);
|
||||
sOpt = extractModeDefaults(fx, SET_F("mY")); if (sOpt >= 0) seg.setOption(SEG_OPTION_MIRROR_Y, (bool)sOpt);
|
||||
sOpt = extractModeDefaults(fx, "rev"); if (sOpt >= 0) seg.reverse = (bool)sOpt; // setOption(SEG_OPTION_REVERSED, (bool)sOpt); // NOTE: setting this option is a risky business
|
||||
sOpt = extractModeDefaults(fx, SET_F("mi")); if (sOpt >= 0) seg.mirror = (bool)sOpt; // setOption(SEG_OPTION_MIRROR, (bool)sOpt); // NOTE: setting this option is a risky business
|
||||
sOpt = extractModeDefaults(fx, SET_F("rY")); if (sOpt >= 0) seg.reverse_y = (bool)sOpt; // setOption(SEG_OPTION_REVERSED_Y, (bool)sOpt); // NOTE: setting this option is a risky business
|
||||
sOpt = extractModeDefaults(fx, SET_F("mY")); if (sOpt >= 0) seg.mirror_y = (bool)sOpt; // setOption(SEG_OPTION_MIRROR_Y, (bool)sOpt); // NOTE: setting this option is a risky business
|
||||
}
|
||||
|
||||
//getVal also supports inc/decrementing and random
|
||||
|
Loading…
Reference in New Issue
Block a user