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
ea4f090d
Commit
ea4f090d
authored
Apr 24, 2021
by
Eric Duminil
Browse files
co2_sensor: 'instability', but 'unstable'
parent
f0ade083
Changes
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/co2_sensor.cpp
View file @
ea4f090d
...
...
@@ -41,7 +41,7 @@ namespace sensor {
BOOTUP
,
READY
,
NEEDS_CALIBRATION
,
PREPARE_CALIBRATION_
I
NSTABLE
,
PREPARE_CALIBRATION_
U
NSTABLE
,
PREPARE_CALIBRATION_STABLE
,
CALIBRATION
};
...
...
@@ -50,7 +50,7 @@ namespace sensor {
"BOOTUP"
,
"READY"
,
"NEEDS_CALIBRATION"
,
"PREPARE_CALIBRATION_
I
NSTABLE"
,
"PREPARE_CALIBRATION_
U
NSTABLE"
,
"PREPARE_CALIBRATION_STABLE"
,
"CALIBRATION"
};
state
current_state
=
INITIAL
;
...
...
@@ -133,7 +133,7 @@ namespace sensor {
switchState
(
PREPARE_CALIBRATION_STABLE
);
}
else
{
stable_measurements
=
0
;
switchState
(
PREPARE_CALIBRATION_
I
NSTABLE
);
switchState
(
PREPARE_CALIBRATION_
U
NSTABLE
);
}
previous_co2
=
co2
;
return
(
stable_measurements
==
config
::
enough_stable_measurements
);
...
...
@@ -148,7 +148,7 @@ 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."
));
switchState
(
PREPARE_CALIBRATION_
I
NSTABLE
);
switchState
(
PREPARE_CALIBRATION_
U
NSTABLE
);
}
void
calibrateAndRestart
()
{
...
...
@@ -210,7 +210,7 @@ namespace sensor {
case
NEEDS_CALIBRATION
:
led_effects
::
showWaitingLED
(
color
::
magenta
);
break
;
case
PREPARE_CALIBRATION_
I
NSTABLE
:
case
PREPARE_CALIBRATION_
U
NSTABLE
:
led_effects
::
showWaitingLED
(
color
::
red
);
break
;
case
PREPARE_CALIBRATION_STABLE
:
...
...
@@ -243,7 +243,7 @@ namespace sensor {
// zero ppm but non-zero temperature and non-zero humidity.
Serial
.
println
(
F
(
"Invalid sensor data - CO2 concentration <= 0 ppm"
));
switchState
(
BOOTUP
);
}
else
if
((
current_state
==
PREPARE_CALIBRATION_
I
NSTABLE
)
||
(
current_state
==
PREPARE_CALIBRATION_STABLE
))
{
}
else
if
((
current_state
==
PREPARE_CALIBRATION_
U
NSTABLE
)
||
(
current_state
==
PREPARE_CALIBRATION_STABLE
))
{
// Check for pre-calibration states first, because we do not want to
// leave them before calibration is done.
bool
ready_for_calibration
=
countStableMeasurements
();
...
...
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