diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp index 414b45de090fd32c82fd5ee3c92cc47fb90a2e56..3b2e3c2df57e8f3a9ea6952a74bffc2e8922c614 100644 --- a/ampel-firmware/co2_sensor.cpp +++ b/ampel-firmware/co2_sensor.cpp @@ -33,6 +33,7 @@ namespace sensor { * INITIAL -> initial state * BOOTUP -> state after initializing the sensor, i.e. after scd.begin() * READY -> sensor does output valid information (> 0 ppm) and no other condition takes place + * INVALID -> sensor does output invalid CO2 measurements (== 0 ppm) * NEEDS_CALIBRATION -> sensor measurements are too low (< 250 ppm) * PREPARE_CALIBRATION -> forced calibration was initiated, waiting for stable measurements * CALIBRATION -> the sensor does calibrate itself @@ -41,6 +42,7 @@ namespace sensor { INITIAL, BOOTUP, READY, + INVALID, NEEDS_CALIBRATION, PREPARE_CALIBRATION_UNSTABLE, PREPARE_CALIBRATION_STABLE, @@ -50,6 +52,7 @@ namespace sensor { "INITIAL", "BOOTUP", "READY", + "INVALID", "NEEDS_CALIBRATION", "PREPARE_CALIBRATION_UNSTABLE", "PREPARE_CALIBRATION_STABLE", @@ -210,7 +213,7 @@ namespace sensor { // NOTE: Data is available, but it's sometimes erroneous: the sensor outputs // zero ppm but non-zero temperature and non-zero humidity. Serial.println(F("Invalid sensor data - CO2 concentration supposedly 0 ppm")); - switchState(BOOTUP); + switchState(INVALID); } else if ((current_state == PREPARE_CALIBRATION_UNSTABLE) || (current_state == PREPARE_CALIBRATION_STABLE)) { // Check for pre-calibration states first, because we do not want to // leave them before calibration is done. @@ -249,6 +252,9 @@ namespace sensor { case READY: displayCO2OnLedRing(); break; + case INVALID: + led_effects::showWaitingLED(color::red); + break; case NEEDS_CALIBRATION: led_effects::showWaitingLED(color::magenta); break;