Skip to content
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

Timeout handling #192

Open
airgradienthq opened this issue Jul 1, 2024 · 5 comments
Open

Timeout handling #192

airgradienthq opened this issue Jul 1, 2024 · 5 comments

Comments

@airgradienthq
Copy link
Owner

@pnt325 How does the current firmware handle a time out after a post request to the AirGradient server? Do you show any error message / LED? If so immediately or after a number of fails?

@pnt325
Copy link
Contributor

pnt325 commented Jul 8, 2024

@airgradienthq Currently there are no indicate if post failed.

@airgradienthq
Copy link
Owner Author

We have irregular cases where the monitor is showing an error but it recovers very quickly. How often do you retry the request before showing an error?

@pnt325
Copy link
Contributor

pnt325 commented Jul 11, 2024

@airgradienthq The sensor S8 and PMS5003 has check number of failed times to set sensor failed(invalid value). The server post failed without any count before show status on display, it's update as the display update period 2500ms.

Could you please details what is the error?

@airgradienthq
Copy link
Owner Author

@pnt325 I do not understand your comment. Please rephrase or use translation software.

@pnt325
Copy link
Contributor

pnt325 commented Aug 5, 2024

We have irregular cases where the monitor is showing an error but it recovers very quickly. How often do you retry the request before showing an error?

S8 and PMS5003/PMS5003T has check number of failed time before response the invalid value storage on Measurements. The value sync to cloud or screen is get from Measurements

S8 sensor

static void co2Update(void) {
int value = ag->s8.getCo2();
if (utils::isValidCO2(value)) {
measurements.CO2 = value;
getCO2FailCount = 0;
Serial.printf("CO2 (ppm): %d\r\n", measurements.CO2);
} else {
getCO2FailCount++;
Serial.printf("Get CO2 failed: %d\r\n", getCO2FailCount);
if (getCO2FailCount >= 3) {
measurements.CO2 = utils::getInvalidCO2();
}
}
}

PMS5003 sensor

if (ag->pms5003.isFailed() == false) {
measurements.pm01_1 = ag->pms5003.getPm01Ae();
measurements.pm25_1 = ag->pms5003.getPm25Ae();
measurements.pm10_1 = ag->pms5003.getPm10Ae();
measurements.pm03PCount_1 = ag->pms5003.getPm03ParticleCount();
Serial.println();
Serial.printf("PM1 ug/m3: %d\r\n", measurements.pm01_1);
Serial.printf("PM2.5 ug/m3: %d\r\n", measurements.pm25_1);
Serial.printf("PM10 ug/m3: %d\r\n", measurements.pm10_1);
Serial.printf("PM0.3 Count: %d\r\n", measurements.pm03PCount_1);
pmFailCount = 0;
} else {
pmFailCount++;
Serial.printf("PMS read failed: %d\r\n", pmFailCount);
if (pmFailCount >= 3) {
measurements.pm01_1 = utils::getInvalidPMS();
measurements.pm25_1 = utils::getInvalidPMS();
measurements.pm10_1 = utils::getInvalidPMS();
measurements.pm03PCount_1 = utils::getInvalidPMS();
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants