Skip to content

Commit 7bbd4b9

Browse files
committed
Update: Remember password for each SSID.
1 parent 9f97e1e commit 7bbd4b9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

LovyanLauncher/LovyanLauncher.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void drawFrame() {
6161
M5.Lcd.setTextFont(0);
6262
M5.Lcd.setTextColor(0x8410,0);
6363
M5.Lcd.drawString("- LovyanLauncher -", 207, 191, 1);
64-
M5.Lcd.drawString("@lovyan03 v0.2.0", 204, 201, 1);
64+
M5.Lcd.drawString("@lovyan03 v0.2.1", 204, 201, 1);
6565
M5.Lcd.drawString("http://git.io/fhdJV", 204, 211, 1);
6666
}
6767

@@ -119,7 +119,8 @@ void callBackWiFiClient(MenuItem* sender)
119119
Preferences preferences;
120120
preferences.begin("wifi-config");
121121
preferences.putString("WIFI_SSID", mi->ssid);
122-
String wifi_passwd = preferences.getString("WIFI_PASSWD");
122+
String wifi_passwd = preferences.getString(mi->ssid.c_str());
123+
if (wifi_passwd == "") wifi_passwd = preferences.getString("WIFI_PASSWD");
123124

124125
WiFi.disconnect();
125126
WiFi.mode(WIFI_MODE_STA);
@@ -130,6 +131,7 @@ void callBackWiFiClient(MenuItem* sender)
130131
osk.close();
131132
WiFi.begin(mi->ssid.c_str(), wifi_passwd.c_str());
132133
preferences.putString("WIFI_PASSWD", wifi_passwd);
134+
preferences.putString(mi->ssid.c_str(), wifi_passwd);
133135
} else {
134136
WiFi.begin(mi->ssid.c_str(), "");
135137
preferences.putString("WIFI_PASSWD", "");
10 KB
Binary file not shown.

0 commit comments

Comments
 (0)