diff --git a/wled00/cfg.cpp b/wled00/cfg.cpp index a0021337..86c8c687 100644 --- a/wled00/cfg.cpp +++ b/wled00/cfg.cpp @@ -366,7 +366,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { CJSON(timerMinutes[it], timer["min"]); CJSON(timerMacro[it], timer["macro"]); - byte dowPrev = timerWeekday[it]; + byte dowPrev = timerWeekday[it]; //note: act is currently only 0 or 1. //the reason we are not using bool is that the on-disk type in 0.11.0 was already int int actPrev = timerWeekday[it] & 0x01; @@ -376,7 +376,17 @@ bool deserializeConfig(JsonObject doc, bool fromFS) { int act = timer["en"] | actPrev; if (act) timerWeekday[it]++; } - + if (it<8) { + JsonObject start = timer["start"]; + byte startm = start["mon"]; + if (startm) timerMonth[it] = (startm << 4); + CJSON(timerDay[it], start["day"]); + JsonObject end = timer["end"]; + CJSON(timerDayEnd[it], end["day"]); + byte endm = end["mon"]; + if (startm) timerMonth[it] += endm & 0x0F; + if (!(timerMonth[it] & 0x0F)) timerMonth[it] += 12; //default end month to 12 + } it++; } @@ -742,6 +752,14 @@ void serializeConfig() { timers_ins0["min"] = timerMinutes[i]; timers_ins0["macro"] = timerMacro[i]; timers_ins0[F("dow")] = timerWeekday[i] >> 1; + if (i<8) { + JsonObject start = timers_ins0.createNestedObject("start"); + start["mon"] = (timerMonth[i] >> 4) & 0xF; + start["day"] = timerDay[i]; + JsonObject end = timers_ins0.createNestedObject("end"); + end["mon"] = timerMonth[i] & 0xF; + end["day"] = timerDayEnd[i]; + } } JsonObject ota = doc.createNestedObject("ota"); diff --git a/wled00/data/settings_time.htm b/wled00/data/settings_time.htm index ffe82924..8ca8851c 100644 --- a/wled00/data/settings_time.htm +++ b/wled00/data/settings_time.htm @@ -6,9 +6,11 @@