From c7e5026eb9e05c3ce8765c0fd533c97b5998146c Mon Sep 17 00:00:00 2001 From: Eric Duminil <eric.duminil@gmail.com> Date: Sat, 5 Jun 2021 22:46:41 +0200 Subject: [PATCH] Comment: Do not reset after calibration! --- ampel-firmware/co2_sensor.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp index e2eb1a2..261e5a3 100644 --- a/ampel-firmware/co2_sensor.cpp +++ b/ampel-firmware/co2_sensor.cpp @@ -158,12 +158,14 @@ namespace sensor { switchState(PREPARE_CALIBRATION_UNSTABLE); } - void calibrateAndRestart() { + void calibrate() { Serial.print(F("Calibrating SCD30 now...")); scd30.setAltitudeCompensation(config::altitude_above_sea_level); scd30.setForcedRecalibrationFactor(config::co2_calibration_level); Serial.println(F(" Done!")); Serial.println(F("Sensor calibrated.")); + //WARNING: Do not reset the ampel or the SCD30! + //At least one measurement needs to happen in order for the calibration to be correctly applied. } void logToSerial() { @@ -209,7 +211,7 @@ namespace sensor { // leave them before calibration is done. bool ready_for_calibration = countStableMeasurements(); if (ready_for_calibration) { - calibrateAndRestart(); + calibrate(); } } else if (co2 < 250) { // Sensor should be calibrated. @@ -325,7 +327,7 @@ namespace sensor { config::co2_calibration_level = calibrationLevel; Serial.print(config::co2_calibration_level); Serial.println(F(" ppm.")); - calibrateAndRestart(); + calibrate(); } } -- GitLab