Update: Post to Airgradient on WiFiConnector content

This commit is contained in:
Phat Nguyen
2024-04-12 12:08:02 +07:00
parent 9a1e0f4cdd
commit 2ccddf0e19

View File

@ -63,14 +63,15 @@ bool WifiConnector::connect(void) {
#endif #endif
WIFI()->setConfigPortalTimeout(WIFI_CONNECT_COUNTDOWN_MAX); WIFI()->setConfigPortalTimeout(WIFI_CONNECT_COUNTDOWN_MAX);
WiFiManagerParameter postToAg("chbPostToAg", "Post To AirGradient", "T", 2, WiFiManagerParameter postToAg("chbPostToAg",
"type=\"checkbox\" checked", WFM_LABEL_AFTER); "Prevent Connection to AirGradient Server", "T",
2, "type=\"checkbox\" ", WFM_LABEL_AFTER);
WIFI()->addParameter(&postToAg); WIFI()->addParameter(&postToAg);
WiFiManagerParameter postToAgInfo( WiFiManagerParameter postToAgInfo(
"<p>Connect to AirGradient Cloud. Important: Only disable if you are " "<p>Prevent connection to the AirGradient Server. Important: Only enable "
"sure you don't want to use any AirGradient cloud features. Your data " "it if you are sure you don't want to use any AirGradient cloud "
"will not be available for the AirGradient map and no automatic updates " "features. As a result you will not receive automatic firmware updates "
"will be received). </p>"); "and your data will not reach the AirGradient dashboard.</p>");
WIFI()->addParameter(&postToAgInfo); WIFI()->addParameter(&postToAgInfo);
WIFI()->autoConnect(ssid.c_str(), WIFI_HOTSPOT_PASSWORD_DEFAULT); WIFI()->autoConnect(ssid.c_str(), WIFI_HOTSPOT_PASSWORD_DEFAULT);
@ -149,7 +150,7 @@ bool WifiConnector::connect(void) {
String result = String(postToAg.getValue()); String result = String(postToAg.getValue());
logInfo("Post to AirGradient Configure: " + result); logInfo("Post to AirGradient Configure: " + result);
config.setPostToAirGradient(result == "T"); config.setPostToAirGradient(result != "T");
} }
#else #else
_wifiProcess(); _wifiProcess();