Bugfix for applying WIN API in JSON request.

Added preset cycling in rotary encoder.
Removed custom font from 4LD in favor of built-in.
This commit is contained in:
Blaz Kristan 2022-01-03 22:23:03 +01:00
parent e8b2d80037
commit b6059939b4
4 changed files with 177 additions and 132 deletions

View File

@ -115,11 +115,11 @@ typedef enum {
Glyphs: 1/1 Glyphs: 1/1
BBX Build Mode: 3 BBX Build Mode: 3
* 4 = custom palette * 4 = custom palette
*/ * /
const uint8_t u8x8_font_benji_custom_icons_1x1[13] U8X8_FONT_SECTION("u8x8_font_benji_custom_icons_1x1") = const uint8_t u8x8_font_benji_custom_icons_1x1[13] U8X8_FONT_SECTION("u8x8_font_benji_custom_icons_1x1") =
"\4\4\1\1<n\372\377\275\277\26\34"; "\4\4\1\1<n\372\377\275\277\26\34";
/* / *
Fontname: benji_custom_icons_2x Fontname: benji_custom_icons_2x
Copyright: Copyright:
Glyphs: 8/8 Glyphs: 8/8
@ -134,7 +134,7 @@ const uint8_t u8x8_font_benji_custom_icons_1x1[13] U8X8_FONT_SECTION("u8x8_font_
* 6 = moon * 6 = moon
* 7 = brush * 7 = brush
* 8 = custom saturation * 8 = custom saturation
*/ * /
const uint8_t u8x8_font_benji_custom_icons_2x2[261] U8X8_FONT_SECTION("u8x8_font_benji_custom_icons_2x2") = const uint8_t u8x8_font_benji_custom_icons_2x2[261] U8X8_FONT_SECTION("u8x8_font_benji_custom_icons_2x2") =
"\1\10\2\2\200\200\14\14\300\340\360\363\363\360\340\300\14\14\200\200\1\1\60\60\3\7\17\317\317\17\7\3" "\1\10\2\2\200\200\14\14\300\340\360\363\363\360\340\300\14\14\200\200\1\1\60\60\3\7\17\317\317\17\7\3"
"\60\60\1\1\374\370\360\340\340\300\200\0\374\370\360\340\340\300\200\0\77\37\17\7\7\3\1\0\77\37\17\7" "\60\60\1\1\374\370\360\340\340\300\200\0\374\370\360\340\340\300\200\0\77\37\17\7\7\3\1\0\77\37\17\7"
@ -146,7 +146,7 @@ const uint8_t u8x8_font_benji_custom_icons_2x2[261] U8X8_FONT_SECTION("u8x8_font
"\0\0\0\0\200\200\14\14\300\340\360\363\363\360\340\300\14\14\200\200\1\1\60\60\3\4\10\310\310\10\4\3" "\0\0\0\0\200\200\14\14\300\340\360\363\363\360\340\300\14\14\200\200\1\1\60\60\3\4\10\310\310\10\4\3"
"\60\60\1\1"; "\60\60\1\1";
/* / *
Fontname: benji_custom_icons_6x Fontname: benji_custom_icons_6x
Copyright: Copyright:
Glyphs: 8/8 Glyphs: 8/8
@ -161,7 +161,7 @@ const uint8_t u8x8_font_benji_custom_icons_2x2[261] U8X8_FONT_SECTION("u8x8_font
* 6 = moon * 6 = moon
* 7 = brush * 7 = brush
* 8 = custom saturation * 8 = custom saturation
*/ * /
const uint8_t u8x8_font_benji_custom_icons_6x6[2308] U8X8_FONT_SECTION("u8x8_font_benji_custom_icons_6x6") = const uint8_t u8x8_font_benji_custom_icons_6x6[2308] U8X8_FONT_SECTION("u8x8_font_benji_custom_icons_6x6") =
"\1\10\6\6\0\0\0\0\0\0\200\300\300\300\300\200\0\0\0\0\0\0\0\0\0\36\77\77\77\77\36\0" "\1\10\6\6\0\0\0\0\0\0\200\300\300\300\300\200\0\0\0\0\0\0\0\0\0\36\77\77\77\77\36\0"
"\0\0\0\0\0\0\0\0\200\300\300\300\300\200\0\0\0\0\0\0\0\0\0\0\0\0\7\17\17\17\17\7" "\0\0\0\0\0\0\0\0\200\300\300\300\300\200\0\0\0\0\0\0\0\0\0\0\0\0\7\17\17\17\17\7"
@ -236,6 +236,7 @@ const uint8_t u8x8_font_benji_custom_icons_6x6[2308] U8X8_FONT_SECTION("u8x8_fon
"\3\3\1\0\0\0\60x\374\374x\60\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\3\3\1\0\0\0\60x\374\374x\60\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\14\36\77\77\36\14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\14\36\77\77\36\14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0"; "\0\0\0";
*/
class FourLineDisplayUsermod : public Usermod { class FourLineDisplayUsermod : public Usermod {
@ -484,45 +485,44 @@ class FourLineDisplayUsermod : public Usermod {
// Check if values which are shown on display changed from the last time. // Check if values which are shown on display changed from the last time.
if (forceRedraw) { if (forceRedraw) {
knownHour = 99; needRedraw = true;
needRedraw = true; clear();
clear();
} else if ((bri == 0 && powerON) || (bri > 0 && !powerON)) { //trigger power icon } else if ((bri == 0 && powerON) || (bri > 0 && !powerON)) { //trigger power icon
powerON = !powerON; powerON = !powerON;
drawStatusIcons(); drawStatusIcons();
return; return;
} else if (knownnightlight != nightlightActive) { //trigger moon icon } else if (knownnightlight != nightlightActive) { //trigger moon icon
knownnightlight = nightlightActive; knownnightlight = nightlightActive;
drawStatusIcons(); drawStatusIcons();
if (knownnightlight) { if (knownnightlight) {
String timer = PSTR("Timer On"); String timer = PSTR("Timer On");
center(timer,LINE_BUFFER_SIZE-1); center(timer,LINE_BUFFER_SIZE-1);
overlay(timer.c_str(), 3000, 6); overlay(timer.c_str(), 3000, 6);
lastRedraw = millis(); lastRedraw = millis();
} }
return; return;
} else if (wificonnected != interfacesInited) { //trigger wifi icon } else if (wificonnected != interfacesInited) { //trigger wifi icon
wificonnected = interfacesInited; wificonnected = interfacesInited;
drawStatusIcons(); drawStatusIcons();
return; return;
} else if (knownMode != effectCurrent) { } else if (knownMode != effectCurrent) {
knownMode = effectCurrent; knownMode = effectCurrent;
if (displayTurnedOff) needRedraw = true; if (displayTurnedOff) needRedraw = true;
else { showCurrentEffectOrPalette(knownMode, JSON_mode_names, 3); return; } else { showCurrentEffectOrPalette(knownMode, JSON_mode_names, 3); return; }
} else if (knownPalette != effectPalette) { } else if (knownPalette != effectPalette) {
knownPalette = effectPalette; knownPalette = effectPalette;
if (displayTurnedOff) needRedraw = true; if (displayTurnedOff) needRedraw = true;
else { showCurrentEffectOrPalette(knownPalette, JSON_palette_names, 2); return; } else { showCurrentEffectOrPalette(knownPalette, JSON_palette_names, 2); return; }
} else if (knownBrightness != bri) { } else if (knownBrightness != bri) {
if (displayTurnedOff && nightlightActive) { needRedraw = false; knownBrightness = bri; } if (displayTurnedOff && nightlightActive) { needRedraw = false; knownBrightness = bri; }
else if (displayTurnedOff) needRedraw = true; else if (displayTurnedOff) needRedraw = true;
else { updateBrightness(); return; } else { updateBrightness(); return; }
} else if (knownEffectSpeed != effectSpeed) { } else if (knownEffectSpeed != effectSpeed) {
if (displayTurnedOff) needRedraw = true; if (displayTurnedOff) needRedraw = true;
else { updateSpeed(); return; } else { updateSpeed(); return; }
} else if (knownEffectIntensity != effectIntensity) { } else if (knownEffectIntensity != effectIntensity) {
if (displayTurnedOff) needRedraw = true; if (displayTurnedOff) needRedraw = true;
else { updateIntensity(); return; } else { updateIntensity(); return; }
} }
if (!needRedraw) { if (!needRedraw) {
@ -606,17 +606,17 @@ class FourLineDisplayUsermod : public Usermod {
void draw2x2GlyphIcons() { void draw2x2GlyphIcons() {
if (lineHeight == 2) { if (lineHeight == 2) {
drawGlyph(1, 0, 1, u8x8_font_benji_custom_icons_2x2, true);//brightness icon drawGlyph( 1, 0, 0x45, u8x8_font_open_iconic_weather_2x2, true); //brightness icon
drawGlyph(5, 0, 2, u8x8_font_benji_custom_icons_2x2, true);//speed icon drawGlyph( 5, 0, 0x48, u8x8_font_open_iconic_play_2x2, true); //speed icon
drawGlyph(9, 0, 3, u8x8_font_benji_custom_icons_2x2, true);//intensity icon drawGlyph( 9, 0, 0x4e, u8x8_font_open_iconic_thing_2x2, true); //intensity icon
drawGlyph(14, 2*lineHeight, 4, u8x8_font_benji_custom_icons_2x2, true);//palette icon drawGlyph(14, 2*lineHeight, 0x48, u8x8_font_open_iconic_thing_2x2, true); //palette icon
drawGlyph(14, 3*lineHeight, 5, u8x8_font_benji_custom_icons_2x2, true);//effect icon drawGlyph(14, 3*lineHeight, 0x46, u8x8_font_open_iconic_thing_2x2, true); //effect icon
} else { } else {
drawGlyph(2, 0, 69, u8x8_font_open_iconic_weather_1x1); //brightness icon drawGlyph( 2, 0, 0x45, u8x8_font_open_iconic_weather_1x1); //brightness icon
drawGlyph(6, 0, 72, u8x8_font_open_iconic_play_1x1); //speed icon drawGlyph( 6, 0, 0x48, u8x8_font_open_iconic_play_1x1); //speed icon
drawGlyph(10, 0, 78, u8x8_font_open_iconic_thing_1x1); //intensity icon drawGlyph(10, 0, 0x4e, u8x8_font_open_iconic_thing_1x1); //intensity icon
drawGlyph(15, 2*lineHeight, 4, u8x8_font_benji_custom_icons_1x1); //palette icon drawGlyph(15, 2*lineHeight, 0x48, u8x8_font_open_iconic_thing_1x1); //palette icon
drawGlyph(15, 3*lineHeight, 70, u8x8_font_open_iconic_thing_1x1); //effect icon drawGlyph(15, 3*lineHeight, 0x46, u8x8_font_open_iconic_thing_1x1); //effect icon
} }
} }
@ -724,12 +724,49 @@ class FourLineDisplayUsermod : public Usermod {
// Turn the display back on // Turn the display back on
if (!wakeDisplay()) clear(); if (!wakeDisplay()) clear();
// Print the overlay // Print the overlay
if (glyphType > 0) { switch (glyphType) {
if (lineHeight == 2) drawGlyph(5, 0, glyphType, u8x8_font_benji_custom_icons_6x6, true); case 0:
else drawGlyph(7, lineHeight, glyphType, u8x8_font_benji_custom_icons_2x2, true); if (lineHeight == 2) drawGlyph(6, 1, 0x4e, u8x8_font_open_iconic_embedded_4x4, true);
if (line1) drawString(0, 3*lineHeight, line1); else drawGlyph(7, lineHeight, 0x4e, u8x8_font_open_iconic_embedded_2x2, true);
} else { break;
if (line1) drawString(0, lineHeight, line1); case 1:
if (lineHeight == 2) drawGlyph(6, 1, 0x45, u8x8_font_open_iconic_weather_4x4, true);
else drawGlyph(7, lineHeight, 0x45, u8x8_font_open_iconic_weather_2x2, true);
break;
case 2:
if (lineHeight == 2) drawGlyph(6, 1, 0x48, u8x8_font_open_iconic_play_4x4, true);
else drawGlyph(7, lineHeight, 0x48, u8x8_font_open_iconic_play_2x2, true);
break;
case 3:
if (lineHeight == 2) drawGlyph(6, 1, 0x4e, u8x8_font_open_iconic_thing_4x4, true);
else drawGlyph(7, lineHeight, 0x4e, u8x8_font_open_iconic_thing_2x2, true);
break;
case 4:
if (lineHeight == 2) drawGlyph(6, 1, 0x48, u8x8_font_open_iconic_thing_4x4, true);
else drawGlyph(7, lineHeight, 0x48, u8x8_font_open_iconic_thing_2x2, true);
break;
case 5:
if (lineHeight == 2) drawGlyph(6, 1, 0x46, u8x8_font_open_iconic_thing_4x4, true);
else drawGlyph(7, lineHeight, 0x46, u8x8_font_open_iconic_thing_2x2, true);
break;
case 6:
if (lineHeight == 2) drawGlyph(6, 1, 0x47, u8x8_font_open_iconic_thing_4x4, true);
else drawGlyph(7, lineHeight, 0x47, u8x8_font_open_iconic_thing_2x2, true);
break;
case 7:
if (lineHeight == 2) drawGlyph(6, 1, 0x4b, u8x8_font_open_iconic_embedded_4x4, true);
else drawGlyph(7, lineHeight, 0x4b, u8x8_font_open_iconic_embedded_2x2, true);
break;
case 8:
if (lineHeight == 2) drawGlyph(6, 1, 0x44, u8x8_font_open_iconic_weather_4x4, true);
else drawGlyph(7, lineHeight, 0x44, u8x8_font_open_iconic_weather_2x2, true);
break;
}
if (line1) {
String buf = line1;
center(buf, getCols());
drawString(0, (glyphType<255?3:0)*lineHeight, buf.c_str());
} }
overlayUntil = millis() + showHowLong; overlayUntil = millis() + showHowLong;
} }

View File

@ -47,7 +47,7 @@
// The last UI state, remove color and saturation option if diplay not active(too many options) // The last UI state, remove color and saturation option if diplay not active(too many options)
#ifdef USERMOD_FOUR_LINE_DISPLAY #ifdef USERMOD_FOUR_LINE_DISPLAY
#define LAST_UI_STATE 6 #define LAST_UI_STATE 7
#else #else
#define LAST_UI_STATE 4 #define LAST_UI_STATE 4
#endif #endif
@ -157,6 +157,9 @@ private:
uint8_t knownMode = 0; uint8_t knownMode = 0;
uint8_t knownPalette = 0; uint8_t knownPalette = 0;
byte presetHigh = 0;
byte presetLow = 0;
bool initDone = false; bool initDone = false;
bool enabled = true; bool enabled = true;
@ -166,6 +169,8 @@ private:
static const char _DT_pin[]; static const char _DT_pin[];
static const char _CLK_pin[]; static const char _CLK_pin[];
static const char _SW_pin[]; static const char _SW_pin[];
static const char _presetHigh[];
static const char _presetLow[];
/** /**
* Sort the modes and palettes to the index arrays * Sort the modes and palettes to the index arrays
@ -331,32 +336,19 @@ public:
prev_button_state = button_state; prev_button_state = button_state;
char newState = select_state + 1; char newState = select_state + 1;
if (newState > LAST_UI_STATE) newState = 0; if (newState > LAST_UI_STATE || (newState == 7 && presetHigh==0 && presetLow == 0)) newState = 0;
bool changedState = true; bool changedState = true;
if (display != nullptr) { if (display != nullptr) {
switch(newState) { switch(newState) {
case 0: case 0: changedState = changeState(PSTR("Brightness"), 1, 0, 1); break;
changedState = changeState(PSTR("Brightness"), 1, 0, 1); case 1: changedState = changeState(PSTR("Speed"), 1, 4, 2); break;
break; case 2: changedState = changeState(PSTR("Intensity"), 1, 8, 3); break;
case 1: case 3: changedState = changeState(PSTR("Color Palette"), 2, 0, 4); break;
changedState = changeState(PSTR("Speed"), 1, 4, 2); case 4: changedState = changeState(PSTR("Effect"), 3, 0, 5); break;
break; case 5: changedState = changeState(PSTR("Main Color"), 255, 255, 6); break;
case 2: case 6: changedState = changeState(PSTR("Saturation"), 255, 255, 7); break;
changedState = changeState(PSTR("Intensity"), 1 ,8, 3); case 7: changedState = changeState(PSTR("Preset"), 255, 255, 8); break;
break;
case 3:
changedState = changeState(PSTR("Color Palette"), 2, 0, 4);
break;
case 4:
changedState = changeState(PSTR("Effect"), 3, 0, 5);
break;
case 5:
changedState = changeState(PSTR("Main Color"), 255, 255, 7);
break;
case 6:
changedState = changeState(PSTR("Saturation"), 255, 255, 8);
break;
} }
} }
if (changedState) { if (changedState) {
@ -384,53 +376,27 @@ public:
if (Enc_B == LOW) //changes to LOW so that then encoder registers a change at the very end of a pulse if (Enc_B == LOW) //changes to LOW so that then encoder registers a change at the very end of a pulse
{ // B is high so clockwise { // B is high so clockwise
switch(select_state) { switch(select_state) {
case 0: case 0: changeBrightness(true); break;
changeBrightness(true); case 1: changeEffectSpeed(true); break;
break; case 2: changeEffectIntensity(true); break;
case 1: case 3: changePalette(true); break;
changeEffectSpeed(true); case 4: changeEffect(true); break;
break; case 5: changeHue(true); break;
case 2: case 6: changeSat(true); break;
changeEffectIntensity(true); case 7: changePreset(true); break;
break;
case 3:
changePalette(true);
break;
case 4:
changeEffect(true);
break;
case 5:
changeHue(true);
break;
case 6:
changeSat(true);
break;
} }
} }
else if (Enc_B == HIGH) else if (Enc_B == HIGH)
{ // B is low so counter-clockwise { // B is low so counter-clockwise
switch(select_state) { switch(select_state) {
case 0: case 0: changeBrightness(false); break;
changeBrightness(false); case 1: changeEffectSpeed(false); break;
break; case 2: changeEffectIntensity(false); break;
case 1: case 3: changePalette(false); break;
changeEffectSpeed(false); case 4: changeEffect(false); break;
break; case 5: changeHue(false); break;
case 2: case 6: changeSat(false); break;
changeEffectIntensity(false); case 7: changePreset(false); break;
break;
case 3:
changePalette(false);
break;
case 4:
changeEffect(false);
break;
case 5:
changeHue(false);
break;
case 6:
changeSat(false);
break;
} }
} }
} }
@ -471,10 +437,7 @@ public:
display->redraw(true); display->redraw(true);
return false; return false;
} }
String line = stateName; display->overlay(stateName, 750, glyph);
//line.trim();
display->center(line, display->getCols());
display->overlay(line.c_str(), 750, glyph);
display->setMarkLine(markedLine, markedCol); display->setMarkLine(markedLine, markedCol);
} }
#endif #endif
@ -575,6 +538,7 @@ public:
void changeHue(bool increase){ void changeHue(bool increase){
#ifdef USERMOD_FOUR_LINE_DISPLAY #ifdef USERMOD_FOUR_LINE_DISPLAY
if (display && display->wakeDisplay()) { if (display && display->wakeDisplay()) {
display->redraw(true);
// Throw away wake up input // Throw away wake up input
return; return;
} }
@ -593,6 +557,7 @@ public:
void changeSat(bool increase){ void changeSat(bool increase){
#ifdef USERMOD_FOUR_LINE_DISPLAY #ifdef USERMOD_FOUR_LINE_DISPLAY
if (display && display->wakeDisplay()) { if (display && display->wakeDisplay()) {
display->redraw(true);
// Throw away wake up input // Throw away wake up input
return; return;
} }
@ -607,6 +572,29 @@ public:
#endif #endif
} }
void changePreset(bool increase) {
#ifdef USERMOD_FOUR_LINE_DISPLAY
if (display && display->wakeDisplay()) {
display->redraw(true);
// Throw away wake up input
return;
}
#endif
if (presetHigh && presetLow && presetHigh > presetLow) {
String apireq = F("win&PL=~");
if (!increase) apireq += '-';
apireq += F("1&P1=");
apireq += presetLow;
apireq += F("&P2=");
apireq += presetHigh;
handleSet(nullptr, apireq, false);
lampUdated();
}
#ifdef USERMOD_FOUR_LINE_DISPLAY
display->updateRedrawTime();
#endif
}
/* /*
* addToJsonInfo() can be used to add custom entries to the /json/info part of the JSON API. * addToJsonInfo() can be used to add custom entries to the /json/info part of the JSON API.
* Creating an "u" object allows you to add custom key/value pairs to the Info section of the WLED web UI. * Creating an "u" object allows you to add custom key/value pairs to the Info section of the WLED web UI.
@ -658,6 +646,8 @@ public:
top[FPSTR(_DT_pin)] = pinA; top[FPSTR(_DT_pin)] = pinA;
top[FPSTR(_CLK_pin)] = pinB; top[FPSTR(_CLK_pin)] = pinB;
top[FPSTR(_SW_pin)] = pinC; top[FPSTR(_SW_pin)] = pinC;
top[FPSTR(_presetLow)] = presetLow;
top[FPSTR(_presetHigh)] = presetHigh;
DEBUG_PRINTLN(F("Rotary Encoder config saved.")); DEBUG_PRINTLN(F("Rotary Encoder config saved."));
} }
@ -678,7 +668,12 @@ public:
int8_t newCLKpin = top[FPSTR(_CLK_pin)] | pinB; int8_t newCLKpin = top[FPSTR(_CLK_pin)] | pinB;
int8_t newSWpin = top[FPSTR(_SW_pin)] | pinC; int8_t newSWpin = top[FPSTR(_SW_pin)] | pinC;
enabled = top[FPSTR(_enabled)] | enabled; presetHigh = top[FPSTR(_presetHigh)] | presetHigh;
presetLow = top[FPSTR(_presetLow)] | presetLow;
presetHigh = MIN(250,MAX(0,presetHigh));
presetLow = MIN(250,MAX(0,presetLow));
enabled = top[FPSTR(_enabled)] | enabled;
DEBUG_PRINT(FPSTR(_name)); DEBUG_PRINT(FPSTR(_name));
if (!initDone) { if (!initDone) {
@ -705,7 +700,7 @@ public:
} }
} }
// use "return !top["newestParameter"].isNull();" when updating Usermod with new features // use "return !top["newestParameter"].isNull();" when updating Usermod with new features
return !top[FPSTR(_enabled)].isNull(); return !top[FPSTR(_presetHigh)].isNull();
} }
/* /*
@ -719,8 +714,10 @@ public:
}; };
// strings to reduce flash memory usage (used more than twice) // strings to reduce flash memory usage (used more than twice)
const char RotaryEncoderUIUsermod::_name[] PROGMEM = "Rotary-Encoder"; const char RotaryEncoderUIUsermod::_name[] PROGMEM = "Rotary-Encoder";
const char RotaryEncoderUIUsermod::_enabled[] PROGMEM = "enabled"; const char RotaryEncoderUIUsermod::_enabled[] PROGMEM = "enabled";
const char RotaryEncoderUIUsermod::_DT_pin[] PROGMEM = "DT-pin"; const char RotaryEncoderUIUsermod::_DT_pin[] PROGMEM = "DT-pin";
const char RotaryEncoderUIUsermod::_CLK_pin[] PROGMEM = "CLK-pin"; const char RotaryEncoderUIUsermod::_CLK_pin[] PROGMEM = "CLK-pin";
const char RotaryEncoderUIUsermod::_SW_pin[] PROGMEM = "SW-pin"; const char RotaryEncoderUIUsermod::_SW_pin[] PROGMEM = "SW-pin";
const char RotaryEncoderUIUsermod::_presetHigh[] PROGMEM = "preset-high";
const char RotaryEncoderUIUsermod::_presetLow[] PROGMEM = "preset-low";

View File

@ -39,9 +39,17 @@ void handlePresets()
errorFlag = readObjectFromFileUsingId(filename, presetToApply, fileDoc) ? ERR_NONE : ERR_FS_PLOAD; errorFlag = readObjectFromFileUsingId(filename, presetToApply, fileDoc) ? ERR_NONE : ERR_FS_PLOAD;
} }
fdo = fileDoc->as<JsonObject>(); fdo = fileDoc->as<JsonObject>();
fdo.remove("ps"); //remove load request for presets to prevent recursive crash
deserializeState(fdo, callModeToApply, presetToApply); //HTTP API commands
const char* httpwin = fdo["win"];
if (httpwin) {
String apireq = "win&";
apireq += httpwin;
handleSet(nullptr, apireq, false);
} else {
fdo.remove("ps"); //remove load request for presets to prevent recursive crash
deserializeState(fdo, CALL_MODE_NO_NOTIFY, presetToApply);
}
#if defined(ARDUINO_ARCH_ESP32) #if defined(ARDUINO_ARCH_ESP32)
//Aircoookie recommended not to delete buffer //Aircoookie recommended not to delete buffer
@ -54,7 +62,10 @@ void handlePresets()
releaseJSONBufferLock(); // will also clear fileDoc releaseJSONBufferLock(); // will also clear fileDoc
if (!errorFlag && presetToApply < 255) currentPreset = presetToApply; if (!errorFlag && presetToApply < 255) currentPreset = presetToApply;
if (callModeToApply == CALL_MODE_BUTTON_PRESET) errorFlag = ERR_NONE; //ignore error on button press
colorUpdated(callModeToApply);
updateInterfaces(callModeToApply);
presetToApply = 0; //clear request for preset presetToApply = 0; //clear request for preset
callModeToApply = 0; callModeToApply = 0;
} }

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2201012 #define VERSION 2201031
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG