diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp index 3abe0aa794c51b2ea1be1f02528358575414c1d4..823c21e6a65f9cf4dad343a2ddab8643643e27ec 100644 --- a/ampel-firmware/co2_sensor.cpp +++ b/ampel-firmware/co2_sensor.cpp @@ -8,7 +8,7 @@ namespace config { uint16_t co2_calibration_level = ATMOSPHERIC_CO2_CONCENTRATION; // [ppm] int8_t max_deviation_during_calibration = 30; // [ppm] int8_t enough_stable_measurements = 60; - const uint8_t max_deviation_during_accl = 20; // [%] + const uint8_t max_deviation_during_bootup = 20; // [%] #ifdef TEMPERATURE_OFFSET // Residual heat from CO2 sensor seems to be high enough to change the temperature reading. How much should it be offset? // NOTE: Sign isn't relevant. The returned temperature will always be shifted down. @@ -135,7 +135,7 @@ namespace sensor { last_co2 = co2; // We assume the sensor has acclimated to the environment if measurements // change less than a specified percentage of the current value. - return (co2 > 0 && (100 * delta / config::max_deviation_during_accl) < co2); + return (co2 > 0 && delta < ((uint32_t)co2 * config::max_deviation_during_bootup / 100)); } bool countStableMeasurements() {