Commit 1440e361 authored by Käppler's avatar Käppler
Browse files

co2_sensor: Start calibration process by state

This removes the superfluous bool `should_calibrate`.
parent 295800aa
......@@ -48,8 +48,6 @@ namespace sensor {
state current_state = INITIAL;
void switchState(state);
bool should_calibrate = false;
void initialize() {
#if defined(ESP8266)
Wire.begin(12, 14); // ESP8266 - D6, D5;
......@@ -140,7 +138,6 @@ namespace sensor {
scd30.setMeasurementInterval(2); // [s] The change will only take effect after next measurement.
Serial.println(F("Waiting until the measurements are stable for at least 2 minutes."));
Serial.println(F("It could take a very long time."));
should_calibrate = true;
switchState(PREPARECALIBRATION);
}
......@@ -223,7 +220,7 @@ namespace sensor {
} else if (co2 < 250) {
// Sensor should be calibrated.
switchState(NEEDSCALIBRATION);
} else if (should_calibrate) {
} else if (current_state == PREPARECALIBRATION) {
countStableMeasurements();
if (stable_measurements == config::enough_stable_measurements) {
calibrateAndRestart();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment