mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-05 12:16:31 +02:00
fix postDataToAirGradient
set false
after device power up and connected to WiFi
This commit is contained in:
@ -46,6 +46,7 @@ bool WifiConnector::connect(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WIFI()->setConfigPortalBlocking(false);
|
WIFI()->setConfigPortalBlocking(false);
|
||||||
|
WIFI()->setConnectTimeout(15);
|
||||||
WIFI()->setTimeout(WIFI_CONNECT_COUNTDOWN_MAX);
|
WIFI()->setTimeout(WIFI_CONNECT_COUNTDOWN_MAX);
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
@ -148,9 +149,15 @@ bool WifiConnector::connect(void) {
|
|||||||
hasConfig = true;
|
hasConfig = true;
|
||||||
logInfo("WiFi Connected: " + WiFi.SSID() + " IP: " + localIpStr());
|
logInfo("WiFi Connected: " + WiFi.SSID() + " IP: " + localIpStr());
|
||||||
|
|
||||||
String result = String(postToAg.getValue());
|
if (hasPortalConfig) {
|
||||||
logInfo("Post to AirGradient Configure: " + result);
|
String result = String(postToAg.getValue());
|
||||||
config.setPostToAirGradient(result != "T");
|
logInfo("Setting postToAirGradient set from " +
|
||||||
|
String(config.isPostDataToAirGradient() ? "True" : "False") +
|
||||||
|
String(" to ") + String(result != "T" ? "True" : "False") +
|
||||||
|
String(" successful"));
|
||||||
|
config.setPostToAirGradient(result != "T");
|
||||||
|
}
|
||||||
|
hasPortalConfig = false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
_wifiProcess();
|
_wifiProcess();
|
||||||
@ -226,6 +233,7 @@ void WifiConnector::_wifiSaveParamCallback(void) {
|
|||||||
sm.ledAnimationInit();
|
sm.ledAnimationInit();
|
||||||
sm.handleLeds(AgStateMachineWiFiManagerStaConnecting);
|
sm.handleLeds(AgStateMachineWiFiManagerStaConnecting);
|
||||||
sm.setDisplayState(AgStateMachineWiFiManagerStaConnecting);
|
sm.setDisplayState(AgStateMachineWiFiManagerStaConnecting);
|
||||||
|
hasPortalConfig = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,6 +23,7 @@ private:
|
|||||||
void *wifi = NULL;
|
void *wifi = NULL;
|
||||||
bool hasConfig;
|
bool hasConfig;
|
||||||
uint32_t lastRetry;
|
uint32_t lastRetry;
|
||||||
|
bool hasPortalConfig = false;
|
||||||
|
|
||||||
bool wifiClientConnected(void);
|
bool wifiClientConnected(void);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user