diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp index 946e09b8c2fc621b9a027a96ca44985b0720d4e0..51e5fcc68dc34e393fe4ed63e1db92a2bc4818da 100644 --- a/ampel-firmware/co2_sensor.cpp +++ b/ampel-firmware/co2_sensor.cpp @@ -15,6 +15,7 @@ namespace config { const float temperature_offset = -3.0; // [K] Temperature measured by sensor is usually at least 3K too high. #endif bool auto_calibrate_sensor = AUTO_CALIBRATE_SENSOR; // [true / false] + const bool debug_sensor_states = false; // If true, log state transitions over serial console } namespace sensor { @@ -172,10 +173,12 @@ namespace sensor { void switchState(state new_state) { if (new_state == current_state) return; - Serial.print(F("Changing sensor state: ")); - Serial.print(state_names[current_state]); - Serial.print(" -> "); - Serial.println(state_names[new_state]); + if (config::debug_sensor_states) { + Serial.print(F("Changing sensor state: ")); + Serial.print(state_names[current_state]); + Serial.print(" -> "); + Serial.println(state_names[new_state]); + } current_state = new_state; }