From a757d693e70804bf64b248c5d314ae1e1199b964 Mon Sep 17 00:00:00 2001 From: Eiswolf-BG <37225519+Eiswolf-BG@users.noreply.github.com> Date: Tue, 11 Aug 2026 01:18:14 +0200 Subject: [PATCH] Add example-name hint to the preset-name keyboard The preset-name keypad (used both when adding a preset via manual coordinates and after an address search) only showed "Name (optional):" with no indication of what kind of name was expected. Adds a localized hint line with example names (e.g. "Home, Work, Holiday home") under the title in both runPresetNameKeypad() (location_presets_screen.cpp) and runNameKeypad() (address_search_screen.cpp), measuring the header height dynamically via getCursorY() the same way runAddressKeyboard() already does, so the input field and keyboard shift down to make room regardless of translation length. Co-Authored-By: Claude Sonnet 5 --- src/address_search_screen.cpp | 22 ++++++++++++++++++---- src/i18n.h | 7 +++++++ src/i18n_de.h | 2 ++ src/i18n_en.h | 2 ++ src/i18n_es.h | 2 ++ src/i18n_fr.h | 2 ++ src/i18n_it.h | 2 ++ src/i18n_tr.h | 2 ++ src/location_presets_screen.cpp | 28 +++++++++++++++++++++------- 9 files changed, 58 insertions(+), 11 deletions(-) diff --git a/src/address_search_screen.cpp b/src/address_search_screen.cpp index e6c5d90..3e01808 100644 --- a/src/address_search_screen.cpp +++ b/src/address_search_screen.cpp @@ -296,7 +296,19 @@ namespace { constexpr int16_t KEY_H = 30; constexpr int16_t KEY_GAP = 3; - constexpr int16_t ROW0_Y = 78; + constexpr int16_t FIELD_H = 34; + + // Kopfbereich (Titel + Namens-Hinweis) einmal zeichnen, um seine + // tatsaechliche Hoehe per getCursorY() zu messen - selbes Muster wie + // in runAddressKeyboard() oben. + tft.fillScreen(TFT_BLACK); + tft.setTextColor(TFT_GREEN, TFT_BLACK); + tft.setCursor(10, 14); + tft.println(I18n::t(StringId::LOCATION_NAME_PROMPT)); + tft.setTextColor(TFT_CYAN, TFT_BLACK); + tft.println(I18n::t(StringId::LOCATION_NAME_HINT)); + int16_t fieldY = (int16_t)(tft.getCursorY() + 4); + int16_t ROW0_Y = (int16_t)(fieldY + FIELD_H + 8); auto layoutRow = [&](const char* row, int16_t y, Rect* outRects, uint8_t n) { int16_t usableW = Config::SCREEN_WIDTH - 8; @@ -326,12 +338,14 @@ namespace { tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setCursor(10, 14); tft.println(I18n::t(StringId::LOCATION_NAME_PROMPT)); + tft.setTextColor(TFT_CYAN, TFT_BLACK); + tft.println(I18n::t(StringId::LOCATION_NAME_HINT)); - tft.fillRect(8, 40, Config::SCREEN_WIDTH - 16, 34, TFT_BLACK); - tft.drawRect(8, 40, Config::SCREEN_WIDTH - 16, 34, TFT_GREEN); + tft.fillRect(8, fieldY, Config::SCREEN_WIDTH - 16, FIELD_H, TFT_BLACK); + tft.drawRect(8, fieldY, Config::SCREEN_WIDTH - 16, FIELD_H, TFT_GREEN); tft.setTextSize(2); tft.setTextColor(TFT_GREEN, TFT_BLACK); - tft.setCursor(14, 66); + tft.setCursor(14, (int16_t)(fieldY + 26)); tft.print(buf); tft.setTextSize(1); diff --git a/src/i18n.h b/src/i18n.h index 8ab4b70..0695873 100644 --- a/src/i18n.h +++ b/src/i18n.h @@ -268,6 +268,13 @@ enum class StringId : uint8_t { FIRST_RUN_COMPLETE_BODY1, FIRST_RUN_COMPLETE_BODY2, + // Hinweis mit Beispielnamen unter dem Titel der Namens-Tastatur + // (location_presets_screen.cpp::runPresetNameKeypad UND + // address_search_screen.cpp::runNameKeypad, beide spiegeln sich) - + // ohne jeden Hinweis wussten Einsteiger nicht, was fuer ein Name hier + // gemeint ist (Preset-Name wie "Zuhause", nicht z.B. ein Ort/Adresse). + LOCATION_NAME_HINT, + COUNT }; diff --git a/src/i18n_de.h b/src/i18n_de.h index da336fa..9616bd3 100644 --- a/src/i18n_de.h +++ b/src/i18n_de.h @@ -227,6 +227,8 @@ static const char* const I18N_DE[] = { "Einrichtung abgeschlossen", "Der Einrichtungsprozess ist jetzt abgeschlossen. Alle Daten wurden auf der SD-Karte im Ordner ", " abgespeichert. Ab dem nächsten Start verbindet sich das WLAN automatisch.", + + "z.B. Zuhause, Arbeit, Ferienhaus", }; static_assert(sizeof(I18N_DE) / sizeof(I18N_DE[0]) == (size_t)StringId::COUNT, diff --git a/src/i18n_en.h b/src/i18n_en.h index 6a1987c..bbd06fd 100644 --- a/src/i18n_en.h +++ b/src/i18n_en.h @@ -228,6 +228,8 @@ static const char* const I18N_EN[] = { "Setup Complete", "The setup process is now complete. All data has been saved to the SD card in the folder ", ". From the next boot, WiFi will connect automatically.", + + "e.g. Home, Work, Holiday home", }; static_assert(sizeof(I18N_EN) / sizeof(I18N_EN[0]) == (size_t)StringId::COUNT, diff --git a/src/i18n_es.h b/src/i18n_es.h index 573cc39..ad9f436 100644 --- a/src/i18n_es.h +++ b/src/i18n_es.h @@ -227,6 +227,8 @@ static const char* const I18N_ES[] = { "Configuración completada", "El proceso de configuración ya ha finalizado. Todos los datos se han guardado en la tarjeta SD, en la carpeta ", ". A partir del próximo inicio, el WiFi se conectará automáticamente.", + + "ej. Casa, Trabajo, Casa de vacaciones", }; static_assert(sizeof(I18N_ES) / sizeof(I18N_ES[0]) == (size_t)StringId::COUNT, diff --git a/src/i18n_fr.h b/src/i18n_fr.h index 9673d64..96fa2e4 100644 --- a/src/i18n_fr.h +++ b/src/i18n_fr.h @@ -227,6 +227,8 @@ static const char* const I18N_FR[] = { "Configuration terminée", "Le processus de configuration est maintenant terminé. Toutes les données ont été enregistrées sur la carte SD dans le dossier ", ". À partir du prochain démarrage, le WiFi se connectera automatiquement.", + + "ex. Maison, Travail, Maison de vacances", }; static_assert(sizeof(I18N_FR) / sizeof(I18N_FR[0]) == (size_t)StringId::COUNT, diff --git a/src/i18n_it.h b/src/i18n_it.h index f514dd3..3074e3f 100644 --- a/src/i18n_it.h +++ b/src/i18n_it.h @@ -227,6 +227,8 @@ static const char* const I18N_IT[] = { "Configurazione completata", "Il processo di configurazione è ora completato. Tutti i dati sono stati salvati sulla scheda SD nella cartella ", ". Dal prossimo avvio, il WiFi si connetterà automaticamente.", + + "es. Casa, Lavoro, Casa vacanze", }; static_assert(sizeof(I18N_IT) / sizeof(I18N_IT[0]) == (size_t)StringId::COUNT, diff --git a/src/i18n_tr.h b/src/i18n_tr.h index 7a834b2..bade050 100644 --- a/src/i18n_tr.h +++ b/src/i18n_tr.h @@ -227,6 +227,8 @@ static const char* const I18N_TR[] = { "Kurulum Tamamlandı", "Kurulum işlemi artık tamamlandı. Tüm veriler SD karttaki şu klasöre kaydedildi: ", ". Bir sonraki başlatmadan itibaren WiFi otomatik olarak bağlanacak.", + + "örn. Ev, İş, Tatil evi", }; static_assert(sizeof(I18N_TR) / sizeof(I18N_TR[0]) == (size_t)StringId::COUNT, diff --git a/src/location_presets_screen.cpp b/src/location_presets_screen.cpp index b0c3441..d741d50 100644 --- a/src/location_presets_screen.cpp +++ b/src/location_presets_screen.cpp @@ -132,7 +132,19 @@ namespace { constexpr int16_t KEY_H = 30; constexpr int16_t KEY_GAP = 3; - constexpr int16_t ROW0_Y = 78; + constexpr int16_t FIELD_H = 34; + + // Kopfbereich (Titel + Namens-Hinweis) einmal zeichnen, um seine + // tatsaechliche Hoehe per getCursorY() zu messen - selbes Muster wie + // in address_search_screen.cpp::runAddressKeyboard(). + tft.fillScreen(TFT_BLACK); + tft.setTextColor(TFT_GREEN, TFT_BLACK); + tft.setCursor(10, 14); + tft.println(I18n::t(StringId::LOCATION_NAME_PROMPT)); + tft.setTextColor(TFT_CYAN, TFT_BLACK); + tft.println(I18n::t(StringId::LOCATION_NAME_HINT)); + int16_t fieldY = (int16_t)(tft.getCursorY() + 4); + int16_t ROW0_Y = (int16_t)(fieldY + FIELD_H + 8); auto layoutRow = [&](const char* row, int16_t y, Rect* outRects, uint8_t n) { int16_t usableW = Config::SCREEN_WIDTH - 8; @@ -146,9 +158,9 @@ namespace { Rect digitRects[10], row1Rects[10], row2Rects[9], row3Rects[7]; layoutRow(DIGITS, ROW0_Y, digitRects, 10); - layoutRow(ROW1, ROW0_Y + (KEY_H + KEY_GAP), row1Rects, 10); - layoutRow(ROW2, ROW0_Y + 2 * (KEY_H + KEY_GAP), row2Rects, 9); - layoutRow(ROW3, ROW0_Y + 3 * (KEY_H + KEY_GAP), row3Rects, 7); + layoutRow(ROW1, (int16_t)(ROW0_Y + (KEY_H + KEY_GAP)), row1Rects, 10); + layoutRow(ROW2, (int16_t)(ROW0_Y + 2 * (KEY_H + KEY_GAP)), row2Rects, 9); + layoutRow(ROW3, (int16_t)(ROW0_Y + 3 * (KEY_H + KEY_GAP)), row3Rects, 7); Rect spaceBtn = {4, (int16_t)(ROW0_Y + 4 * (KEY_H + KEY_GAP)), 150, KEY_H}; Rect backspaceBtn = {158, (int16_t)(ROW0_Y + 4 * (KEY_H + KEY_GAP)), (int16_t)(Config::SCREEN_WIDTH - 8 - 154), KEY_H}; @@ -163,12 +175,14 @@ namespace { tft.setTextColor(TFT_GREEN, TFT_BLACK); tft.setCursor(10, 14); tft.println(I18n::t(StringId::LOCATION_NAME_PROMPT)); + tft.setTextColor(TFT_CYAN, TFT_BLACK); + tft.println(I18n::t(StringId::LOCATION_NAME_HINT)); - tft.fillRect(8, 40, Config::SCREEN_WIDTH - 16, 34, TFT_BLACK); - tft.drawRect(8, 40, Config::SCREEN_WIDTH - 16, 34, TFT_GREEN); + tft.fillRect(8, fieldY, Config::SCREEN_WIDTH - 16, FIELD_H, TFT_BLACK); + tft.drawRect(8, fieldY, Config::SCREEN_WIDTH - 16, FIELD_H, TFT_GREEN); tft.setTextSize(2); tft.setTextColor(TFT_GREEN, TFT_BLACK); - tft.setCursor(14, 66); + tft.setCursor(14, (int16_t)(fieldY + 26)); tft.print(buf); tft.setTextSize(1);