Usermod Wordclock update to use an alternatve wiring pattern (#2757)

* Update

* update readme file

* readme update

* Update readme.md

* Update readme.md

* Update readme.md

* Update readme.md

* Update platformio.ini
This commit is contained in:
Patrick 2022-09-22 20:43:40 +02:00 committed by GitHub
parent 8bd8975e0a
commit 1daa97545b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 1 deletions

View File

@ -7,6 +7,16 @@ There are 2 parameters to chnage the behaviour:
active: enable/disable usermod
diplayItIs: enable/disable display of "Es ist" on the clock.
### Update for alternatative wiring pattern
Based on this fantastic work I added an alternative wiring pattern.
For original you have to use a long wire to connect DO - DI from first line to the next line.
I wired my clock in meander style. So the first LED in second line is in the right.
With this problem every second line was inverted and showed the wrong letter.
I added a switch in usermod called "meander wiring?" to enable/disable alternativ wiring pattern.
## Installation
Copy and update the example `platformio_override.ini.sample`
@ -23,4 +33,6 @@ No special requirements.
## Change Log
2022/03/30 initial commit
2022/08/18 added meander wiring pattern.
2022/03/30 initial commit

View File

@ -23,15 +23,19 @@ 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)
bool usermodActive = false;
bool displayItIs = false;
bool meander = false;
// defines for mask sizes
#define maskSizeLeds 114
#define maskSizeMinutes 12
#define maskSizeMinutesMea 12
#define maskSizeHours 6
#define maskSizeHoursMea 6
#define maskSizeItIs 5
#define maskSizeMinuteDots 4
// "minute" masks
// Normal wiring
const int maskMinutes[12][maskSizeMinutes] =
{
{107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // :00
@ -48,7 +52,25 @@ class WordClockUsermod : public Usermod
{ 7, 8, 9, 10, 33, 34, 35, -1, -1, -1, -1, -1} // :55 fünf vor
};
// Meander wiring
const int maskMinutesMea[12][maskSizeMinutesMea] =
{
{ 99, 100, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // :00
{ 7, 8, 9, 10, 33, 34, 35, 36, -1, -1, -1, -1}, // :05 fünf nach
{ 18, 19, 20, 21, 33, 34, 35, 36, -1, -1, -1, -1}, // :10 zehn nach
{ 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1}, // :15 viertel
{ 11, 12, 13, 14, 15, 16, 17, 33, 34, 35, 36, -1}, // :20 zwanzig nach
{ 7, 8, 9, 10, 41, 42, 43, 44, 45, 46, 47, -1}, // :25 fünf vor halb
{ 44, 45, 46, 47, -1, -1, -1, -1, -1, -1, -1, -1}, // :30 halb
{ 7, 8, 9, 10, 33, 34, 35, 36, 44, 45, 46, 47}, // :35 fünf nach halb
{ 11, 12, 13, 14, 15, 16, 17, 41, 42, 43, -1, -1}, // :40 zwanzig vor
{ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1}, // :45 dreiviertel
{ 18, 19, 20, 21, 41, 42, 43, -1, -1, -1, -1, -1}, // :50 zehn vor
{ 7, 8, 9, 10, 41, 42, 43, -1, -1, -1, -1, -1} // :55 fünf vor
};
// hour masks
// Normal wiring
const int maskHours[13][maskSizeHours] =
{
{ 55, 56, 57, -1, -1, -1}, // 01: ein
@ -65,6 +87,23 @@ class WordClockUsermod : public Usermod
{ 49, 50, 51, -1, -1, -1}, // 11: elf
{ 94, 95, 96, 97, 98, -1} // 12: zwölf and 00: null
};
// Meander wiring
const int maskHoursMea[13][maskSizeHoursMea] =
{
{ 63, 64, 65, -1, -1, -1}, // 01: ein
{ 62, 63, 64, 65, -1, -1}, // 01: eins
{ 55, 56, 57, 58, -1, -1}, // 02: zwei
{ 66, 67, 68, 69, -1, -1}, // 03: drei
{ 73, 74, 75, 76, -1, -1}, // 04: vier
{ 51, 52, 53, 54, -1, -1}, // 05: fünf
{ 83, 84, 85, 86, 87, -1}, // 06: sechs
{ 88, 89, 90, 91, 92, 93}, // 07: sieben
{ 77, 78, 79, 80, -1, -1}, // 08: acht
{103, 104, 105, 106, -1, -1}, // 09: neun
{106, 107, 108, 109, -1, -1}, // 10: zehn
{ 49, 50, 51, -1, -1, -1}, // 11: elf
{ 94, 95, 96, 97, 98, -1} // 12: zwölf and 00: null
};
// mask "it is"
const int maskItIs[maskSizeItIs] = {0, 1, 3, 4, 5};
@ -127,14 +166,24 @@ class WordClockUsermod : public Usermod
}
// update led mask
if (meander)
{
updateLedMask(maskHoursMea[index], maskSizeHoursMea);
} else {
updateLedMask(maskHours[index], maskSizeHours);
}
}
// set minutes
void setMinutes(int index)
{
// update led mask
if (meander)
{
updateLedMask(maskMinutesMea[index], maskSizeMinutesMea);
} else {
updateLedMask(maskMinutes[index], maskSizeMinutes);
}
}
// set minutes dot
@ -358,6 +407,7 @@ class WordClockUsermod : public Usermod
JsonObject top = root.createNestedObject("WordClockUsermod");
top["active"] = usermodActive;
top["displayItIs"] = displayItIs;
top["Meander wiring?"] = meander;
}
/*
@ -386,6 +436,7 @@ class WordClockUsermod : public Usermod
configComplete &= getJsonValue(top["active"], usermodActive);
configComplete &= getJsonValue(top["displayItIs"], displayItIs);
configComplete &= getJsonValue(top["Meander wiring?"], meander);
return configComplete;
}