mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-18 03:02:10 +02:00
fix reboot device after WiFi portal configure timeout.
This commit is contained in:
@ -242,6 +242,7 @@ void setup() {
|
|||||||
ledBarEnabledUpdate();
|
ledBarEnabledUpdate();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (wifiConnector.isConfigurePorttalTimeout()) {
|
||||||
oledDisplay.showRebooting();
|
oledDisplay.showRebooting();
|
||||||
delay(2500);
|
delay(2500);
|
||||||
oledDisplay.setText("", "", "");
|
oledDisplay.setText("", "", "");
|
||||||
@ -249,6 +250,7 @@ void setup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/** Set offline mode without saving, cause wifi is not configured */
|
/** Set offline mode without saving, cause wifi is not configured */
|
||||||
if (wifiConnector.hasConfigurated() == false) {
|
if (wifiConnector.hasConfigurated() == false) {
|
||||||
Serial.println("Set offline mode cause wifi is not configurated");
|
Serial.println("Set offline mode cause wifi is not configurated");
|
||||||
|
@ -53,6 +53,7 @@ bool WifiConnector::connect(void) {
|
|||||||
WIFI()->setAPCallback([this](WiFiManager *obj) { _wifiApCallback(); });
|
WIFI()->setAPCallback([this](WiFiManager *obj) { _wifiApCallback(); });
|
||||||
WIFI()->setSaveConfigCallback([this]() { _wifiSaveConfig(); });
|
WIFI()->setSaveConfigCallback([this]() { _wifiSaveConfig(); });
|
||||||
WIFI()->setSaveParamsCallback([this]() { _wifiSaveParamCallback(); });
|
WIFI()->setSaveParamsCallback([this]() { _wifiSaveParamCallback(); });
|
||||||
|
WIFI()->setConfigPortalTimeoutCallback([this](){});
|
||||||
if (ag->isOne()) {
|
if (ag->isOne()) {
|
||||||
disp.setText("Connecting to", "WiFi", "...");
|
disp.setText("Connecting to", "WiFi", "...");
|
||||||
} else {
|
} else {
|
||||||
@ -245,6 +246,7 @@ void WifiConnector::_wifiSaveParamCallback(void) {
|
|||||||
bool WifiConnector::_wifiConfigPortalActive(void) {
|
bool WifiConnector::_wifiConfigPortalActive(void) {
|
||||||
return WIFI()->getConfigPortalActive();
|
return WIFI()->getConfigPortalActive();
|
||||||
}
|
}
|
||||||
|
void WifiConnector::_wifiTimeoutCallback(void) { connectorTimeout = true; }
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* @brief Process WiFiManager connection
|
* @brief Process WiFiManager connection
|
||||||
@ -352,3 +354,11 @@ bool WifiConnector::hasConfigurated(void) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get WiFi connection porttal timeout.
|
||||||
|
*
|
||||||
|
* @return true
|
||||||
|
* @return false
|
||||||
|
*/
|
||||||
|
bool WifiConnector::isConfigurePorttalTimeout(void) { return connectorTimeout; }
|
||||||
|
@ -24,6 +24,7 @@ private:
|
|||||||
bool hasConfig;
|
bool hasConfig;
|
||||||
uint32_t lastRetry;
|
uint32_t lastRetry;
|
||||||
bool hasPortalConfig = false;
|
bool hasPortalConfig = false;
|
||||||
|
bool connectorTimeout = false;
|
||||||
|
|
||||||
bool wifiClientConnected(void);
|
bool wifiClientConnected(void);
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ public:
|
|||||||
void _wifiSaveConfig(void);
|
void _wifiSaveConfig(void);
|
||||||
void _wifiSaveParamCallback(void);
|
void _wifiSaveParamCallback(void);
|
||||||
bool _wifiConfigPortalActive(void);
|
bool _wifiConfigPortalActive(void);
|
||||||
|
void _wifiTimeoutCallback(void);
|
||||||
#endif
|
#endif
|
||||||
void _wifiProcess();
|
void _wifiProcess();
|
||||||
bool isConnected(void);
|
bool isConnected(void);
|
||||||
@ -51,6 +53,7 @@ public:
|
|||||||
int RSSI(void);
|
int RSSI(void);
|
||||||
String localIpStr(void);
|
String localIpStr(void);
|
||||||
bool hasConfigurated(void);
|
bool hasConfigurated(void);
|
||||||
|
bool isConfigurePorttalTimeout(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /** _AG_WIFI_CONNECTOR_H_ */
|
#endif /** _AG_WIFI_CONNECTOR_H_ */
|
||||||
|
Reference in New Issue
Block a user