Skip to content

Commit eca3f12

Browse files
committed
Fixed analog overlay not settable
1 parent a2c8796 commit eca3f12

File tree

5 files changed

+7
-18
lines changed

5 files changed

+7
-18
lines changed

wled00/cfg.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
363363
CJSON(latitude, if_ntp[F("lt")]);
364364

365365
JsonObject ol = doc[F("ol")];
366-
prev = overlayDefault;
367-
CJSON(overlayDefault ,ol[F("clock")]); // 0
366+
CJSON(overlayCurrent ,ol[F("clock")]); // 0
368367
CJSON(countdownMode, ol[F("cntdwn")]);
369-
if (prev != overlayDefault) overlayCurrent = overlayDefault;
370368

371369
CJSON(overlayMin, ol["min"]);
372370
CJSON(overlayMax, ol[F("max")]);
@@ -772,7 +770,7 @@ void serializeConfig() {
772770
if_ntp[F("lt")] = latitude;
773771

774772
JsonObject ol = doc.createNestedObject("ol");
775-
ol[F("clock")] = overlayDefault;
773+
ol[F("clock")] = overlayCurrent;
776774
ol[F("cntdwn")] = countdownMode;
777775

778776
ol["min"] = overlayMin;

wled00/set.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
322322
// force a sunrise/sunset re-calculation
323323
calculateSunriseAndSunset();
324324

325-
if (request->hasArg(F("OL"))) {
326-
overlayDefault = request->arg(F("OL")).toInt();
327-
overlayCurrent = overlayDefault;
328-
}
325+
overlayCurrent = request->hasArg(F("OL")) ? 1 : 0;
329326

330327
overlayMin = request->arg(F("O1")).toInt();
331328
overlayMax = request->arg(F("O2")).toInt();

wled00/wled.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
// version code in format yymmddb (b = daily build)
11-
#define VERSION 2203060
11+
#define VERSION 2203061
1212

1313
//uncomment this if you have a "my_config.h" file you'd like to use
1414
//#define WLED_USE_MY_CONFIG
@@ -383,7 +383,7 @@ WLED_GLOBAL bool useAMPM _INIT(false); // 12h/24h clock format
383383
WLED_GLOBAL byte currentTimezone _INIT(0); // Timezone ID. Refer to timezones array in wled10_ntp.ino
384384
WLED_GLOBAL int utcOffsetSecs _INIT(0); // Seconds to offset from UTC before timzone calculation
385385

386-
WLED_GLOBAL byte overlayDefault _INIT(0); // 0: no overlay 1: analog clock 2: was single-digit clock 3: was cronixie
386+
WLED_GLOBAL byte overlayCurrent _INIT(0); // 0: no overlay 1: analog clock 2: was single-digit clock 3: was cronixie
387387
WLED_GLOBAL byte overlayMin _INIT(0), overlayMax _INIT(DEFAULT_LED_COUNT - 1); // boundaries of overlay mode
388388

389389
WLED_GLOBAL byte analogClock12pixel _INIT(0); // The pixel in your strip where "midnight" would be
@@ -496,9 +496,6 @@ WLED_GLOBAL bool hueAuthRequired _INIT(false);
496496
WLED_GLOBAL bool hueReceived _INIT(false);
497497
WLED_GLOBAL bool hueStoreAllowed _INIT(false), hueNewKey _INIT(false);
498498

499-
// overlays
500-
WLED_GLOBAL byte overlayCurrent _INIT(overlayDefault);
501-
502499
// countdown
503500
WLED_GLOBAL unsigned long countdownTime _INIT(1514764800L);
504501
WLED_GLOBAL bool countdownOverTriggered _INIT(true);

wled00/wled_eeprom.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ void loadSettingsFromEEPROM()
141141
useAMPM = EEPROM.read(329);
142142
strip.gammaCorrectBri = EEPROM.read(330);
143143
strip.gammaCorrectCol = EEPROM.read(331);
144-
overlayDefault = EEPROM.read(332);
145-
if (lastEEPROMversion < 8 && overlayDefault > 0) overlayDefault--; //overlay mode 1 (solid) was removed
144+
overlayCurrent = EEPROM.read(332);
146145

147146
alexaEnabled = EEPROM.read(333);
148147

@@ -360,8 +359,6 @@ void loadSettingsFromEEPROM()
360359
//2551 - 2559 reserved for Usermods, usable by default
361360
//2560 - 2943 usable, NOT reserved (need to increase EEPSIZE accordingly, new WLED core features may override this section)
362361
//2944 - 3071 reserved for Usermods (need to increase EEPSIZE to 3072 in const.h)
363-
364-
overlayCurrent = overlayDefault;
365362
}
366363

367364

wled00/xml.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ void getSettingsJS(byte subPage, char* dest)
575575
sprintf_P(tm, PSTR("Sunrise: %02d:%02d Sunset: %02d:%02d"), hour(sunrise), minute(sunrise), hour(sunset), minute(sunset));
576576
sappends('m',SET_F("(\"times\")[1]"),tm);
577577
}
578-
sappend('i',SET_F("OL"),overlayCurrent);
578+
sappend('c',SET_F("OL"),overlayCurrent);
579579
sappend('v',SET_F("O1"),overlayMin);
580580
sappend('v',SET_F("O2"),overlayMax);
581581
sappend('v',SET_F("OM"),analogClock12pixel);

0 commit comments

Comments
 (0)