From 70b68e14c4aad3b1bcd3a7191a1306953ac9e484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20M=C3=BChl?= Date: Thu, 6 Apr 2023 14:52:27 +0200 Subject: [PATCH] update --- src/Apps.h | 18 +++++++++--------- src/DisplayManager.cpp | 2 +- src/Functions.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Apps.h b/src/Apps.h index afd3792..d89f965 100644 --- a/src/Apps.h +++ b/src/Apps.h @@ -250,7 +250,7 @@ void AlarmApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state) { matrix->fillScreen(matrix->Color(255, 0, 0)); CURRENT_APP = "Alarm"; - uint16_t textWidth = getTextWidth("ALARM", false); + uint16_t textWidth = getTextWidth("ALARM", 0); int16_t textX = ((32 - textWidth) / 2); matrix->setTextColor(0); matrix->setCursor(textX, 6); @@ -276,7 +276,7 @@ void TimerApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state) matrix->fillScreen(matrix->Color(0, 255, 0)); CURRENT_APP = "Timer"; String menuText = "TIMER"; - uint16_t textWidth = getTextWidth(menuText.c_str(), false); + uint16_t textWidth = getTextWidth(menuText.c_str(), 0); int16_t textX = ((32 - textWidth) / 2); matrix->setTextColor(0); matrix->setCursor(textX, 6); @@ -335,14 +335,14 @@ void ShowCustomApp(String name, FastLED_NeoMatrix *matrix, MatrixDisplayUiState bool hasIcon = ca->icon; uint16_t availableWidth = (hasIcon) ? 24 : 32; - bool noScrolling = getTextWidth(ca->text.c_str(), false) <= availableWidth; + bool noScrolling = getTextWidth(ca->text.c_str(), ca->textCase) <= availableWidth; if (ca->barSize > 0) { DisplayManager.drawBarChart(x, y, ca->barData, ca->barSize, hasIcon, ca->color); } else { - if ((ca->repeat > 0) && (getTextWidth(ca->text.c_str(), false) > availableWidth) && (state->appState == FIXED)) + if ((ca->repeat > 0) && (getTextWidth(ca->text.c_str(), ca->textCase) > availableWidth) && (state->appState == FIXED)) { DisplayManager.setAutoTransition(false); } @@ -351,9 +351,9 @@ void ShowCustomApp(String name, FastLED_NeoMatrix *matrix, MatrixDisplayUiState DisplayManager.setAutoTransition(true); } - if (getTextWidth(ca->text.c_str(), false) > availableWidth && !(state->appState == IN_TRANSITION)) + if (getTextWidth(ca->text.c_str(), ca->textCase) > availableWidth && !(state->appState == IN_TRANSITION)) { - if (ca->scrollposition <= -getTextWidth(ca->text.c_str(), false)) + if (ca->scrollposition <= -getTextWidth(ca->text.c_str(), ca->textCase)) { ca->scrollDelay = 0; ca->scrollposition = 9; @@ -401,7 +401,7 @@ void ShowCustomApp(String name, FastLED_NeoMatrix *matrix, MatrixDisplayUiState } } } - int16_t textX = (hasIcon) ? ((24 - getTextWidth(ca->text.c_str(), false)) / 2) + 9 : ((32 - getTextWidth(ca->text.c_str(), false)) / 2); + int16_t textX = (hasIcon) ? ((24 - getTextWidth(ca->text.c_str(), ca->textCase)) / 2) + 9 : ((32 - getTextWidth(ca->text.c_str(), ca->textCase)) / 2); matrix->setTextColor(ca->color); if (noScrolling) { @@ -511,7 +511,7 @@ void NotifyApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state) matrix->fillRect(0, 0, 32, 8, 0); // Calculate text and available width - uint16_t textWidth = getTextWidth(notify.text.c_str(), false); + uint16_t textWidth = getTextWidth(notify.text.c_str(), notify.textCase); uint16_t availableWidth = hasIcon ? 24 : 32; // Check if text is scrolling @@ -795,7 +795,7 @@ void WeatherApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state, int16_t DisplayManager.getInstance().resetTextColor(); matrix->drawRGBBitmap(x, y, getWeatherIcon(WEATHER_CODE), 8, 8); String text = WEATHER_TEMP + "°" + WEATHER_HUM + "%"; - uint16_t textWidth = getTextWidth(text.c_str(), false); + uint16_t textWidth = getTextWidth(text.c_str(), 0); int16_t textX = ((23 - textWidth) / 2); matrix->setCursor(textX + 11, 6 + y); matrix->print(utf8ascii(text)); diff --git a/src/DisplayManager.cpp b/src/DisplayManager.cpp index 9dcb818..ece512f 100644 --- a/src/DisplayManager.cpp +++ b/src/DisplayManager.cpp @@ -204,7 +204,7 @@ void DisplayManager_::HSVtext(int16_t x, int16_t y, const char *text, bool clear } char temp_str[2] = {'\0', '\0'}; temp_str[0] = text[i]; - xpos += getTextWidth(temp_str, false); + xpos += getTextWidth(temp_str, textCase); } hueOffset++; if (clear) diff --git a/src/Functions.h b/src/Functions.h index 2e451e0..d82df65 100644 --- a/src/Functions.h +++ b/src/Functions.h @@ -91,4 +91,4 @@ String utf8ascii(String s) } return r; } -#endif +#endif \ No newline at end of file