Usermod wordclock: support for upfront LEDs (#2668)

* - add ledOffset to support LEDs that are not effected by the usermode before the wordclock LEDs

* - adjust readme
This commit is contained in:
Stefan Riese 2022-09-26 09:35:42 +02:00 committed by GitHub
parent c253464b2a
commit b6adbc926f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -1,11 +1,12 @@
# Word Clock Usermod V2 # Word Clock Usermod V2
This usermod can be used to drive a wordclock with a 11x10 pixel matrix with WLED. There are also 4 additional dots for the minutes. This usermod can be used to drive a wordclock with a 11x10 pixel matrix with WLED. There are also 4 additional dots for the minutes.
The visualisation is desribed in 4 mask with LED numbers (single dots for minutes, minutes, hours and "clock/Uhr"). The visualisation is desribed in 4 mask with LED numbers (single dots for minutes, minutes, hours and "clock/Uhr"). The index of the LEDs in the masks always starts with the index 0, even if the ledOffset is not 0.
There are 2 parameters to chnage the behaviour: There are 3 parameters to change the behaviour:
active: enable/disable usermod active: enable/disable usermod
diplayItIs: enable/disable display of "Es ist" on the clock. diplayItIs: enable/disable display of "Es ist" on the clock
ledOffset: number of LEDs before the wordclock LEDs
## Installation ## Installation

View File

@ -23,6 +23,7 @@ class WordClockUsermod : public Usermod
// set your config variables to their boot default value (this can also be done in readFromConfig() or a constructor if you prefer) // set your config variables to their boot default value (this can also be done in readFromConfig() or a constructor if you prefer)
bool usermodActive = false; bool usermodActive = false;
bool displayItIs = false; bool displayItIs = false;
int ledOffset = 100;
// defines for mask sizes // defines for mask sizes
#define maskSizeLeds 114 #define maskSizeLeds 114
@ -358,6 +359,7 @@ class WordClockUsermod : public Usermod
JsonObject top = root.createNestedObject("WordClockUsermod"); JsonObject top = root.createNestedObject("WordClockUsermod");
top["active"] = usermodActive; top["active"] = usermodActive;
top["displayItIs"] = displayItIs; top["displayItIs"] = displayItIs;
top["ledOffset"] = ledOffset;
} }
/* /*
@ -386,6 +388,7 @@ class WordClockUsermod : public Usermod
configComplete &= getJsonValue(top["active"], usermodActive); configComplete &= getJsonValue(top["active"], usermodActive);
configComplete &= getJsonValue(top["displayItIs"], displayItIs); configComplete &= getJsonValue(top["displayItIs"], displayItIs);
configComplete &= getJsonValue(top["ledOffset"], ledOffset);
return configComplete; return configComplete;
} }
@ -407,7 +410,7 @@ class WordClockUsermod : public Usermod
if (maskLedsOn[x] == 0) if (maskLedsOn[x] == 0)
{ {
// set pixel off // set pixel off
strip.setPixelColor(x, RGBW32(0,0,0,0)); strip.setPixelColor(x + ledOffset, RGBW32(0,0,0,0));
} }
} }
} }