Commit f0ade083 authored by Eric Duminil's avatar Eric Duminil
Browse files

co2_sensor: Add _ between words in enum

parent 7b84ec1d
...@@ -40,18 +40,18 @@ namespace sensor { ...@@ -40,18 +40,18 @@ namespace sensor {
INITIAL, INITIAL,
BOOTUP, BOOTUP,
READY, READY,
NEEDSCALIBRATION, NEEDS_CALIBRATION,
PREPARECALIBRATION_INSTABLE, PREPARE_CALIBRATION_INSTABLE,
PREPARECALIBRATION_STABLE, PREPARE_CALIBRATION_STABLE,
CALIBRATION CALIBRATION
}; };
const char *state_names[] = { const char *state_names[] = {
"INITIAL", "INITIAL",
"BOOTUP", "BOOTUP",
"READY", "READY",
"NEEDSCALIBRATION", "NEEDS_CALIBRATION",
"PREPARECALIBRATION_INSTABLE", "PREPARE_CALIBRATION_INSTABLE",
"PREPARECALIBRATION_STABLE", "PREPARE_CALIBRATION_STABLE",
"CALIBRATION" }; "CALIBRATION" };
state current_state = INITIAL; state current_state = INITIAL;
void switchState(state); void switchState(state);
...@@ -130,10 +130,10 @@ namespace sensor { ...@@ -130,10 +130,10 @@ namespace sensor {
stable_measurements++; stable_measurements++;
Serial.print(F("Number of stable measurements : ")); Serial.print(F("Number of stable measurements : "));
Serial.println(stable_measurements); Serial.println(stable_measurements);
switchState(PREPARECALIBRATION_STABLE); switchState(PREPARE_CALIBRATION_STABLE);
} else { } else {
stable_measurements = 0; stable_measurements = 0;
switchState(PREPARECALIBRATION_INSTABLE); switchState(PREPARE_CALIBRATION_INSTABLE);
} }
previous_co2 = co2; previous_co2 = co2;
return (stable_measurements == config::enough_stable_measurements); return (stable_measurements == config::enough_stable_measurements);
...@@ -148,7 +148,7 @@ namespace sensor { ...@@ -148,7 +148,7 @@ namespace sensor {
scd30.setMeasurementInterval(2); // [s] The change will only take effect after next measurement. 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("Waiting until the measurements are stable for at least 2 minutes."));
Serial.println(F("It could take a very long time.")); Serial.println(F("It could take a very long time."));
switchState(PREPARECALIBRATION_INSTABLE); switchState(PREPARE_CALIBRATION_INSTABLE);
} }
void calibrateAndRestart() { void calibrateAndRestart() {
...@@ -207,13 +207,13 @@ namespace sensor { ...@@ -207,13 +207,13 @@ namespace sensor {
// No special signaling, we want to show the CO2 value // No special signaling, we want to show the CO2 value
case READY: case READY:
break; break;
case NEEDSCALIBRATION: case NEEDS_CALIBRATION:
led_effects::showWaitingLED(color::magenta); led_effects::showWaitingLED(color::magenta);
break; break;
case PREPARECALIBRATION_INSTABLE: case PREPARE_CALIBRATION_INSTABLE:
led_effects::showWaitingLED(color::red); led_effects::showWaitingLED(color::red);
break; break;
case PREPARECALIBRATION_STABLE: case PREPARE_CALIBRATION_STABLE:
led_effects::showWaitingLED(color::green); led_effects::showWaitingLED(color::green);
break; break;
// No special signaling here, too. // No special signaling here, too.
...@@ -243,7 +243,7 @@ namespace sensor { ...@@ -243,7 +243,7 @@ namespace sensor {
// zero ppm but non-zero temperature and non-zero humidity. // zero ppm but non-zero temperature and non-zero humidity.
Serial.println(F("Invalid sensor data - CO2 concentration <= 0 ppm")); Serial.println(F("Invalid sensor data - CO2 concentration <= 0 ppm"));
switchState(BOOTUP); switchState(BOOTUP);
} else if ((current_state == PREPARECALIBRATION_INSTABLE) || (current_state == PREPARECALIBRATION_STABLE)) { } else if ((current_state == PREPARE_CALIBRATION_INSTABLE) || (current_state == PREPARE_CALIBRATION_STABLE)) {
// Check for pre-calibration states first, because we do not want to // Check for pre-calibration states first, because we do not want to
// leave them before calibration is done. // leave them before calibration is done.
bool ready_for_calibration = countStableMeasurements(); bool ready_for_calibration = countStableMeasurements();
...@@ -252,7 +252,7 @@ namespace sensor { ...@@ -252,7 +252,7 @@ namespace sensor {
} }
} else if (co2 < 250) { } else if (co2 < 250) {
// Sensor should be calibrated. // Sensor should be calibrated.
switchState(NEEDSCALIBRATION); switchState(NEEDS_CALIBRATION);
} else { } else {
switchState(READY); switchState(READY);
} }
......
Markdown is supported
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