allow alternative northern style ("viertel vor ..." instead of (#3085)

"dreiviertel ..")

Co-authored-by: Uli Baumann <github@uli-baumann.de>
This commit is contained in:
Ulrich Baumann 2023-02-09 00:23:53 +01:00 committed by GitHub
parent b14c8e82a0
commit e2215ced34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ class WordClockUsermod : public Usermod
bool displayItIs = false; bool displayItIs = false;
int ledOffset = 100; int ledOffset = 100;
bool meander = false; bool meander = false;
bool nord = false;
// defines for mask sizes // defines for mask sizes
#define maskSizeLeds 114 #define maskSizeLeds 114
@ -37,7 +38,7 @@ class WordClockUsermod : public Usermod
// "minute" masks // "minute" masks
// Normal wiring // Normal wiring
const int maskMinutes[12][maskSizeMinutes] = const int maskMinutes[14][maskSizeMinutes] =
{ {
{107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // :00 {107, 108, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // :00
{ 7, 8, 9, 10, 40, 41, 42, 43, -1, -1, -1, -1}, // :05 fünf nach { 7, 8, 9, 10, 40, 41, 42, 43, -1, -1, -1, -1}, // :05 fünf nach
@ -50,11 +51,13 @@ class WordClockUsermod : public Usermod
{ 15, 16, 17, 18, 19, 20, 21, 33, 34, 35, -1, -1}, // :40 zwanzig vor { 15, 16, 17, 18, 19, 20, 21, 33, 34, 35, -1, -1}, // :40 zwanzig vor
{ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1}, // :45 dreiviertel { 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1}, // :45 dreiviertel
{ 11, 12, 13, 14, 33, 34, 35, -1, -1, -1, -1, -1}, // :50 zehn vor { 11, 12, 13, 14, 33, 34, 35, -1, -1, -1, -1, -1}, // :50 zehn vor
{ 7, 8, 9, 10, 33, 34, 35, -1, -1, -1, -1, -1} // :55 fünf vor { 7, 8, 9, 10, 33, 34, 35, -1, -1, -1, -1, -1}, // :55 fünf vor
{ 26, 27, 28, 29, 30, 31, 32, 40, 41, 42, 43, -1}, // :15 alternative viertel nach
{ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1} // :45 alternative viertel vor
}; };
// Meander wiring // Meander wiring
const int maskMinutesMea[12][maskSizeMinutesMea] = const int maskMinutesMea[14][maskSizeMinutesMea] =
{ {
{ 99, 100, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1}, // :00 { 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 { 7, 8, 9, 10, 33, 34, 35, 36, -1, -1, -1, -1}, // :05 fünf nach
@ -67,9 +70,12 @@ class WordClockUsermod : public Usermod
{ 11, 12, 13, 14, 15, 16, 17, 41, 42, 43, -1, -1}, // :40 zwanzig vor { 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 { 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 { 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 { 7, 8, 9, 10, 41, 42, 43, -1, -1, -1, -1, -1}, // :55 fünf vor
{ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, -1}, // :15 alternative viertel nach
{ 26, 27, 28, 29, 30, 31, 32, 41, 42, 43, -1, -1} // :45 alternative viertel vor
}; };
// hour masks // hour masks
// Normal wiring // Normal wiring
const int maskHours[13][maskSizeHours] = const int maskHours[13][maskSizeHours] =
@ -242,9 +248,15 @@ class WordClockUsermod : public Usermod
setHours(hours, false); setHours(hours, false);
break; break;
case 3: case 3:
// viertel if (nord) {
setMinutes(3); // viertel nach
setHours(hours + 1, false); setMinutes(12);
setHours(hours, false);
} else {
// viertel
setMinutes(3);
setHours(hours + 1, false);
};
break; break;
case 4: case 4:
// 20 nach // 20 nach
@ -272,8 +284,13 @@ class WordClockUsermod : public Usermod
setHours(hours + 1, false); setHours(hours + 1, false);
break; break;
case 9: case 9:
// viertel vor // viertel vor bzw dreiviertel
setMinutes(9); if (nord) {
setMinutes(9);
}
else {
setMinutes(12);
}
setHours(hours + 1, false); setHours(hours + 1, false);
break; break;
case 10: case 10:
@ -410,6 +427,7 @@ class WordClockUsermod : public Usermod
top["displayItIs"] = displayItIs; top["displayItIs"] = displayItIs;
top["ledOffset"] = ledOffset; top["ledOffset"] = ledOffset;
top["Meander wiring?"] = meander; top["Meander wiring?"] = meander;
top["Norddeutsch"] = nord;
} }
/* /*
@ -440,6 +458,7 @@ class WordClockUsermod : public Usermod
configComplete &= getJsonValue(top["displayItIs"], displayItIs); configComplete &= getJsonValue(top["displayItIs"], displayItIs);
configComplete &= getJsonValue(top["ledOffset"], ledOffset); configComplete &= getJsonValue(top["ledOffset"], ledOffset);
configComplete &= getJsonValue(top["Meander wiring?"], meander); configComplete &= getJsonValue(top["Meander wiring?"], meander);
configComplete &= getJsonValue(top["Norddeutsch"], nord);
return configComplete; return configComplete;
} }