mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-13 14:51:21 +10:00
feature #533 failure details
This commit is contained in:
+31
-3
@@ -573,7 +573,17 @@ uint8_t WiFiManager::connectWifi(String ssid, String pass) {
|
||||
connRes = waitForConnectResult();
|
||||
}
|
||||
|
||||
_lastconxresult = connRes;
|
||||
if(connRes != WL_SCAN_COMPLETED){
|
||||
_lastconxresult = connRes;
|
||||
#ifdef ESP8266
|
||||
// hack in wrong password detection
|
||||
if(_lastconxresult == WL_CONNECT_FAILED){
|
||||
if(wifi_station_get_connect_status() == STATION_WRONG_PASSWORD){
|
||||
_lastconxresult = WL_STATION_WRONG_PASSWORD;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return connRes;
|
||||
}
|
||||
@@ -736,7 +746,6 @@ String WiFiManager::getScanItemOut(){
|
||||
// token precheck, to speed up replacements on large ap lists
|
||||
String HTTP_ITEM_STR = FPSTR(HTTP_ITEM);
|
||||
|
||||
|
||||
// toggle icons with percentage
|
||||
HTTP_ITEM_STR.replace("{qp}", FPSTR(HTTP_ITEM_QP));
|
||||
HTTP_ITEM_STR.replace("{h}",_scanDispOptions ? "" : "h");
|
||||
@@ -1344,6 +1353,25 @@ void WiFiManager::reportStatus(String &page){
|
||||
else {
|
||||
str = FPSTR(HTTP_STATUS_OFF);
|
||||
str.replace(FPSTR(T_v),WiFi_SSID());
|
||||
if(_lastconxresult == WL_STATION_WRONG_PASSWORD){
|
||||
// wrong password
|
||||
str.replace(FPSTR(T_c),"D"); // class
|
||||
str.replace(FPSTR(T_r),FPSTR(HTTP_STATUS_OFFPW));
|
||||
}
|
||||
else if(_lastconxresult == WL_NO_SSID_AVAIL){
|
||||
// connect failed, or ap not found
|
||||
str.replace(FPSTR(T_c),"D");
|
||||
str.replace(FPSTR(T_r),FPSTR(HTTP_STATUS_OFFNOAP));
|
||||
}
|
||||
else if(_lastconxresult == WL_CONNECT_FAILED){
|
||||
// connect failed
|
||||
str.replace(FPSTR(T_c),"D");
|
||||
str.replace(FPSTR(T_r),FPSTR(HTTP_STATUS_OFFFAIL));
|
||||
}
|
||||
else{
|
||||
str.replace(FPSTR(T_c),"");
|
||||
str.replace(FPSTR(T_r),"");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1791,7 +1819,7 @@ boolean WiFiManager::validApPassword(){
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
String WiFiManager::getWLStatusString(uint8_t status){
|
||||
if(status >=0 && status <=6) return WIFI_STA_STATUS[status];
|
||||
if(status >=0 && status <=7) return WIFI_STA_STATUS[status];
|
||||
return FPSTR(S_NA);
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -215,7 +215,10 @@ class WiFiManager
|
||||
WiFiMode_t _usermode = WIFI_OFF;
|
||||
String _wifissidprefix = FPSTR(S_ssidpre); // auto apname prefix prefix+chipid
|
||||
uint8_t _lastconxresult = WL_IDLE_STATUS;
|
||||
|
||||
|
||||
#ifndef WL_STATION_WRONG_PASSWORD
|
||||
uint8_t WL_STATION_WRONG_PASSWORD = 7;
|
||||
#endif
|
||||
|
||||
// option parameters
|
||||
int _minimumQuality = -1; // filter wifiscan ap by this rssi
|
||||
|
||||
+12
-8
@@ -43,7 +43,10 @@ const char HTTP_END[] PROGMEM = "</div></body></html>";
|
||||
const char HTTP_ERASEBTN[] PROGMEM = "<br/><form action='/erase' method='get'><button>Erase WiFi Config</button></form>";
|
||||
|
||||
const char HTTP_STATUS_ON[] PROGMEM = "<div class='msg P'><strong>Connected</strong> to {v}<br/><em><small>with IP {i}</small></em></div>";
|
||||
const char HTTP_STATUS_OFF[] PROGMEM = "<div class='msg'><strong>Not Connected</strong> to {v}</div>";
|
||||
const char HTTP_STATUS_OFF[] PROGMEM = "<div class='msg {c}'><strong>Not Connected</strong> to {v}{r}</div>";
|
||||
const char HTTP_STATUS_OFFPW[] PROGMEM = "<br/>Wrong Password";
|
||||
const char HTTP_STATUS_OFFNOAP[] PROGMEM = "<br/>AP not found";
|
||||
const char HTTP_STATUS_OFFFAIL[] PROGMEM = "<br/>Could not Connect";
|
||||
const char HTTP_STATUS_NONE[] PROGMEM = "<div class='msg'>No AP set</div>";
|
||||
const char HTTP_BR[] PROGMEM = "<br/>";
|
||||
|
||||
@@ -226,13 +229,14 @@ const char HTTP_HEAD_CT2[] PROGMEM = "text/plain";
|
||||
|
||||
const char * const WIFI_STA_STATUS[] PROGMEM
|
||||
{
|
||||
"WL_IDLE_STATUS", // STATION_IDLE
|
||||
"WL_NO_SSID_AVAIL", // STATION_NO_AP_FOUND
|
||||
"WL_SCAN_COMPLETED",
|
||||
"WL_CONNECTED", // STATION_GOT_IP
|
||||
"WL_CONNECT_FAILED",// STATION_CONNECT_FAIL, STATION_WRONG_PASSWORD(NI)
|
||||
"WL_CONNECTION_LOST",
|
||||
"WL_DISCONNECTED"
|
||||
"WL_IDLE_STATUS", // 0 STATION_IDLE
|
||||
"WL_NO_SSID_AVAIL", // 1 STATION_NO_AP_FOUND
|
||||
"WL_SCAN_COMPLETED", // 2
|
||||
"WL_CONNECTED", // 3 STATION_GOT_IP
|
||||
"WL_CONNECT_FAILED", // 4 STATION_CONNECT_FAIL, STATION_WRONG_PASSWORD(NI)
|
||||
"WL_CONNECTION_LOST", // 5
|
||||
"WL_DISCONNECTED", // 6
|
||||
"WL_STATION_WRONG_PASSWORD" // 7 KLUDGE
|
||||
};
|
||||
|
||||
#ifdef ESP32
|
||||
|
||||
Reference in New Issue
Block a user