diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp index 6e0e01eb6102ccd60586a618fd38d73f726fa213..6fcf2f86863bbf6a726b90fa56aa1f7a1ab4e36b 100644 --- a/ampel-firmware/co2_sensor.cpp +++ b/ampel-firmware/co2_sensor.cpp @@ -30,21 +30,6 @@ namespace sensor { char timestamp[23]; int16_t stable_measurements = 0; - /** - * Define sensor states - * 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_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 { - BOOTUP, - READY, - NEEDS_CALIBRATION, - PREPARE_CALIBRATION_UNSTABLE, - PREPARE_CALIBRATION_STABLE - }; const char *state_names[] = { "BOOTUP", "READY", diff --git a/ampel-firmware/co2_sensor.h b/ampel-firmware/co2_sensor.h index d9eff8724f018e885f260060aaed58678c814092..eb2612ddefc5898c29c89062a5de812dab43bc6e 100644 --- a/ampel-firmware/co2_sensor.h +++ b/ampel-firmware/co2_sensor.h @@ -24,6 +24,24 @@ namespace sensor { extern float humidity; extern char timestamp[]; + /** + * Define sensor states + * 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_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 { + BOOTUP, + READY, + NEEDS_CALIBRATION, + PREPARE_CALIBRATION_UNSTABLE, + PREPARE_CALIBRATION_STABLE + }; + + extern state current_state; + void initialize(); bool processData(); void startCalibrationProcess();