Skip to content

Commit

Permalink
Bugfix: temperature offset on Wi-Fi and in Battery mode
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkreidler committed Jul 3, 2024
1 parent 73a3d1f commit 7882219
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions OpenCO2_Sensor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void loadCredentials() {
#endif /* MQTT */

float getTempOffset() {
if (useWiFi) return 13.0;
if (useWiFi) return 12.2;
else return 4.4;
}

Expand Down Expand Up @@ -774,7 +774,7 @@ void loop() {
bool isDataReady = false;
uint16_t ready_error = scd4x.getDataReadyFlag(isDataReady);
if (ready_error || !isDataReady) {
if (BatteryMode) goto_deep_sleep(DEEP_SLEEP_TIME);
if (BatteryMode && comingFromDeepSleep) goto_deep_sleep(DEEP_SLEEP_TIME);
else goto_light_sleep(LIGHT_SLEEP_TIME);
return; // otherwise continues running!
}
Expand Down
11 changes: 11 additions & 0 deletions epd_abstraction.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,17 @@ void displayinfo() {
Paint_DrawString_EN(1, 129, "USB_ACTIVE:", &Font16, WHITE, BLACK);
Paint_DrawString_EN(122, 129, USB_ACTIVE? "yes":"no", &Font16, WHITE, BLACK);

// only needed for debugging. This interrupts the SCD40
/*float tOffset;
scd4x.stopPeriodicMeasurement();
scd4x.getTemperatureOffset(tOffset);
if (BatteryMode) scd4x.startLowPowerPeriodicMeasurement();
else scd4x.startPeriodicMeasurement();
Paint_DrawString_EN(1, 145, "T_offset:", &Font16, WHITE, BLACK);
char offset[20];
sprintf(offset, "%.1f", tOffset);
Paint_DrawString_EN(122, 145, offset, &Font16, WHITE, BLACK);*/

updateDisplay();
}

Expand Down

0 comments on commit 7882219

Please sign in to comment.