diff --git a/README.md b/README.md index 81b71ca..3d2c6d4 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,13 @@ Thanks to these great people for supporting this project. Fab!an + + + rozza-m +
+ Rozza-m +
+ hermannbach @@ -62,21 +69,6 @@ Thanks to these great people for supporting this project.
Hamster65
- - - - pplucky -
- pplucky -
- - - - - rozza-m -
- Rozza-m -
diff --git a/src/PixelIt.ino b/src/PixelIt.ino index 087245f..9ea0eb6 100644 --- a/src/PixelIt.ino +++ b/src/PixelIt.ino @@ -232,6 +232,7 @@ uint8_t clockColorR = 255, clockColorG = 255, clockColorB = 255; uint clockAutoFallbackTime = 30; bool forceClock = false; bool clockBlinkAnimated = true; +bool clockFatFont = false; // Scrolltext Vars bool scrollTextAktivLoop = false; @@ -328,6 +329,7 @@ void SaveConfig() json["clockDateDayMonth"] = clockDateDayMonth; json["clockDayOfWeekFirstMonday"] = clockDayOfWeekFirstMonday; json["clockBlinkAnimated"] = clockBlinkAnimated; + json["clockFatFont"] = clockFatFont; json["scrollTextDefaultDelay"] = scrollTextDefaultDelay; json["bootScreenAktiv"] = bootScreenAktiv; json["mqttAktiv"] = mqttAktiv; @@ -552,6 +554,11 @@ void SetConfigVariables(JsonObject &json) clockDayOfWeekFirstMonday = json["clockDayOfWeekFirstMonday"].as(); } + if (json.containsKey("clockFatFont")) + { + clockFatFont = json["clockFatFont"].as(); + } + if (json.containsKey("scrollTextDefaultDelay")) { scrollTextDefaultDelay = json["scrollTextDefaultDelay"].as(); @@ -1222,6 +1229,11 @@ void CreateFrames(JsonObject &json) clockWithSeconds = json["clock"]["withSeconds"]; clockBlinkAnimated = json["clock"]["blinkAnimated"]; + if (json["clock"]["fatFont"]) + { + clockFatFont = json["clock"]["fatFont"]; + } + if (json["clock"]["color"]["r"].as() != NULL) { clockColorR = json["clock"]["color"]["r"].as(); @@ -1650,29 +1662,31 @@ String GetButtons() ///////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// -void DrawText(String text, bool bigFont, int colorRed, int colorGreen, int colorBlue, int posX, int posY) +void DrawText(String text, int bigFont, int colorRed, int colorGreen, int colorBlue, int posX, int posY) { DrawTextHelper(text, bigFont, false, false, false, false, false, NULL, colorRed, colorGreen, colorBlue, posX, posY); } -void DrawTextCenter(String text, bool bigFont, bool withBMP, int colorRed, int colorGreen, int colorBlue) +void DrawTextCenter(String text, int bigFont, bool withBMP, int colorRed, int colorGreen, int colorBlue) { DrawTextHelper(text, bigFont, true, false, false, withBMP, false, NULL, colorRed, colorGreen, colorBlue, 0, 1); } -void DrawTextScrolled(String text, bool bigFont, bool withBMP, bool fadeInRequired, uint16_t bmpArray[64], int colorRed, int colorGreen, int colorBlue) +void DrawTextScrolled(String text, int bigFont, bool withBMP, bool fadeInRequired, uint16_t bmpArray[64], int colorRed, int colorGreen, int colorBlue) { DrawTextHelper(text, bigFont, false, true, false, withBMP, fadeInRequired, bmpArray, colorRed, colorGreen, colorBlue, 0, 1); } -void DrawAutoTextScrolled(String text, bool bigFont, bool withBMP, bool fadeInRequired, uint16_t bmpArray[64], int colorRed, int colorGreen, int colorBlue) +void DrawAutoTextScrolled(String text, int bigFont, bool withBMP, bool fadeInRequired, uint16_t bmpArray[64], int colorRed, int colorGreen, int colorBlue) { DrawTextHelper(text, bigFont, false, false, true, withBMP, fadeInRequired, bmpArray, colorRed, colorGreen, colorBlue, 0, 1); } -void DrawTextHelper(String text, bool bigFont, bool centerText, bool scrollText, bool autoScrollText, bool withBMP, bool fadeInRequired, uint16_t bmpArray[64], int colorRed, int colorGreen, int colorBlue, int posX, int posY) +void DrawTextHelper(String text, int bigFont, bool centerText, bool scrollText, bool autoScrollText, bool withBMP, bool fadeInRequired, uint16_t bmpArray[64], int colorRed, int colorGreen, int colorBlue, int posX, int posY) { uint16_t xPixelText, xPixel; + int16_t boundsx1, boundsy1; + uint16_t boundsw, boundsh; text = Utf8ToAscii(text); @@ -1688,7 +1702,7 @@ void DrawTextHelper(String text, bool bigFont, bool centerText, bool scrollText, xPixel = 32; } - if (bigFont) + if (bigFont == 1) { // Grosse Schrift setzten matrix->setFont(); @@ -1696,6 +1710,17 @@ void DrawTextHelper(String text, bool bigFont, bool centerText, bool scrollText, // Positions Korrektur posY = posY - 1; } + else if (bigFont == 2) // very large font, only to be used for time display / sehr große Schrift, nür für die Zeitanzeige + { + // Sehr grosse Schrift setzten + matrix->setFont(&FatPixels); + + matrix->getTextBounds(text, 0, 0, &boundsx1, &boundsy1, &boundsw, &boundsh); + xPixelText = boundsw; + + // Positions Korrektur + posY = posY + 6; + } else { // Kleine Schrift setzten @@ -1930,7 +1955,7 @@ void DrawClock(bool fromJSON) sprintf_P(date, PSTR("%02d/%02d"), month(), day()); } - if (clock24Hours && clockWithSeconds) + if (clock24Hours && clockWithSeconds && !clockFatFont) { xPosTime = 2; sprintf_P(time, PSTR("%02d:%02d:%02d"), hour(), minute(), second()); @@ -1942,12 +1967,26 @@ void DrawClock(bool fromJSON) if (clockBlink && clockBlinkAnimated) { clockBlink = false; - sprintf_P(time, PSTR("%2d %02d %s"), hourFormat12(), minute(), isAM() ? "AM" : "PM"); + if (!clockFatFont) + { + sprintf_P(time, PSTR("%2d %02d %s"), hourFormat12(), minute(), isAM() ? "AM" : "PM"); + } + else + { + sprintf_P(time, PSTR("%2d %02d"), hourFormat12(), minute()); + } } else { clockBlink = !clockBlink; - sprintf_P(time, PSTR("%2d:%02d %s"), hourFormat12(), minute(), isAM() ? "AM" : "PM"); + if (!clockFatFont) + { + sprintf_P(time, PSTR("%2d:%02d %s"), hourFormat12(), minute(), isAM() ? "AM" : "PM"); + } + else + { + sprintf_P(time, PSTR("%2d:%02d"), hourFormat12(), minute()); + } } } else @@ -1977,22 +2016,39 @@ void DrawClock(bool fromJSON) { clockCounterDate = 0; - int counter = 0; - while (counter <= 6) + if (clockFatFont) // fade rather than vertical animate purely because DrawTextCenter doesnt have a Y argument... { - counter++; + DrawTextCenter(String(time), 2, false, clockColorR, clockColorG, clockColorB); + FadeOut(30); matrix->clear(); - DrawText(String(time), false, clockColorR, clockColorG, clockColorB, xPosTime, (1 + counter)); - DrawText(String(date), false, clockColorR, clockColorG, clockColorB, 7, (-6 + counter)); - matrix->drawLine(0, 7, 33, 7, 0); - DrawWeekDay(); - matrix->show(); - delay(35); + DrawTextCenter(String(date), 2, false, clockColorR, clockColorG, clockColorB); + FadeIn(30); + } + else + { + int counter = 0; + while (counter <= 6) // vertical animate + { + counter++; + matrix->clear(); + DrawText(String(time), false, clockColorR, clockColorG, clockColorB, xPosTime, (1 + counter)); + DrawText(String(date), false, clockColorR, clockColorG, clockColorB, 7, (-6 + counter)); + matrix->drawLine(0, 7, 33, 7, 0); + DrawWeekDay(); + matrix->show(); + delay(35); + } } } + else if (clockFatFont) + { + + DrawTextCenter(String(time), 2, false, clockColorR, clockColorG, clockColorB); + } else { DrawText(String(time), false, clockColorR, clockColorG, clockColorB, xPosTime, 1); + xPosTime = 3; } } else @@ -2003,26 +2059,44 @@ void DrawClock(bool fromJSON) { clockCounterClock = 0; - int counter = 0; - while (counter <= 6) + if (clockFatFont) // fade rather than vertical animate purely because DrawTextCenter doesnt have a Y argument... { - counter++; + DrawTextCenter(String(date), 2, false, clockColorR, clockColorG, clockColorB); + FadeOut(30); matrix->clear(); - DrawText(String(date), false, clockColorR, clockColorG, clockColorB, 7, (1 + counter)); - DrawText(String(time), false, clockColorR, clockColorG, clockColorB, xPosTime, (-6 + counter)); - matrix->drawLine(0, 7, 33, 7, 0); - DrawWeekDay(); - matrix->show(); - delay(35); + DrawTextCenter(String(time), 2, false, clockColorR, clockColorG, clockColorB); + FadeIn(30); + } + else + { + int counter = 0; + while (counter <= 6) // vertical animate + { + counter++; + matrix->clear(); + DrawText(String(date), false, clockColorR, clockColorG, clockColorB, 7, (1 + counter)); + DrawText(String(time), false, clockColorR, clockColorG, clockColorB, xPosTime, (-6 + counter)); + matrix->drawLine(0, 7, 33, 7, 0); + DrawWeekDay(); + matrix->show(); + delay(35); + } } } + else if (clockFatFont) + { + DrawTextCenter(String(date), 2, false, clockColorR, clockColorG, clockColorB); + } else { DrawText(String(date), false, clockColorR, clockColorG, clockColorB, 7, 1); } } - DrawWeekDay(); + if (!clockFatFont) + { + DrawWeekDay(); + } // Wenn der Aufruf nicht über JSON sondern über den Loop kommt // muss ich mich selbst ums Show kümmern. diff --git a/src/PixelItFont.h b/src/PixelItFont.h index a7ea713..bb38b43 100644 --- a/src/PixelItFont.h +++ b/src/PixelItFont.h @@ -473,3 +473,43 @@ const GFXglyph PixelItGlyphs[] PROGMEM = { }; const GFXfont PixelItFont PROGMEM = {(uint8_t *)PixelItBitmaps, (GFXglyph *)PixelItGlyphs, 0x20, 0xE8, 6}; + +const uint8_t FatPixels_Bitmaps[] PROGMEM = { + 0x00, 0x80, 0x77, 0xF7, 0xBD, 0xEF, 0xEE, 0x7F, 0xB6, 0xDB, 0x77, 0xF6, + 0x77, 0x73, 0xFF, 0x77, 0xF6, 0x73, 0xEF, 0xEE, 0x19, 0xDF, 0xBF, 0xFC, + 0x63, 0xFF, 0xF1, 0xEF, 0x8F, 0xEE, 0x77, 0xF1, 0xEF, 0xEF, 0xEE, 0xFF, + 0xC6, 0x31, 0x8C, 0x63, 0x77, 0xF6, 0xEF, 0xEF, 0xEE, 0x77, 0xF7, 0xF7, + 0x8F, 0xEE, 0x90 +}; + +const GFXglyph FatPixels_Glyphs[] PROGMEM = { + { 0, 1, 1, 2, 0, -5 }, // 0x20 ' ' + { 0, 0, 0, 0, 0, 0 }, // 0x21 '!' + { 0, 0, 0, 0, 0, 0 }, // 0x22 '"' + { 0, 0, 0, 0, 0, 0 }, // 0x23 '#' + { 0, 0, 0, 0, 0, 0 }, // 0x24 '$' + { 0, 0, 0, 0, 0, 0 }, // 0x25 '%' + { 0, 0, 0, 0, 0, 0 }, // 0x26 '&' + { 0, 0, 0, 0, 0, 0 }, // 0x27 ''' + { 0, 0, 0, 0, 0, 0 }, // 0x28 '(' + { 0, 0, 0, 0, 0, 0 }, // 0x29 ')' + { 0, 0, 0, 0, 0, 0 }, // 0x2A '*' + { 0, 0, 0, 0, 0, 0 }, // 0x2B '+' + { 0, 0, 0, 0, 0, 0 }, // 0x2C ',' + { 0, 0, 0, 0, 0, 0 }, // 0x2D '-' + { 1, 1, 1, 2, 0, 0 }, // 0x2E '.' + { 0, 0, 0, 0, 0, 0 }, // 0x2F '/' + { 2, 5, 8, 6, 0, -7 }, // 0x30 '0' + { 7, 3, 8, 4, 0, -7 }, // 0x31 '1' + { 10, 5, 8, 6, 0, -7 }, // 0x32 '2' + { 15, 5, 8, 6, 0, -7 }, // 0x33 '3' + { 20, 5, 8, 6, 0, -7 }, // 0x34 '4' + { 25, 5, 8, 6, 0, -7 }, // 0x35 '5' + { 30, 5, 8, 6, 0, -7 }, // 0x36 '6' + { 35, 5, 8, 6, 0, -7 }, // 0x37 '7' + { 40, 5, 8, 6, 0, -7 }, // 0x38 '8' + { 45, 5, 8, 6, 0, -7 }, // 0x39 '9' + { 50, 1, 4, 2, 0, -5 } // 0x3A ':' +}; + +const GFXfont FatPixels PROGMEM = {(uint8_t *) FatPixels_Bitmaps, (GFXglyph *)FatPixels_Glyphs, 0x20, 0x3A, 8}; diff --git a/webui/src/views/Options.vue b/webui/src/views/Options.vue index 41edd90..f7eb5ca 100644 --- a/webui/src/views/Options.vue +++ b/webui/src/views/Options.vue @@ -67,7 +67,8 @@ - + +