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