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
c7e5026e
Commit
c7e5026e
authored
Jun 05, 2021
by
Eric Duminil
Browse files
Comment: Do not reset after calibration!
parent
fbbb8e5d
Pipeline
#4020
passed with stage
in 1 minute and 52 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ampel-firmware/co2_sensor.cpp
View file @
c7e5026e
...
@@ -158,12 +158,14 @@ namespace sensor {
...
@@ -158,12 +158,14 @@ namespace sensor {
switchState
(
PREPARE_CALIBRATION_UNSTABLE
);
switchState
(
PREPARE_CALIBRATION_UNSTABLE
);
}
}
void
calibrate
AndRestart
()
{
void
calibrate
()
{
Serial
.
print
(
F
(
"Calibrating SCD30 now..."
));
Serial
.
print
(
F
(
"Calibrating SCD30 now..."
));
scd30
.
setAltitudeCompensation
(
config
::
altitude_above_sea_level
);
scd30
.
setAltitudeCompensation
(
config
::
altitude_above_sea_level
);
scd30
.
setForcedRecalibrationFactor
(
config
::
co2_calibration_level
);
scd30
.
setForcedRecalibrationFactor
(
config
::
co2_calibration_level
);
Serial
.
println
(
F
(
" Done!"
));
Serial
.
println
(
F
(
" Done!"
));
Serial
.
println
(
F
(
"Sensor calibrated."
));
Serial
.
println
(
F
(
"Sensor calibrated."
));
//WARNING: Do not reset the ampel or the SCD30!
//At least one measurement needs to happen in order for the calibration to be correctly applied.
}
}
void
logToSerial
()
{
void
logToSerial
()
{
...
@@ -209,7 +211,7 @@ namespace sensor {
...
@@ -209,7 +211,7 @@ namespace sensor {
// leave them before calibration is done.
// leave them before calibration is done.
bool
ready_for_calibration
=
countStableMeasurements
();
bool
ready_for_calibration
=
countStableMeasurements
();
if
(
ready_for_calibration
)
{
if
(
ready_for_calibration
)
{
calibrate
AndRestart
();
calibrate
();
}
}
}
else
if
(
co2
<
250
)
{
}
else
if
(
co2
<
250
)
{
// Sensor should be calibrated.
// Sensor should be calibrated.
...
@@ -325,7 +327,7 @@ namespace sensor {
...
@@ -325,7 +327,7 @@ namespace sensor {
config
::
co2_calibration_level
=
calibrationLevel
;
config
::
co2_calibration_level
=
calibrationLevel
;
Serial
.
print
(
config
::
co2_calibration_level
);
Serial
.
print
(
config
::
co2_calibration_level
);
Serial
.
println
(
F
(
" ppm."
));
Serial
.
println
(
F
(
" ppm."
));
calibrate
AndRestart
();
calibrate
();
}
}
}
}
...
...
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