mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-28 16:07:16 +02:00
Merge branch 'develop' into feat/disable-cloud
This commit is contained in:
@ -229,15 +229,16 @@ void setup() {
|
|||||||
oledDisplay.setBrightness(configuration.getDisplayBrightness());
|
oledDisplay.setBrightness(configuration.getDisplayBrightness());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update display and led bar after finishing setup to show dashboard
|
// Reset post schedulers to make sure measurements value already available
|
||||||
updateDisplayAndLedBar();
|
agApiPostSchedule.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
/** Handle schedule */
|
/** Run schedulers */
|
||||||
dispLedSchedule.run();
|
dispLedSchedule.run();
|
||||||
configSchedule.run();
|
configSchedule.run();
|
||||||
agApiPostSchedule.run();
|
agApiPostSchedule.run();
|
||||||
|
watchdogFeedSchedule.run();
|
||||||
|
|
||||||
if (configuration.hasSensorS8) {
|
if (configuration.hasSensorS8) {
|
||||||
co2Schedule.run();
|
co2Schedule.run();
|
||||||
@ -271,15 +272,13 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
watchdogFeedSchedule.run();
|
|
||||||
|
|
||||||
/** Check for handle WiFi reconnect */
|
/** Check for handle WiFi reconnect */
|
||||||
wifiConnector.handle();
|
wifiConnector.handle();
|
||||||
|
|
||||||
/** factory reset handle */
|
/** factory reset handle */
|
||||||
factoryConfigReset();
|
factoryConfigReset();
|
||||||
|
|
||||||
/** check that local configura changed then do some action */
|
/** check that local configuration changed then do some action */
|
||||||
configUpdateHandle();
|
configUpdateHandle();
|
||||||
|
|
||||||
/** Firmware check for update handle */
|
/** Firmware check for update handle */
|
||||||
|
@ -47,7 +47,8 @@ bool AgApiClient::fetchServerConfiguration(void) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
HTTPClient client;
|
HTTPClient client;
|
||||||
client.setTimeout(timeoutMs);
|
client.setConnectTimeout(timeoutMs); // Set timeout when establishing connection to server
|
||||||
|
client.setTimeout(timeoutMs); // Timeout when waiting for response from AG server
|
||||||
if (apiRootChanged) {
|
if (apiRootChanged) {
|
||||||
// If apiRoot is changed, assume not using https
|
// If apiRoot is changed, assume not using https
|
||||||
if (client.begin(uri) == false) {
|
if (client.begin(uri) == false) {
|
||||||
@ -113,7 +114,8 @@ bool AgApiClient::postToServer(String data) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
HTTPClient client;
|
HTTPClient client;
|
||||||
client.setTimeout(timeoutMs);
|
client.setConnectTimeout(timeoutMs); // Set timeout when establishing connection to server
|
||||||
|
client.setTimeout(timeoutMs); // Timeout when waiting for response from AG server
|
||||||
if (apiRootChanged) {
|
if (apiRootChanged) {
|
||||||
// If apiRoot is changed, assume not using https
|
// If apiRoot is changed, assume not using https
|
||||||
if (client.begin(uri) == false) {
|
if (client.begin(uri) == false) {
|
||||||
|
@ -31,7 +31,7 @@ private:
|
|||||||
bool getConfigFailed;
|
bool getConfigFailed;
|
||||||
bool postToServerFailed;
|
bool postToServerFailed;
|
||||||
bool notAvailableOnDashboard = false; // Device not setup on Airgradient cloud dashboard.
|
bool notAvailableOnDashboard = false; // Device not setup on Airgradient cloud dashboard.
|
||||||
uint16_t timeoutMs = 10000; // Default set to 10s
|
uint16_t timeoutMs = 15000; // Default set to 15s
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AgApiClient(Stream &stream, Configuration &config);
|
AgApiClient(Stream &stream, Configuration &config);
|
||||||
|
@ -31,6 +31,45 @@ Measurements::Measurements() {
|
|||||||
#ifndef ESP8266
|
#ifndef ESP8266
|
||||||
_resetReason = (int)ESP_RST_UNKNOWN;
|
_resetReason = (int)ESP_RST_UNKNOWN;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Set invalid value for each measurements as default value when initialized*/
|
||||||
|
_temperature[0].update.avg = utils::getInvalidTemperature();
|
||||||
|
_temperature[1].update.avg = utils::getInvalidTemperature();
|
||||||
|
_humidity[0].update.avg = utils::getInvalidHumidity();
|
||||||
|
_humidity[1].update.avg = utils::getInvalidHumidity();
|
||||||
|
_co2.update.avg = utils::getInvalidCO2();
|
||||||
|
_tvoc.update.avg = utils::getInvalidVOC();
|
||||||
|
_tvoc_raw.update.avg = utils::getInvalidVOC();
|
||||||
|
_nox.update.avg = utils::getInvalidNOx();
|
||||||
|
_nox_raw.update.avg = utils::getInvalidNOx();
|
||||||
|
|
||||||
|
_pm_03_pc[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_03_pc[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_05_pc[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_05_pc[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_5_pc[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_5_pc[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
|
||||||
|
_pm_01[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_01_sp[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_01_pc[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_01[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_01_sp[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_01_pc[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
|
||||||
|
_pm_25[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_25_sp[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_25_pc[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_25[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_25_sp[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_25_pc[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
|
||||||
|
_pm_10[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_10_sp[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_10_pc[0].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_10[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_10_sp[1].update.avg = utils::getInvalidPmValue();
|
||||||
|
_pm_10_pc[1].update.avg = utils::getInvalidPmValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Measurements::maxPeriod(MeasurementType type, int max) {
|
void Measurements::maxPeriod(MeasurementType type, int max) {
|
||||||
|
Reference in New Issue
Block a user