From 737aef167be5fe414ae30d6449979a70ff7fe4e8 Mon Sep 17 00:00:00 2001 From: fvanroie Date: Sat, 7 Mar 2020 00:48:59 +0100 Subject: [PATCH] AP setup improvement --- src/hasp_wifi.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hasp_wifi.cpp b/src/hasp_wifi.cpp index 9e4f1b51..cc00fb94 100644 --- a/src/hasp_wifi.cpp +++ b/src/hasp_wifi.cpp @@ -135,20 +135,21 @@ void wifiSetup(JsonObject settings) if(strlen(wifiSsid) == 0) { String apSsdid = F("HASP-"); apSsdid += wifiGetMacAddress(3, ""); + snprintf_P(buffer, sizeof(buffer), PSTR("haspadmin")); WiFi.mode(WIFI_AP); - WiFi.softAP(apSsdid.c_str(), "haspadmin"); - IPAddress IP = WiFi.softAPIP(); + WiFi.softAP(apSsdid.c_str(), buffer); + haspDisplayAP(apSsdid.c_str(), buffer); /* Setup the DNS server redirecting all the domains to the apIP */ // dnsServer.setErrorReplyCode(DNSReplyCode::NoError); // dnsServer.start(DNS_PORT, "*", apIP); - sprintf_P(buffer, PSTR("WIFI: Setting up temporary Access Point: %s"), apSsdid.c_str()); + IPAddress IP = WiFi.softAPIP(); + sprintf_P(buffer, PSTR("WIFI: Temporary Access Point %s password: %s"), apSsdid.c_str(), PSTR("haspadmin")); debugPrintln(buffer); sprintf_P(buffer, PSTR("WIFI: AP IP address : %s"), IP.toString().c_str()); debugPrintln(buffer); - haspDisplayAP(apSsdid.c_str(), "haspadmin"); httpReconnect(); } else { @@ -225,7 +226,8 @@ bool wifiSetConfig(const JsonObject & settings) strncpy(wifiSsid, settings[FPSTR(F_CONFIG_SSID)], sizeof(wifiSsid)); } - if(!settings[FPSTR(F_CONFIG_PASS)].isNull()) { + if(!settings[FPSTR(F_CONFIG_PASS)].isNull() && + settings[FPSTR(F_CONFIG_PASS)].as() != String(FPSTR("********"))) { changed |= strcmp(wifiPassword, settings[FPSTR(F_CONFIG_PASS)]) != 0; strncpy(wifiPassword, settings[FPSTR(F_CONFIG_PASS)], sizeof(wifiPassword)); }