Commit b37b8034 authored by Käppler's avatar Käppler
Browse files

co2_sensor: Make co2 alert threshold configurable

Previously, it was hardcoded to 2000 ppm, which
remains the default value.
parent 2625c205
...@@ -10,6 +10,7 @@ namespace config { ...@@ -10,6 +10,7 @@ namespace config {
const int8_t max_deviation_during_calibration = 30; // [ppm] const int8_t max_deviation_during_calibration = 30; // [ppm]
const int16_t timestep_during_calibration = 10; // [s] WARNING: Measurements can be unreliable for timesteps shorter than 10s. const int16_t timestep_during_calibration = 10; // [s] WARNING: Measurements can be unreliable for timesteps shorter than 10s.
const int8_t stable_measurements_before_calibration = 120 / timestep_during_calibration; // [-] Stable measurements during at least 2 minutes. const int8_t stable_measurements_before_calibration = 120 / timestep_during_calibration; // [-] Stable measurements during at least 2 minutes.
const uint16_t co2_alert_threshold = 2000; // [ppm] Display a flashing led ring, if concentration exceeds this value
#ifdef TEMPERATURE_OFFSET #ifdef TEMPERATURE_OFFSET
// Residual heat from CO2 sensor seems to be high enough to change the temperature reading. How much should it be offset? // Residual heat from CO2 sensor seems to be high enough to change the temperature reading. How much should it be offset?
...@@ -227,11 +228,11 @@ namespace sensor { ...@@ -227,11 +228,11 @@ namespace sensor {
* A short delay is required in order to let background tasks run on the ESP8266. * A short delay is required in order to let background tasks run on the ESP8266.
* see https://github.com/esp8266/Arduino/issues/3241#issuecomment-301290392 * see https://github.com/esp8266/Arduino/issues/3241#issuecomment-301290392
*/ */
if (co2 < 2000) { if (co2 < config::co2_alert_threshold) {
led_effects::displayCO2color(co2); led_effects::displayCO2color(co2);
delay(100); delay(100);
} else { } else {
// >= 2000: entire ring blinks red // Display a flashing led ring, if concentration exceeds a specific value
led_effects::redAlert(); led_effects::redAlert();
} }
} }
......
Supports Markdown
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