Simplify WiFi config screen with SSID and password fields, fix keyboard layout
This commit is contained in:
parent
60bbeaeeda
commit
db8986c077
1 changed files with 8 additions and 29 deletions
37
src/main.cpp
37
src/main.cpp
|
|
@ -599,44 +599,27 @@ void drawWifiConfigScreen() {
|
|||
lcd.setTextDatum(textdatum_t::middle_center);
|
||||
lcd.drawString("WIFI CONFIGURATION", SCREEN_WIDTH / 2, 25);
|
||||
|
||||
preferences.begin("wifi", true);
|
||||
String currentSsid = preferences.getString("ssid", "");
|
||||
preferences.end();
|
||||
|
||||
lcd.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
lcd.setFont(&fonts::DejaVu18);
|
||||
lcd.setTextDatum(textdatum_t::middle_left);
|
||||
lcd.drawString("Current SSID:", 100, 80);
|
||||
lcd.drawString("SSID:", 100, 70);
|
||||
|
||||
lcd.fillSmoothRoundRect(100, 100, 600, 40, 6, TFT_DARKGRAY);
|
||||
lcd.setTextColor(TFT_WHITE, TFT_DARKGRAY);
|
||||
lcd.setTextDatum(textdatum_t::middle_left);
|
||||
if (currentSsid.length() > 0) {
|
||||
lcd.drawString(currentSsid, 120, 120);
|
||||
} else {
|
||||
lcd.setTextColor(TFT_GRAY, TFT_DARKGRAY);
|
||||
lcd.drawString("(not configured)", 120, 120);
|
||||
}
|
||||
|
||||
lcd.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
lcd.drawString("New SSID:", 100, 170);
|
||||
|
||||
lcd.fillSmoothRoundRect(100, 190, 600, 40, 6, TFT_ORANGE);
|
||||
lcd.fillSmoothRoundRect(100, 90, 600, 40, 6, TFT_ORANGE);
|
||||
lcd.setTextColor(TFT_WHITE, TFT_ORANGE);
|
||||
lcd.setTextDatum(textdatum_t::middle_left);
|
||||
String ssidDisplay = String(keyboardBuffer);
|
||||
if (ssidDisplay.length() == 0) ssidDisplay = "_";
|
||||
lcd.drawString(ssidDisplay, 120, 210);
|
||||
lcd.drawString(ssidDisplay, 120, 110);
|
||||
|
||||
lcd.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
lcd.drawString("Password:", 100, 260);
|
||||
lcd.drawString("Password:", 100, 150);
|
||||
|
||||
lcd.fillSmoothRoundRect(100, 280, 600, 40, 6, TFT_DARKGRAY);
|
||||
lcd.fillSmoothRoundRect(100, 170, 600, 40, 6, TFT_DARKGRAY);
|
||||
lcd.setTextColor(TFT_GRAY, TFT_DARKGRAY);
|
||||
lcd.setTextDatum(textdatum_t::middle_left);
|
||||
lcd.drawString("(tap to enter)", 120, 300);
|
||||
lcd.drawString("(use same keyboard)", 120, 190);
|
||||
|
||||
drawKeyboard(350);
|
||||
drawKeyboard(230);
|
||||
|
||||
lcd.fillSmoothRoundRect(100, SCREEN_HEIGHT - 50, 150, 40, 8, TFT_GRAY);
|
||||
lcd.setTextColor(TFT_WHITE, TFT_GRAY);
|
||||
|
|
@ -844,11 +827,7 @@ bool handleWifiConfigTouch(int32_t x, int32_t y) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (x >= 100 && x < 700 && y >= 190 && y < 230) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int keyboardY = 350;
|
||||
int keyboardY = 230;
|
||||
if (handleKeyboardTouch(x, y, keyboardY)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue