Set offline mode incase wifi is not configuraion or configuration ignored.

This commit is contained in:
Phat Nguyen
2024-05-13 15:07:10 +07:00
parent 5b18a8353d
commit f23c7e9e31
3 changed files with 19 additions and 0 deletions

View File

@ -238,6 +238,11 @@ void setup() {
}
}
}
/** Set offline mode without saving, cause wifi is not configured */
if (wifiConnector.hasConfigurated() == false) {
Serial.println("Set offline mode cause wifi is not configurated");
configuration.setOfflineModeWithoutSave(true);
}
/** Show display Warning up */
if (ag->isOne()) {

View File

@ -345,3 +345,16 @@ int WifiConnector::RSSI(void) { return WiFi.RSSI(); }
* @return String
*/
String WifiConnector::localIpStr(void) { return WiFi.localIP().toString(); }
/**
* @brief Get status that wifi has configurated
*
* @return true Configurated
* @return false Not Configurated
*/
bool WifiConnector::hasConfigurated(void) {
if (WiFi.SSID().isEmpty()) {
return false;
}
return true;
}

View File

@ -50,6 +50,7 @@ public:
void reset(void);
int RSSI(void);
String localIpStr(void);
bool hasConfigurated(void);
};
#endif /** _AG_WIFI_CONNECTOR_H_ */