Implements option to show clock overlay only if all LEDs are solid black
This commit is contained in:
Woody 2023-10-26 23:36:29 +02:00
parent 1dab26bcbc
commit a83002ca10
No known key found for this signature in database
GPG Key ID: 9872D7F5072789B2
6 changed files with 15 additions and 0 deletions

View File

@ -496,6 +496,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
CJSON(analogClock12pixel, ol[F("o12pix")]); CJSON(analogClock12pixel, ol[F("o12pix")]);
CJSON(analogClock5MinuteMarks, ol[F("o5m")]); CJSON(analogClock5MinuteMarks, ol[F("o5m")]);
CJSON(analogClockSecondsTrail, ol[F("osec")]); CJSON(analogClockSecondsTrail, ol[F("osec")]);
CJSON(analogClockSolidBlack, ol[F("osb")]);
//timed macro rules //timed macro rules
JsonObject tm = doc[F("timers")]; JsonObject tm = doc[F("timers")];
@ -954,6 +955,7 @@ void serializeConfig() {
ol[F("o12pix")] = analogClock12pixel; ol[F("o12pix")] = analogClock12pixel;
ol[F("o5m")] = analogClock5MinuteMarks; ol[F("o5m")] = analogClock5MinuteMarks;
ol[F("osec")] = analogClockSecondsTrail; ol[F("osec")] = analogClockSecondsTrail;
ol[F("osb")] = analogClockSolidBlack;
JsonObject timers = doc.createNestedObject(F("timers")); JsonObject timers = doc.createNestedObject(F("timers"));

View File

@ -210,6 +210,7 @@
12h LED: <input name="OM" type="number" min="0" max="255" required><br> 12h LED: <input name="OM" type="number" min="0" max="255" required><br>
Show 5min marks: <input type="checkbox" name="O5"><br> Show 5min marks: <input type="checkbox" name="O5"><br>
Seconds (as trail): <input type="checkbox" name="OS"><br> Seconds (as trail): <input type="checkbox" name="OS"><br>
Show clock overlay only if all LEDs are solid black: <input type="checkbox" name="OB"><br>
</div> </div>
Countdown Mode: <input type="checkbox" name="CE"><br> Countdown Mode: <input type="checkbox" name="CE"><br>
Countdown Goal:<br> Countdown Goal:<br>

View File

@ -89,6 +89,15 @@ void _overlayAnalogCountdown()
void handleOverlayDraw() { void handleOverlayDraw() {
usermods.handleOverlayDraw(); usermods.handleOverlayDraw();
if (analogClockSolidBlack) {
Segment* segments = strip.getSegments();
for (uint8_t i = 0; i < strip.getActiveSegmentsNum(); i++) {
Segment segment = segments[i];
if (segment.mode > 0 || segment.colors[0] > 0) {
return;
}
}
}
if (overlayCurrent == 1) _overlayAnalogClock(); if (overlayCurrent == 1) _overlayAnalogClock();
} }

View File

@ -409,6 +409,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
analogClock12pixel = request->arg(F("OM")).toInt(); analogClock12pixel = request->arg(F("OM")).toInt();
analogClock5MinuteMarks = request->hasArg(F("O5")); analogClock5MinuteMarks = request->hasArg(F("O5"));
analogClockSecondsTrail = request->hasArg(F("OS")); analogClockSecondsTrail = request->hasArg(F("OS"));
analogClockSolidBlack = request->hasArg(F("OB"));
countdownMode = request->hasArg(F("CE")); countdownMode = request->hasArg(F("CE"));
countdownYear = request->arg(F("CY")).toInt(); countdownYear = request->arg(F("CY")).toInt();

View File

@ -482,6 +482,7 @@ WLED_GLOBAL byte overlayMin _INIT(0), overlayMax _INIT(DEFAULT_LED_COUNT - 1);
WLED_GLOBAL byte analogClock12pixel _INIT(0); // The pixel in your strip where "midnight" would be WLED_GLOBAL byte analogClock12pixel _INIT(0); // The pixel in your strip where "midnight" would be
WLED_GLOBAL bool analogClockSecondsTrail _INIT(false); // Display seconds as trail of LEDs instead of a single pixel WLED_GLOBAL bool analogClockSecondsTrail _INIT(false); // Display seconds as trail of LEDs instead of a single pixel
WLED_GLOBAL bool analogClock5MinuteMarks _INIT(false); // Light pixels at every 5-minute position WLED_GLOBAL bool analogClock5MinuteMarks _INIT(false); // Light pixels at every 5-minute position
WLED_GLOBAL bool analogClockSolidBlack _INIT(false); // Show clock overlay only if all LEDs are solid black (effect is 0 and color is black)
WLED_GLOBAL bool countdownMode _INIT(false); // Clock will count down towards date WLED_GLOBAL bool countdownMode _INIT(false); // Clock will count down towards date
WLED_GLOBAL byte countdownYear _INIT(20), countdownMonth _INIT(1); // Countdown target date, year is last two digits WLED_GLOBAL byte countdownYear _INIT(20), countdownMonth _INIT(1); // Countdown target date, year is last two digits

View File

@ -597,6 +597,7 @@ void getSettingsJS(byte subPage, char* dest)
sappend('v',SET_F("OM"),analogClock12pixel); sappend('v',SET_F("OM"),analogClock12pixel);
sappend('c',SET_F("OS"),analogClockSecondsTrail); sappend('c',SET_F("OS"),analogClockSecondsTrail);
sappend('c',SET_F("O5"),analogClock5MinuteMarks); sappend('c',SET_F("O5"),analogClock5MinuteMarks);
sappend('c',SET_F("OB"),analogClockSolidBlack);
sappend('c',SET_F("CE"),countdownMode); sappend('c',SET_F("CE"),countdownMode);
sappend('v',SET_F("CY"),countdownYear); sappend('v',SET_F("CY"),countdownYear);