-
Notifications
You must be signed in to change notification settings - Fork 29
update with fixes from main #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ddd4da1
8f543a5
d856d55
44a6125
b012472
43a3992
75e6bd1
80160cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,213 @@ | ||||||||||||
| // Thanks to Sandro for providing this swiss german version | ||||||||||||
| const String clockStringSwiss = "ESPESCHAFUFVIERTUBFZAAZWANZGSIVORABOHWORTUHRHAUBIANESSIEISZWOISDRUVIERIYFUFIOSACHSISEBNIACHTINUNIELZANIERBEUFIZWOUFINAGSI"; | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * @brief control the four minute indicator LEDs | ||||||||||||
| * | ||||||||||||
| * @param minutes minutes to be displayed [0 ... 59] | ||||||||||||
| * @param color 24bit color value | ||||||||||||
| */ | ||||||||||||
| void drawMinuteIndicator(uint8_t minutes, uint32_t color){ | ||||||||||||
| //separate LEDs for minutes in an additional row | ||||||||||||
| switch (minutes%5) | ||||||||||||
| { | ||||||||||||
| case 0: | ||||||||||||
| break; | ||||||||||||
|
|
||||||||||||
| case 1: | ||||||||||||
| ledmatrix.setMinIndicator(0b1000, color); | ||||||||||||
| break; | ||||||||||||
|
|
||||||||||||
| case 2: | ||||||||||||
| ledmatrix.setMinIndicator(0b1100, color); | ||||||||||||
| break; | ||||||||||||
|
|
||||||||||||
| case 3: | ||||||||||||
| ledmatrix.setMinIndicator(0b1110, color); | ||||||||||||
| break; | ||||||||||||
|
|
||||||||||||
| case 4: | ||||||||||||
| ledmatrix.setMinIndicator(0b1111, color); | ||||||||||||
| break; | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * @brief Draw the given sentence to the word clock | ||||||||||||
| * | ||||||||||||
| * @param message sentence to be displayed | ||||||||||||
| * @param color 24bit color value | ||||||||||||
| * @return int: 0 if successful, -1 if sentence not possible to display | ||||||||||||
| */ | ||||||||||||
| int showStringOnClock(String message, uint32_t color){ | ||||||||||||
| String word = ""; | ||||||||||||
| int lastLetterClock = 0; | ||||||||||||
| int positionOfWord = 0; | ||||||||||||
| int index = 0; | ||||||||||||
|
|
||||||||||||
| // add space on the end of message for splitting | ||||||||||||
| message = message + " "; | ||||||||||||
|
|
||||||||||||
| // empty the targetgrid | ||||||||||||
| ledmatrix.gridFlush(); | ||||||||||||
|
|
||||||||||||
| while(true){ | ||||||||||||
| // extract next word from message | ||||||||||||
| word = split(message, ' ', index); | ||||||||||||
| index++; | ||||||||||||
|
|
||||||||||||
| if(word.length() > 0){ | ||||||||||||
| // find word in clock string | ||||||||||||
| positionOfWord = clockStringSwiss.indexOf(word, lastLetterClock); | ||||||||||||
|
|
||||||||||||
| if(positionOfWord >= 0){ | ||||||||||||
| // word found on clock -> enable leds in targetgrid | ||||||||||||
| for(unsigned int i = 0; i < word.length(); i++){ | ||||||||||||
| int x = (positionOfWord + i)%WIDTH; | ||||||||||||
| int y = (positionOfWord + i)/WIDTH; | ||||||||||||
| ledmatrix.gridAddPixel(x, y, color); | ||||||||||||
| } | ||||||||||||
| // remember end of the word on clock | ||||||||||||
| lastLetterClock = positionOfWord + word.length(); | ||||||||||||
| } | ||||||||||||
| else{ | ||||||||||||
| // word is not possible to show on clock | ||||||||||||
| logger.logString("word is not possible to show on clock: " + String(word)); | ||||||||||||
| return -1; | ||||||||||||
| } | ||||||||||||
| }else{ | ||||||||||||
| // end - no more word in message | ||||||||||||
| break; | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| // return success | ||||||||||||
| return 0; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| /** | ||||||||||||
| * @brief Converts the given time as sentence (String) | ||||||||||||
| * | ||||||||||||
| * @param hours hours of the time value | ||||||||||||
| * @param minutes minutes of the time value | ||||||||||||
| * @return String time as sentence | ||||||||||||
| */ | ||||||||||||
| String timeToString(uint8_t hours, uint8_t minutes){ | ||||||||||||
|
|
||||||||||||
| //ES IST | ||||||||||||
| String message = "ES ESCH "; | ||||||||||||
|
|
||||||||||||
| //show minutes | ||||||||||||
| if(minutes >= 5 && minutes < 10) | ||||||||||||
| { | ||||||||||||
| message += "FUF AB "; | ||||||||||||
| } | ||||||||||||
| else if(minutes >= 10 && minutes < 15) | ||||||||||||
| { | ||||||||||||
| message += "ZAA AB "; | ||||||||||||
| } | ||||||||||||
| else if(minutes >= 15 && minutes < 20) | ||||||||||||
| { | ||||||||||||
| message += "VIERTU AB "; | ||||||||||||
| } | ||||||||||||
| else if(minutes >= 20 && minutes < 25) | ||||||||||||
| { | ||||||||||||
| message += "ZWANZG AB "; //Sandro | ||||||||||||
| } | ||||||||||||
| else if(minutes >= 25 && minutes < 30) | ||||||||||||
| { | ||||||||||||
| message += "FUF VOR HAUBI "; | ||||||||||||
| } | ||||||||||||
| else if(minutes >= 30 && minutes < 35) | ||||||||||||
| { | ||||||||||||
| message += "HAUBI "; | ||||||||||||
| } | ||||||||||||
| else if(minutes >= 35 && minutes < 40) | ||||||||||||
| { | ||||||||||||
| message += "FUF AB HAUBI "; | ||||||||||||
| } | ||||||||||||
| else if(minutes >= 40 && minutes < 45) | ||||||||||||
| { | ||||||||||||
| message += "ZWANZG VOR "; //Sandro | ||||||||||||
|
||||||||||||
| message += "ZWANZG VOR "; //Sandro | |
| message += "ZWANZG VOR "; // 'ZWANZG VOR' means 'twenty to' in Swiss German, indicating the time is twenty minutes before the next hour. |
Copilot
AI
Jul 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment '//Sandro 20' is unclear and doesn't explain the logic change. Consider adding a more descriptive comment explaining why the threshold was changed from 20 to 25 minutes.
| if(minutes >= 25) //Sandro 20 | |
| if(minutes >= 25) // Adjusted threshold from 20 to 25 minutes based on Sandro's suggestion to better align with Swiss German time conventions. |
Copilot
AI
Jul 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is commented-out code that should be removed if it's no longer needed, or uncommented if it serves a purpose. This reduces code clarity and maintainability.
| // //EIN(S) | |
| // if(minutes > 4){ // Sandro | |
| // message += "S"; | |
| // } | |
| // message += " "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment '//Sandro' doesn't provide meaningful information about the code. Consider removing it or replacing with a descriptive comment about the Swiss German terminology.