Skip to content

Commit

Permalink
Update: Remember password for each SSID.
Browse files Browse the repository at this point in the history
  • Loading branch information
lovyan03 committed Sep 8, 2019
1 parent 9f97e1e commit 7bbd4b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions LovyanLauncher/LovyanLauncher.ino
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void drawFrame() {
M5.Lcd.setTextFont(0);
M5.Lcd.setTextColor(0x8410,0);
M5.Lcd.drawString("- LovyanLauncher -", 207, 191, 1);
M5.Lcd.drawString("@lovyan03 v0.2.0", 204, 201, 1);
M5.Lcd.drawString("@lovyan03 v0.2.1", 204, 201, 1);
M5.Lcd.drawString("http://git.io/fhdJV", 204, 211, 1);
}

Expand Down Expand Up @@ -119,7 +119,8 @@ void callBackWiFiClient(MenuItem* sender)
Preferences preferences;
preferences.begin("wifi-config");
preferences.putString("WIFI_SSID", mi->ssid);
String wifi_passwd = preferences.getString("WIFI_PASSWD");
String wifi_passwd = preferences.getString(mi->ssid.c_str());
if (wifi_passwd == "") wifi_passwd = preferences.getString("WIFI_PASSWD");

WiFi.disconnect();
WiFi.mode(WIFI_MODE_STA);
Expand All @@ -130,6 +131,7 @@ void callBackWiFiClient(MenuItem* sender)
osk.close();
WiFi.begin(mi->ssid.c_str(), wifi_passwd.c_str());
preferences.putString("WIFI_PASSWD", wifi_passwd);
preferences.putString(mi->ssid.c_str(), wifi_passwd);
} else {
WiFi.begin(mi->ssid.c_str(), "");
preferences.putString("WIFI_PASSWD", "");
Expand Down
Binary file modified LovyanLauncher/build/LovyanLauncher.bin
Binary file not shown.

0 comments on commit 7bbd4b9

Please sign in to comment.