From 6c15896fdb010e301b9fd65407af7fce22f83d9f Mon Sep 17 00:00:00 2001 From: Chad Date: Tue, 31 Mar 2026 14:54:43 -0500 Subject: [PATCH] Add show/hide password toggle button (EYE) on password entry screen --- src/main.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 042b84a..f0980f0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -190,6 +190,7 @@ String wifiPassword = ""; bool keyboardShift = false; bool keyboardCaps = false; bool keyboardSymbols = false; +bool showPasswordPlain = false; String formatPriceUS(double price, int decimals = 2, bool includeDollar = true) { if (price <= 0) return "..."; @@ -882,19 +883,29 @@ void drawWifiPasswordScreen() { lcd.setTextDatum(textdatum_t::middle_left); lcd.drawString("Network: " + selectedSSID, 50, 70); - lcd.fillSmoothRoundRect(50, 100, SCREEN_WIDTH - 100, 50, 8, TFT_DARKGRAY); + lcd.fillSmoothRoundRect(50, 100, SCREEN_WIDTH - 160, 50, 8, TFT_DARKGRAY); lcd.setTextColor(TFT_WHITE, TFT_DARKGRAY); lcd.setFont(&fonts::DejaVu18); lcd.setTextDatum(textdatum_t::middle_left); String displayPwd = ""; - for (int i = 0; i < keyboardPos; i++) displayPwd += "*"; + if (showPasswordPlain) { + displayPwd = String(keyboardBuffer); + } else { + for (int i = 0; i < keyboardPos; i++) displayPwd += "*"; + } if (keyboardPos == 0) { lcd.setTextColor(TFT_GRAY, TFT_DARKGRAY); displayPwd = "_"; } lcd.drawString(displayPwd, 70, 125); + lcd.fillSmoothRoundRect(SCREEN_WIDTH - 100, 100, 50, 50, 8, showPasswordPlain ? TFT_ORANGE : TFT_GRAY); + lcd.setTextColor(TFT_WHITE, showPasswordPlain ? TFT_ORANGE : TFT_GRAY); + lcd.setFont(&fonts::DejaVu12); + lcd.setTextDatum(textdatum_t::middle_center); + lcd.drawString("EYE", SCREEN_WIDTH - 75, 125); + drawFullKeyboard(170, keyboardSymbols); lcd.fillSmoothRoundRect(50, SCREEN_HEIGHT - 50, 150, 40, 8, TFT_GRAY); @@ -1062,6 +1073,11 @@ bool handleWifiPasswordTouch(int32_t x, int32_t y) { return true; } + if (x >= SCREEN_WIDTH - 100 && x < SCREEN_WIDTH - 50 && y >= 100 && y < 150) { + showPasswordPlain = !showPasswordPlain; + return true; + } + const char* letterRows[] = { "QWERTYUIOP", "ASDFGHJKL", @@ -1276,6 +1292,7 @@ bool handleDashboardTouch(int32_t x, int32_t y) { keyboardCaps = false; keyboardShift = false; keyboardSymbols = false; + showPasswordPlain = false; scanWifiNetworks(); return true; }