Skip to content

Commit

Permalink
Update WiFiSetting.ino
Browse files Browse the repository at this point in the history
SSID and PASSWD would be printed correctly if both are under 13 characters, but they wouldn’t be printed correctly if both exceed 14 characters. So I fixed this problem with this commit.
  • Loading branch information
sssscccc210 authored Sep 19, 2024
1 parent ede1d33 commit 0f66fbe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/Advanced/WIFI/WiFiSetting/WiFiSetting.ino
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ restoreConfig() { /* Check whether there is wifi configuration information
wifi_password = preferences.getString("WIFI_PASSWD");
M5.Lcd.printf(
"WIFI-SSID: %s\n",
wifi_ssid); // Screen print format string. 屏幕打印格式化字符串
M5.Lcd.printf("WIFI-PASSWD: %s\n", wifi_password);
wifi_ssid.c_str()); // Screen print format string. 屏幕打印格式化字符串
M5.Lcd.printf("WIFI-PASSWD: %s\n", wifi_password.c_str());
WiFi.begin(wifi_ssid.c_str(), wifi_password.c_str());

if (wifi_ssid.length() > 0) {
Expand Down Expand Up @@ -130,9 +130,9 @@ void startWebServer() { // Open the web service. 打开Web服务
});
webServer.on("/setap", []() {
String ssid = urlDecode(webServer.arg("ssid"));
M5.Lcd.printf("SSID: %s\n", ssid);
M5.Lcd.printf("SSID: %s\n", ssid.c_str());
String pass = urlDecode(webServer.arg("pass"));
M5.Lcd.printf("Password: %s\n\nWriting SSID to EEPROM...\n", pass);
M5.Lcd.printf("Password: %s\n\nWriting SSID to EEPROM...\n", pass.c_str());

// Store wifi config. 存储wifi配置信息
M5.Lcd.println("Writing Password to nvr...");
Expand Down Expand Up @@ -248,4 +248,4 @@ String urlDecode(String input) {
s.replace("%5F", "-");
s.replace("%60", "`");
return s;
}
}

0 comments on commit 0f66fbe

Please sign in to comment.