Skip to content

Commit cfcef46

Browse files
committed
Sensor selftest logic fix
In case no scd40 is connected the selftest will now return a 99 instead of an OK.
1 parent 3bc6e3f commit cfcef46

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

OpenCO2_Sensor.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ void initOnce() {
363363
scd4x.stopPeriodicMeasurement();
364364
// scd4x.performFactoryReset();
365365
// delay(100);
366-
scd4x.performSelfTest(sensorStatus);
366+
int16_t selfTest = scd4x.performSelfTest(sensorStatus);
367+
if (selfTest != 0 /*NO_ERROR*/) sensorStatus=99;
367368
}
368369

369370
preferences.begin("co2-sensor", true);
@@ -848,7 +849,7 @@ void loop() {
848849
goto_light_sleep(5000 - (millis() - lastMeasurementTimeMs));
849850
}
850851

851-
if (!(BatteryMode && lowEnergyMode)) {
852+
if (!(BatteryMode && lowEnergyMode) && !TEST_MODE) {
852853
bool isDataReady = false;
853854
uint16_t ready_error = scd4x.getDataReadyStatus(isDataReady);
854855
if (ready_error || !isDataReady) {

0 commit comments

Comments
 (0)