[Fix] WiFi reset failed and crash in offline mode

This commit is contained in:
Phat Nguyen
2024-06-25 16:08:57 +07:00
parent bccadd17d7
commit beb17de7dc

View File

@ -338,7 +338,16 @@ bool WifiConnector::isConnected(void) { return WiFi.isConnected(); }
* this method
*
*/
void WifiConnector::reset(void) { WIFI()->resetSettings(); }
void WifiConnector::reset(void) {
if(this->wifi == NULL) {
this->wifi = new WiFiManager();
if(this->wifi == NULL){
logInfo("reset failed");
return;
}
}
WIFI()->resetSettings();
}
/**
* @brief Get wifi RSSI