Skip to content

Fix incorrect TVOC / NOx values when network option is cellular #303

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

Merged
merged 4 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions examples/OneOpenAir/OneOpenAir.ino
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ void otaHandlerCallback(AirgradientOTA::OtaResult result, const char *msg) {
Serial.println("Firmware update starting...");
if (configuration.hasSensorSGP && networkOption == UseCellular) {
// Temporary pause SGP41 task while cellular firmware update is in progress
ag->sgp41.pauseHandle();
ag->sgp41.pause();
}
displayExecuteOta(result, fwNewVersion, 0);
break;
Expand All @@ -594,13 +594,15 @@ void otaHandlerCallback(AirgradientOTA::OtaResult result, const char *msg) {
displayExecuteOta(result, "", std::stoi(msg));
break;
case AirgradientOTA::Failed:
displayExecuteOta(result, "", 0);
if (configuration.hasSensorSGP && networkOption == UseCellular) {
// Cellular firmware update finish, resuming SGP41 task
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it failed (and hasn't finished). We don't need the comment I would say.

ag->sgp41.resume();
}
break;
case AirgradientOTA::Skipped:
case AirgradientOTA::AlreadyUpToDate:
displayExecuteOta(result, "", 0);
if (configuration.hasSensorSGP && networkOption == UseCellular) {
// Cellular firmware update finish, resuming SGP41 task
ag->sgp41.resumeHandle();
}
break;
case AirgradientOTA::Success:
displayExecuteOta(result, "", 0);
Expand Down
2 changes: 1 addition & 1 deletion src/Libraries/airgradient-ota
6 changes: 3 additions & 3 deletions src/Sgp41/Sgp41.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void Sgp41::handle(void) {

#else

void Sgp41::pauseHandle() {
void Sgp41::pause() {
onPause = true;
Serial.println("Pausing SGP41 handler task");
// Set latest value to invalid
Expand All @@ -142,9 +142,9 @@ void Sgp41::pauseHandle() {
nox = utils::getInvalidNOx();
}

void Sgp41::resumeHandle() {
void Sgp41::resume() {
onPause = false;
Serial.println("Resume SGP41 handler task");
Serial.println("Resuming SGP41 handler task");
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Sgp41/Sgp41.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class Sgp41 {
void handle(void);
#else
/* pause _handle task to read sensor */
void pauseHandle();
void pause();
/* resume _handle task to read sensor */
void resumeHandle();
void resume();
void _handle(void);
#endif
void end(void);
Expand Down