From 89a54e31f14a5401e6359d21dcd1711358fdd50c Mon Sep 17 00:00:00 2001 From: cschwinne Date: Mon, 2 Dec 2019 12:41:35 +0100 Subject: [PATCH] Cleanup and segment improvements --- wled00/FX.h | 9 +- wled00/FX_fcn.cpp | 64 +- wled00/data/settings_ui.htm | 55 +- wled00/html_classic.h | 657 -------------------- wled00/html_other.h | 10 +- wled00/html_settings.h | 41 +- wled00/{html_mobile.h => html_ui.h} | 14 +- wled00/src/dependencies/json/AsyncJson-v6.h | 2 +- wled00/wled00.ino | 13 +- wled00/wled01_eeprom.ino | 106 ++-- wled00/wled02_xml.ino | 63 +- wled00/wled03_set.ino | 20 +- wled00/wled05_init.ino | 10 - wled00/wled08_led.ino | 6 + wled00/wled18_server.ino | 56 +- wled00/wled19_json.ino | 2 + 16 files changed, 114 insertions(+), 1014 deletions(-) delete mode 100644 wled00/html_classic.h rename wled00/{html_mobile.h => html_ui.h} (99%) diff --git a/wled00/FX.h b/wled00/FX.h index 0413a41e..4a5caa49 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -181,7 +181,7 @@ class WS2812FX { // segment parameters public: - typedef struct Segment { // 21 bytes + typedef struct Segment { // 24 bytes uint16_t start; uint16_t stop; //segment invalid if stop == 0 uint8_t speed; @@ -189,6 +189,8 @@ class WS2812FX { uint8_t palette; uint8_t mode; uint8_t options; //bit pattern: msb first: transitional tbd tbd tbd tbd paused reverse selected + uint8_t group, spacing; + uint8_t opacity; uint32_t colors[NUM_COLORS]; void setOption(uint8_t n, bool val) { @@ -334,11 +336,7 @@ class WS2812FX { service(void), blur(uint8_t), fade_out(uint8_t r), - setMode(uint8_t m), setMode(uint8_t segid, uint8_t m), - setSpeed(uint8_t s), - setIntensity(uint8_t i), - setPalette(uint8_t p), setColor(uint8_t slot, uint8_t r, uint8_t g, uint8_t b, uint8_t w = 0), setColor(uint8_t slot, uint32_t c), setBrightness(uint8_t b), @@ -364,6 +362,7 @@ class WS2812FX { reverseMode = false, gammaCorrectBri = false, gammaCorrectCol = true, + applyToAllSelected = true, segmentsAreIdentical(Segment* a, Segment* b), setEffectConfig(uint8_t m, uint8_t s, uint8_t i, uint8_t p); diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index ff66b711..4e7c89f1 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -302,48 +302,28 @@ uint8_t WS2812FX::getPaletteCount() //TODO transitions -void WS2812FX::setMode(uint8_t m) { - for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) - { - if (_segments[i].isSelected()) setMode(i, m); - } -} - -void WS2812FX::setSpeed(uint8_t s) { - for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) - { - if (_segments[i].isSelected()) _segments[i].speed = s; - } -} - -void WS2812FX::setIntensity(uint8_t in) { - for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) - { - if (_segments[i].isSelected()) _segments[i].intensity = in; - } -} - -void WS2812FX::setPalette(uint8_t p) { - for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) - { - if (_segments[i].isSelected()) _segments[i].palette = p; - } -} bool WS2812FX::setEffectConfig(uint8_t m, uint8_t s, uint8_t in, uint8_t p) { - uint8_t retSeg = getMainSegmentId(); - Segment& seg = _segments[retSeg]; + uint8_t mainSeg = getMainSegmentId(); + Segment& seg = _segments[getMainSegmentId()]; uint8_t modePrev = seg.mode, speedPrev = seg.speed, intensityPrev = seg.intensity, palettePrev = seg.palette; - for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) - { - if (_segments[i].isSelected()) + if (applyToAllSelected) { + for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) { - _segments[i].speed = s; - _segments[i].intensity = in; - _segments[i].palette = p; - setMode(i, m); + if (_segments[i].isSelected()) + { + _segments[i].speed = s; + _segments[i].intensity = in; + _segments[i].palette = p; + setMode(i, m); + } } + } else { + seg.speed = s; + seg.intensity = in; + seg.palette = p; + setMode(mainSegment, m); } if (seg.mode != modePrev || seg.speed != speedPrev || seg.intensity != intensityPrev || seg.palette != palettePrev) return true; @@ -356,9 +336,13 @@ void WS2812FX::setColor(uint8_t slot, uint8_t r, uint8_t g, uint8_t b, uint8_t w void WS2812FX::setColor(uint8_t slot, uint32_t c) { if (slot >= NUM_COLORS) return; - for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) - { - if (_segments[i].isSelected()) _segments[i].colors[slot] = c; + if (applyToAllSelected) { + for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) + { + if (_segments[i].isSelected()) _segments[i].colors[slot] = c; + } + } else { + _segments[getMainSegmentId()].colors[slot] = c; } } @@ -558,7 +542,7 @@ void WS2812FX::unlockAll() void WS2812FX::setTransitionMode(bool t) { - _segment_index = 0; + _segment_index = getMainSegmentId(); SEGMENT.setOption(7,t); if (!t) return; unsigned long waitMax = millis() + 20; //refresh after 20 ms if transition enabled diff --git a/wled00/data/settings_ui.htm b/wled00/data/settings_ui.htm index ee452adf..4c44c282 100644 --- a/wled00/data/settings_ui.htm +++ b/wled00/data/settings_ui.htm @@ -37,18 +37,19 @@ +

%MSG%)====="; //firmware update page const char PAGE_update[] PROGMEM = R"=====( WLED Update -%CSS%.bt{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}input[type=file]{font-size:16px}body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%%} +

