Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
co2ampel
ampel-firmware
Commits
0721221d
Commit
0721221d
authored
Apr 30, 2021
by
Eric Duminil
Browse files
co2_sensor: Removing INITIAL state.
parent
1ccab8b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/co2_sensor.cpp
View file @
0721221d
...
...
@@ -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
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment