Commit 0721221d authored by Eric Duminil's avatar Eric Duminil
Browse files

co2_sensor: Removing INITIAL state.

parent 1ccab8b6
......@@ -30,14 +30,13 @@ namespace sensor {
/**
* Define sensor states
* INITIAL -> initial state
* BOOTUP -> state after initializing the sensor, i.e. after scd.begin()
* BOOTUP -> initial state, until first >0 ppm values are returned
* READY -> sensor does output valid information (> 0 ppm) and no other condition takes place
* NEEDS_CALIBRATION -> sensor measurements are too low (< 250 ppm)
* PREPARE_CALIBRATION -> forced calibration was initiated, waiting for stable measurements
* PREPARE_CALIBRATION_UNSTABLE -> forced calibration was initiated, last measurements were too far apart
* PREPARE_CALIBRATION_STABLE -> forced calibration was initiated, last measurements were close to each others
*/
enum state {
INITIAL,
BOOTUP,
READY,
NEEDS_CALIBRATION,
......@@ -45,13 +44,13 @@ namespace sensor {
PREPARE_CALIBRATION_STABLE
};
const char *state_names[] = {
"INITIAL",
"BOOTUP",
"READY",
"NEEDS_CALIBRATION",
"PREPARE_CALIBRATION_UNSTABLE",
"PREPARE_CALIBRATION_STABLE" };
state current_state = INITIAL;
state current_state = BOOTUP;
void switchState(state);
void initialize() {
......@@ -82,7 +81,6 @@ namespace sensor {
// of the ESP the SCD30 sometimes needs a long time until switching back to 2 s
// for acclimatization. Resetting it after startup seems to fix this behaviour.
scd30.reset();
switchState(BOOTUP);
Serial.print(F("Setting temperature offset to -"));
Serial.print(abs(config::temperature_offset));
......
Markdown is supported
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