WLED Software Update

Installed version: 0.8.6
Download the latest binary:

)====="; //new user welcome page -#ifndef WLED_DISABLE_MOBILE_UI const char PAGE_welcome[] PROGMEM = R"=====(WLED Setup

Welcome to WLED!

Thank you for installing my application!

If you encounter a bug or have a question/feature suggestion, feel free to open a GitHub issue!

Next steps:

Connect the module to your local WiFi here!

Just trying this out in AP mode?
)====="; -#else -const char PAGE_welcome[] PROGMEM = ""; -#endif //liveview diff --git a/wled00/html_settings.h b/wled00/html_settings.h index e90548aa..bea614ba 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -3,12 +3,12 @@ */ //common CSS of settings pages -const char PAGE_settingsCss[] PROGMEM = R"=====(body{font-family:var(--cFn),sans-serif;text-align:center;background:var(--cCol);color:var(--tCol);line-height:200%%;margin:0;background-attachment:fixed}hr{border-color:var(--dCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:20px;margin:8px;margin-top:12px}.helpB{text-align:left;position:absolute;width:60px}input{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:.5ch solid var(--bCol);filter:drop-shadow(-5px -5px 5px var(--sCol))}input[type=number]{width:4em}select{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),sans-serif;border:0.5ch solid var(--bCol);filter:drop-shadow( -5px -5px 5px var(--sCol) );}td{padding:2px;})====="; +const char PAGE_settingsCss[] PROGMEM = R"=====()====="; //settings menu const char PAGE_settings[] PROGMEM = R"=====( -WLED Settings%CSS%body{text-align:center;background:var(--cCol);height:100%%;margin:0;background-attachment:fixed}html{--h:11.55vh}button{background:var(--bCol);color:var(--tCol);font-family:var(--cFn),Helvetica,sans-serif;border:.3ch solid var(--bCol);display:inline-block;filter:drop-shadow(-5px -5px 5px var(--sCol));font-size:8vmin;height:var(--h);width:95%%;margin-top:2.4vh} +WLED Settings
@@ -205,44 +205,7 @@ function gId(s){return document.getElementById(s);}function S(){GetV();Ct();}fun

Web Setup

-User Interface Mode: -
Server description:

-The following options are for the classic UI!
-Use HSB sliders instead of RGB by default:
-Color Theme: -
-
-Please specify your custom hex colors (e.g. FF0000 for red)
-Custom accent color:
-Custom background:
-Custom panel color:
-Custom icon color:
-Custom shadow:
-Custom text color:
-Use font:
-Make sure the font you use is installed on your system!

diff --git a/wled00/html_mobile.h b/wled00/html_ui.h similarity index 99% rename from wled00/html_mobile.h rename to wled00/html_ui.h index 812d98e3..7b2f6713 100644 --- a/wled00/html_mobile.h +++ b/wled00/html_ui.h @@ -10,16 +10,9 @@ * 4. update length value */ -#ifdef WLED_DISABLE_MOBILE_UI -const uint16_t PAGE_indexM_L = 91; //length of the binary payload +const uint16_t PAGE_index_L = 19140; //length of the binary payload -const char PAGE_indexM[] PROGMEM = R"=====( -Mobile UI is unsupported in this build. Go to /settings/ui and change UI mode to "Classic". -)====="; -#else -const uint16_t PAGE_indexM_L = 19140; //length of the binary payload - -const uint8_t PAGE_indexM[] PROGMEM = { +const uint8_t PAGE_index[] PROGMEM = { 0x1f, 0x8b, 0x08, 0x08, 0x0c, 0x8f, 0x81, 0x5c, 0x00, 0x03, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x20, 0x28, 0x31, 0x35, 0x29, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x00, 0xed, 0xbd, 0x69, 0x7b, 0xda, 0x48, 0xb7, 0x28, 0xfa, 0xfd, 0xfd, 0x15, 0x6e, 0xfa, 0x79, 0xbb, 0x21, @@ -1218,6 +1211,3 @@ const uint8_t PAGE_indexM[] PROGMEM = { 0x1f, 0x71, 0xb4, 0xcd, 0x02, 0x1f, 0xaa, 0x6f, 0x1a, 0x9f, 0xfe, 0x6f, 0x73, 0xe4, 0x9c, 0x59, 0x8e, 0xa4, 0x00, 0x00, }; - - -#endif diff --git a/wled00/src/dependencies/json/AsyncJson-v6.h b/wled00/src/dependencies/json/AsyncJson-v6.h index c6ceeaf5..5bf87e1b 100644 --- a/wled00/src/dependencies/json/AsyncJson-v6.h +++ b/wled00/src/dependencies/json/AsyncJson-v6.h @@ -15,7 +15,7 @@ #include "ArduinoJson-v6.h" #include -#define DYNAMYC_JSON_DOCUMENT_SIZE 4096 +#define DYNAMYC_JSON_DOCUMENT_SIZE 8192 constexpr const char* JSON_MIMETYPE = "application/json"; diff --git a/wled00/wled00.ino b/wled00/wled00.ino index df9d3582..7011bce9 100644 --- a/wled00/wled00.ino +++ b/wled00/wled00.ino @@ -22,7 +22,6 @@ //#define WLED_DISABLE_CRONIXIE //#define WLED_DISABLE_HUESYNC //#define WLED_DISABLE_INFRARED //there is no pin left for this on ESP8266-01 -//#define WLED_DISABLE_MOBILE_UI #define WLED_ENABLE_ADALIGHT //only saves about 500b #define WLED_DISABLE_FILESYSTEM //SPIFFS is not used by any WLED feature yet @@ -71,8 +70,7 @@ #include "src/dependencies/async-mqtt-client/AsyncMqttClient.h" #include "src/dependencies/json/AsyncJson-v6.h" #include "src/dependencies/json/ArduinoJson-v6.h" -#include "html_classic.h" -#include "html_mobile.h" +#include "html_ui.h" #include "html_settings.h" #include "html_other.h" #include "FX.h" @@ -99,7 +97,7 @@ //version code in format yymmddb (b = daily build) -#define VERSION 1912011 +#define VERSION 1912013 char versionString[] = "0.8.7-dev"; @@ -161,12 +159,6 @@ byte briMultiplier = 100; //% of brightness to set (to limit //User Interface CONFIG char serverDescription[33] = "WLED"; //Name of module -byte currentTheme = 7; //UI theme index for settings and classic UI -byte uiConfiguration = 2; //0: automatic (depends on user-agent) 1: classic UI 2: mobile UI -bool useHSB = true; //classic UI: use HSB sliders instead of RGB by default -char cssFont[33] = "Verdana"; //font to use in classic UI - -bool useHSBDefault = useHSB; //Sync CONFIG @@ -324,7 +316,6 @@ byte effectPalette = effectPaletteDefault; bool udpConnected = false, udpRgbConnected = false; //ui style -char cssCol[6][9]={"","","","","",""}; bool showWelcomePage = false; //hue diff --git a/wled00/wled01_eeprom.ino b/wled00/wled01_eeprom.ino index d6025641..dd3bba8b 100644 --- a/wled00/wled01_eeprom.ino +++ b/wled00/wled01_eeprom.ino @@ -134,7 +134,6 @@ void saveSettingsToEEPROM() EEPROM.write(367, (arlsOffset>=0)); EEPROM.write(368, abs(arlsOffset)); EEPROM.write(369, turnOnAtBoot); - EEPROM.write(370, useHSBDefault); EEPROM.write(371, colS[3]); //white default EEPROM.write(372, useRGBW); EEPROM.write(373, effectPaletteDefault); @@ -171,14 +170,6 @@ void saveSettingsToEEPROM() //favorite setting (preset) memory (25 slots/ each 20byte) //400 - 899 reserved - for (int k=0;k<6;k++){ - int in = 900+k*8; - writeStringToEEPROM(in, cssCol[k], 8); - } - - EEPROM.write(948,currentTheme); - writeStringToEEPROM(950, cssFont, 32); - EEPROM.write(2048, huePollingEnabled); //EEPROM.write(2049, hueUpdatingEnabled); for (int i = 2050; i < 2054; ++i) @@ -232,7 +223,6 @@ void saveSettingsToEEPROM() EEPROM.write(2200, !receiveDirect); EEPROM.write(2201, notifyMacro); //was enableRealtime - EEPROM.write(2202, uiConfiguration); EEPROM.write(2203, autoRGBtoRGBW); EEPROM.write(2204, skipFirstLed); @@ -365,7 +355,6 @@ void loadSettingsFromEEPROM(bool first) arlsOffset = EEPROM.read(368); if (!EEPROM.read(367)) arlsOffset = -arlsOffset; turnOnAtBoot = EEPROM.read(369); - useHSBDefault = EEPROM.read(370); colS[3] = EEPROM.read(371); col[3] = colS[3]; useRGBW = EEPROM.read(372); effectPaletteDefault = EEPROM.read(373); effectPalette = effectPaletteDefault; @@ -386,7 +375,6 @@ void loadSettingsFromEEPROM(bool first) receiveNotificationColor = EEPROM.read(391); receiveNotificationEffects = EEPROM.read(392); - readStringFromEEPROM(950, cssFont, 32); } else //keep receiving notification behavior from pre0.5.0 after update { receiveNotificationColor = receiveNotificationBrightness; @@ -501,12 +489,6 @@ void loadSettingsFromEEPROM(bool first) receiveDirect = !EEPROM.read(2200); notifyMacro = EEPROM.read(2201); - uiConfiguration = EEPROM.read(2202); - - #ifdef WLED_DISABLE_MOBILE_UI - uiConfiguration = 1; - //force default UI since mobile is unavailable - #endif autoRGBtoRGBW = EEPROM.read(2203); skipFirstLed = EEPROM.read(2204); @@ -533,12 +515,6 @@ void loadSettingsFromEEPROM(bool first) //favorite setting (preset) memory (25 slots/ each 20byte) //400 - 899 reserved - currentTheme = EEPROM.read(948); - for (int k=0;k<6;k++){ - int in=900+k*8; - readStringFromEEPROM(in, cssCol[k], 8); - } - //custom macro memory (16 slots/ each 64byte) //1024-2047 reserved @@ -547,8 +523,6 @@ void loadSettingsFromEEPROM(bool first) //user MOD memory //2944 - 3071 reserved - useHSB = useHSBDefault; - overlayCurrent = overlayDefault; savedToPresets(); @@ -556,12 +530,12 @@ void loadSettingsFromEEPROM(bool first) //PRESET PROTOCOL 20 bytes -//0: preset purpose byte 0:invalid 1:valid preset 1.0 +//0: preset purpose byte 0:invalid 1:valid preset 2:segment preset 2.0 //1:a 2:r 3:g 4:b 5:w 6:er 7:eg 8:eb 9:ew 10:fx 11:sx | custom chase 12:numP 13:numS 14:(0:fs 1:both 2:fe) 15:step 16:ix 17: fp 18-19:Zeros //determines which presets already contain save data void savedToPresets() { - for (byte index = 1; index <= 16; index++) + for (byte index = 1; index < 16; index++) { uint16_t i = 380 + index*20; @@ -572,6 +546,12 @@ void savedToPresets() savedPresets &= ~(0x01 << (index-1)); } } + if (EEPROM.read(700) == 2) { + savedPresets |= 0x01 << 15; + } else + { + savedPresets &= ~(0x01 << 15); + } } bool applyPreset(byte index, bool loadBri = true, bool loadCol = true, bool loadFX = true) @@ -581,24 +561,31 @@ bool applyPreset(byte index, bool loadBri = true, bool loadCol = true, bool load loadSettingsFromEEPROM(false);//load boot defaults return true; } - if (index > 25 || index < 1) return false; + if (index > 16 || index < 1) return false; uint16_t i = 380 + index*20; - if (EEPROM.read(i) == 0) return false; - if (loadBri) bri = EEPROM.read(i+1); - if (loadCol) - { - for (byte j=0; j<4; j++) + if (index < 16) { + if (EEPROM.read(i) != 1) return false; + if (loadBri) bri = EEPROM.read(i+1); + if (loadCol) { - col[j] = EEPROM.read(i+j+2); - colSec[j] = EEPROM.read(i+j+6); + for (byte j=0; j<4; j++) + { + col[j] = EEPROM.read(i+j+2); + colSec[j] = EEPROM.read(i+j+6); + } } - } - if (loadFX) - { - effectCurrent = EEPROM.read(i+10); - effectSpeed = EEPROM.read(i+11); - effectIntensity = EEPROM.read(i+16); - effectPalette = EEPROM.read(i+17); + if (loadFX) + { + effectCurrent = EEPROM.read(i+10); + effectSpeed = EEPROM.read(i+11); + effectIntensity = EEPROM.read(i+16); + effectPalette = EEPROM.read(i+17); + } + } else { + if (EEPROM.read(i) != 2) return false; + if (loadBri) bri = EEPROM.read(i+1); + WS2812FX::Segment* seg = strip.getSegments(); + memcpy(seg, EEPROM.getDataPtr() +i+2, 240); } currentPreset = index; isPreset = true; @@ -607,21 +594,30 @@ bool applyPreset(byte index, bool loadBri = true, bool loadCol = true, bool load void savePreset(byte index) { - if (index > 25) return; + if (index > 16) return; if (index < 1) {saveSettingsToEEPROM();return;} uint16_t i = 380 + index*20;//min400 - EEPROM.write(i, 1); - EEPROM.write(i+1, bri); - for (uint16_t j=0; j<4; j++) - { - EEPROM.write(i+j+2, col[j]); - EEPROM.write(i+j+6, colSec[j]); + + if (index < 16) { + EEPROM.write(i, 1); + EEPROM.write(i+1, bri); + for (uint16_t j=0; j<4; j++) + { + EEPROM.write(i+j+2, col[j]); + EEPROM.write(i+j+6, colSec[j]); + } + EEPROM.write(i+10, effectCurrent); + EEPROM.write(i+11, effectSpeed); + + EEPROM.write(i+16, effectIntensity); + EEPROM.write(i+17, effectPalette); + } else { //segment 16 can save segments + EEPROM.write(i, 2); + EEPROM.write(i+1, bri); + WS2812FX::Segment* seg = strip.getSegments(); + memcpy(EEPROM.getDataPtr() +i+2, seg, 240); } - EEPROM.write(i+10, effectCurrent); - EEPROM.write(i+11, effectSpeed); - - EEPROM.write(i+16, effectIntensity); - EEPROM.write(i+17, effectPalette); + commit(); currentPreset = index; isPreset = true; diff --git a/wled00/wled02_xml.ino b/wled00/wled02_xml.ino index 60af19fa..c902ea65 100644 --- a/wled00/wled02_xml.ino +++ b/wled00/wled02_xml.ino @@ -53,9 +53,7 @@ char* XML_response(AsyncWebServerRequest *request, bool includeTheme, char* dest } oappend(""); oappendi(colSec[3]); - oappend(""); - oappendi(useHSB); - oappend(""); + oappend(""); oappendi(presetCyclingEnabled); oappend(""); if (realtimeActive) @@ -79,28 +77,7 @@ char* XML_response(AsyncWebServerRequest *request, bool includeTheme, char* dest } oappend(""); oappendi(strip.getMainSegmentId()); - oappend(""); - if (includeTheme) - { - char cs[6][9]; - getThemeColors(cs); - oappend("#"); - oappend(cs[0]); - oappend("#"); - oappend(cs[1]); - oappend("#"); - oappend(cs[2]); - oappend("#"); - oappend(cs[3]); - oappend("#"); - oappend(cs[4]); - oappend("#"); - oappend(cs[5]); - oappend(""); - oappend(cssFont); - oappend(""); - } - oappend(""); + oappend(""); if (request != nullptr) request->send(200, "text/xml", obuf); } @@ -278,17 +255,7 @@ void getSettingsJS(byte subPage, char* dest) if (subPage == 3) { - sappend('i',"UI",uiConfiguration); sappends('s',"DS",serverDescription); - sappend('c',"MD",useHSBDefault); - sappend('i',"TH",currentTheme); - char k[3]; k[0] = 'C'; k[2] = 0; //keys - for (int i=0; i<6; i++) - { - k[1] = 48+i; //ascii 0,1,2,3,4,5 - sappends('s',k,cssCol[i]); - } - sappends('s',"CF",cssFont); } if (subPage == 4) @@ -407,29 +374,3 @@ void getSettingsJS(byte subPage, char* dest) } oappend("}"); } - - -//get colors from current theme as c strings -void getThemeColors(char o[][9]) -{ - switch (currentTheme) - { - // accent color (aCol) background (bCol) panel (cCol) controls (dCol) shadows (sCol) text (tCol) - default: strcpy(o[0], "D9B310"); strcpy(o[1], "0B3C5D"); strcpy(o[2], "1D2731"); strcpy(o[3], "328CC1"); strcpy(o[4], "000"); strcpy(o[5], "328CC1"); break; //night - case 1: strcpy(o[0], "eee"); strcpy(o[1], "ddd"); strcpy(o[2], "b9b9b9"); strcpy(o[3], "049"); strcpy(o[4], "777"); strcpy(o[5], "049"); break; //modern - case 2: strcpy(o[0], "abb"); strcpy(o[1], "fff"); strcpy(o[2], "ddd"); strcpy(o[3], "000"); strcpy(o[4], "0004"); strcpy(o[5], "000"); break; //bright - case 3: strcpy(o[0], "c09f80"); strcpy(o[1], "d7cec7"); strcpy(o[2], "76323f"); strcpy(o[3], "888"); strcpy(o[4], "3334"); strcpy(o[5], "888"); break; //wine - case 4: strcpy(o[0], "3cc47c"); strcpy(o[1], "828081"); strcpy(o[2], "d9a803"); strcpy(o[3], "1e392a"); strcpy(o[4], "000a"); strcpy(o[5], "1e392a"); break; //electric - case 5: strcpy(o[0], "57bc90"); strcpy(o[1], "a5a5af"); strcpy(o[2], "015249"); strcpy(o[3], "88c9d4"); strcpy(o[4], "0004"); strcpy(o[5], "88c9d4"); break; //mint - case 6: strcpy(o[0], "f7c331"); strcpy(o[1], "dca"); strcpy(o[2], "6b7a8f"); strcpy(o[3], "f7882f"); strcpy(o[4], "0007"); strcpy(o[5], "f7882f"); break; //amber - case 7: strcpy(o[0], "fff"); strcpy(o[1], "333"); strcpy(o[2], "222"); strcpy(o[3], "666"); strcpy(o[4], ""); strcpy(o[5], "fff"); break; //dark - case 8: strcpy(o[0], "0ac"); strcpy(o[1], "124"); strcpy(o[2], "224"); strcpy(o[3], "003eff"); strcpy(o[4], "003eff"); strcpy(o[5], "003eff"); break; //air - case 9: strcpy(o[0], "f70"); strcpy(o[1], "421"); strcpy(o[2], "221"); strcpy(o[3], "a50"); strcpy(o[4], "f70"); strcpy(o[5], "f70"); break; //nixie - case 10: strcpy(o[0], "2d2"); strcpy(o[1], "010"); strcpy(o[2], "121"); strcpy(o[3], "060"); strcpy(o[4], "040"); strcpy(o[5], "3f3"); break; //terminal - case 11: strcpy(o[0], "867ADE"); strcpy(o[1], "4033A3"); strcpy(o[2], "483AAA"); strcpy(o[3], "483AAA"); strcpy(o[4], ""); strcpy(o[5], "867ADE"); break; //c64 - case 12: strcpy(o[0], "fbe8a6"); strcpy(o[1], "d2fdff"); strcpy(o[2], "b4dfe5"); strcpy(o[3], "f4976c"); strcpy(o[4], ""); strcpy(o[5], "303c6c"); break; //easter - case 13: strcpy(o[0], "d4af37"); strcpy(o[1], "173305"); strcpy(o[2], "308505"); strcpy(o[3], "f21313"); strcpy(o[4], "f002"); strcpy(o[5], "d4af37"); break; //christmas - case 14: strcpy(o[0], "fc7"); strcpy(o[1], "49274a"); strcpy(o[2], "94618e"); strcpy(o[3], "f4decb"); strcpy(o[4], "0008"); strcpy(o[5], "f4decb"); break; //end - case 15: for (int i=0;i<6;i++) strcpy(o[i], cssCol[i]); //custom - } -} diff --git a/wled00/wled03_set.ino b/wled00/wled03_set.ino index 2782de16..16ad21fb 100644 --- a/wled00/wled03_set.ino +++ b/wled00/wled03_set.ino @@ -128,19 +128,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage) //UI if (subPage == 3) { - int t = request->arg("UI").toInt(); - if (t >= 0 && t < 3) uiConfiguration = t; strlcpy(serverDescription, request->arg("DS").c_str(), 33); - useHSBDefault = request->hasArg("MD"); - useHSB = useHSBDefault; - currentTheme = request->arg("TH").toInt(); - char k[3]; k[0]='C'; k[2]=0; - for(int i=0;i<6;i++) - { - k[1] = i+48; - strlcpy(cssCol[i],request->arg(k).c_str(), 9); - } - strlcpy(cssFont,request->arg("CF").c_str(), 33); } //SYNC @@ -383,6 +371,8 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) //if you save a macro in one request, other commands in that request are ignored due to unwanted behavior otherwise } + strip.applyToAllSelected = true; + //segment select (sets main segment) pos = req.indexOf("SS="); if (pos > 0) { @@ -511,12 +501,6 @@ bool handleSet(AsyncWebServerRequest *request, const String& req) } #endif - //set default control mode (0 - RGB, 1 - HSB) - pos = req.indexOf("MD="); - if (pos > 0) { - useHSB = getNumVal(&req, pos); - } - //set advanced overlay pos = req.indexOf("OL="); if (pos > 0) { diff --git a/wled00/wled05_init.ino b/wled00/wled05_init.ino index b940a631..a07ef3d7 100644 --- a/wled00/wled05_init.ino +++ b/wled00/wled05_init.ino @@ -313,13 +313,3 @@ int getSignalQuality(int rssi) } return quality; } - -bool checkClientIsMobile(String useragent) -{ - //to save complexity this function is not comprehensive - if (useragent.indexOf("Android") >= 0) return true; - if (useragent.indexOf("iPhone") >= 0) return true; - if (useragent.indexOf("iPod") >= 0) return true; - if (useragent.indexOf("iPad") >= 0) return true; - return false; -} diff --git a/wled00/wled08_led.ino b/wled00/wled08_led.ino index 540619a7..52320f05 100644 --- a/wled00/wled08_led.ino +++ b/wled00/wled08_led.ino @@ -71,6 +71,8 @@ void colorUpdated(int callMode) { //call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification) // 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa + if (callMode != 1 && callMode != 5) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments + bool fxChanged = strip.setEffectConfig(effectCurrent, effectSpeed, effectIntensity, effectPalette); if (!colorChanged()) { @@ -82,10 +84,14 @@ void colorUpdated(int callMode) notify(6); if (callMode != 8) interfaceUpdateCallMode = 6; if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0; + if (isPreset) {isPreset = false;} + else {currentPreset = -1;} } return; //no change } if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0; + if (isPreset) {isPreset = false;} + else {currentPreset = -1;} if (callMode != 5 && nightlightActive && nightlightFade) { briNlT = bri; diff --git a/wled00/wled18_server.ino b/wled00/wled18_server.ino index aca68696..953fcdcd 100644 --- a/wled00/wled18_server.ino +++ b/wled00/wled18_server.ino @@ -147,9 +147,7 @@ void initServer() //init ota page #ifndef WLED_DISABLE_OTA server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){ - olen = 0; - getCSSColors(); - request->send_P(200, "text/html", PAGE_update, msgProcessor); + request->send_P(200, "text/html", PAGE_update); }); server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){ @@ -231,47 +229,15 @@ void serveIndexOrWelcome(AsyncWebServerRequest *request) } -void getCSSColors() -{ - char cs[6][9]; - getThemeColors(cs); - oappend("