-
Notifications
You must be signed in to change notification settings - Fork 126
Fully disable cloud connection to airgradient server option #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
c5c0dae
32c78f6
1537d5d
c8f0e6a
f0c4df4
3e48a56
0e41b2d
84a3582
b75e40b
e851d07
afd4980
29d7017
bd9dbec
0e26aa1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,9 +149,12 @@ void setup() { | |
initMqtt(); | ||
sendDataToAg(); | ||
|
||
apiClient.fetchServerConfiguration(); | ||
if (configuration.getConfigurationControl() != | ||
ConfigurationControl::ConfigurationControlLocal) { | ||
apiClient.fetchServerConfiguration(); | ||
} | ||
configSchedule.update(); | ||
if (apiClient.isFetchConfigureFailed()) { | ||
if (apiClient.isFetchConfigurationFailed()) { | ||
if (apiClient.isNotAvailableOnDashboard()) { | ||
stateMachine.displaySetAddToDashBoard(); | ||
stateMachine.displayHandle( | ||
|
@@ -415,6 +418,14 @@ static void failedHandler(String msg) { | |
} | ||
|
||
static void configurationUpdateSchedule(void) { | ||
if (configuration.isOfflineMode() || | ||
configuration.getConfigurationControl() == ConfigurationControl::ConfigurationControlLocal) { | ||
Serial.println("Ignore fetch server configuration. Either mode is offline " | ||
"or configurationControl set to local"); | ||
apiClient.resetFetchConfigurationStatus(); | ||
return; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignore vs reset There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Relate to this comment #278 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Too much redundancy code added to only log the exact mode. I think it's enough. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The method should start with a verb. e.g. |
||
|
||
if (apiClient.fetchServerConfiguration()) { | ||
configUpdateHandle(); | ||
} | ||
|
@@ -472,7 +483,7 @@ static void appDispHandler(void) { | |
if (configuration.isOfflineMode() == false) { | ||
if (wifiConnector.isConnected() == false) { | ||
state = AgStateMachineWiFiLost; | ||
} else if (apiClient.isFetchConfigureFailed()) { | ||
} else if (apiClient.isFetchConfigurationFailed()) { | ||
state = AgStateMachineSensorConfigFailed; | ||
if (apiClient.isNotAvailableOnDashboard()) { | ||
stateMachine.displaySetAddToDashBoard(); | ||
|
@@ -521,17 +532,21 @@ static void sendDataToServer(void) { | |
int bootCount = measurements.bootCount() + 1; | ||
measurements.setBootCount(bootCount); | ||
|
||
/** Ignore send data to server if postToAirGradient disabled */ | ||
if (configuration.isPostDataToAirGradient() == false || | ||
configuration.isOfflineMode()) { | ||
if (configuration.isOfflineMode() || !configuration.isPostDataToAirGradient()) { | ||
Serial.println("Ignore send data to server. Either mode is offline " | ||
samuelbles07 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skipping transmission of data to AG server. ? |
||
"or post data to server disabled"); | ||
return; | ||
} | ||
|
||
if (wifiConnector.isConnected() == false) { | ||
Serial.println("WiFi not connected, skip post data to server"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .. skipping data transmission to AG server |
||
return; | ||
} | ||
|
||
String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(), ag, configuration); | ||
if (apiClient.postToServer(syncData)) { | ||
Serial.println(); | ||
Serial.println( | ||
"Online mode and isPostToAirGradient = true: watchdog reset"); | ||
Serial.println("Online mode and isPostToAirGradient = true"); | ||
Serial.println(); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Propose to make full sentences
The device ... on the display ....