Commit 880463c0 authored by Eric Duminil's avatar Eric Duminil
Browse files

Cleaning up

parent fa480706
Pipeline #6023 failed with stage
in 1 minute and 24 seconds
...@@ -66,6 +66,7 @@ namespace sensor { ...@@ -66,6 +66,7 @@ namespace sensor {
void setAutoCalibration(int32_t autoCalibration); void setAutoCalibration(int32_t autoCalibration);
void initialize() { void initialize() {
Serial.println(F("Sensor : Senseair S8"));
S8_serial.begin(S8_BAUDRATE); S8_serial.begin(S8_BAUDRATE);
sensor_S8 = new S8_UART(S8_serial); sensor_S8 = new S8_UART(S8_serial);
#endif #endif
...@@ -81,18 +82,14 @@ namespace sensor { ...@@ -81,18 +82,14 @@ namespace sensor {
} }
// Show basic S8 sensor info // Show basic S8 sensor info
Serial.println(">>> SenseAir S8 NDIR CO2 sensor <<<"); Serial.print(F("S8 - Firmware : "));
printf("Firmware version: %s\n", s8.firm_version); Serial.println(s8.firm_version);
s8.sensor_id = sensor_S8->get_sensor_ID(); s8.sensor_id = sensor_S8->get_sensor_ID();
Serial.print("Sensor ID: 0x"); Serial.print("S8 - ID : 0x");
printIntToHex(s8.sensor_id, 4); printIntToHex(s8.sensor_id, 4);
Serial.println(""); Serial.println("");
Serial.println("Setup done!"); //TODO: Auto-calibration on/off?
Serial.flush();
Serial.print(F("Auto-calibration is "));
Serial.println(config::auto_calibrate_sensor ? "ON." : "OFF.");
// S8 has its own timer (constant 4s) // S8 has its own timer (constant 4s)
Serial.println(); Serial.println();
...@@ -102,7 +99,7 @@ namespace sensor { ...@@ -102,7 +99,7 @@ namespace sensor {
check_timestep = config::measurement_timestep_bootup; check_timestep = config::measurement_timestep_bootup;
sensor_console::defineIntCommand("co2", setCO2forDebugging, F("1500 (Sets co2 level, for debugging)")); sensor_console::defineIntCommand("co2", setCO2forDebugging, F("1500 (Sets co2 level, for debugging)"));
// sensor_console::defineIntCommand("timer", setTimer, F("30 (Sets measurement interval, in s)")); sensor_console::defineIntCommand("timer", setTimer, F("30 (Sets measurement interval, in s)"));
// sensor_console::defineCommand("calibrate", startCalibrationProcess, F("(Starts calibration process)")); // sensor_console::defineCommand("calibrate", startCalibrationProcess, F("(Starts calibration process)"));
// sensor_console::defineIntCommand("calibrate", calibrateSensorToSpecificPPM, // sensor_console::defineIntCommand("calibrate", calibrateSensorToSpecificPPM,
// F("600 (Starts calibration process, to given ppm)")); // F("600 (Starts calibration process, to given ppm)"));
...@@ -152,10 +149,7 @@ namespace sensor { ...@@ -152,10 +149,7 @@ namespace sensor {
Serial.print(timestamp); Serial.print(timestamp);
Serial.print(F(" - co2(ppm): ")); Serial.print(F(" - co2(ppm): "));
Serial.print(co2); Serial.print(co2);
Serial.print(F(" temp(C): ")); Serial.println(F(" temp(C): ? humidity(%): ?"));
Serial.print(temperature, 1);
Serial.print(F(" humidity(%): "));
Serial.println(humidity, 1);
} }
void switchState(state new_state) { void switchState(state new_state) {
...@@ -246,6 +240,7 @@ namespace sensor { ...@@ -246,6 +240,7 @@ namespace sensor {
last_measurement = now; last_measurement = now;
ntp::getLocalTime(timestamp); ntp::getLocalTime(timestamp);
co2 = sensor_S8->get_co2(); co2 = sensor_S8->get_co2();
//TODO: Check if there's really no temperature info available.
temperature = 0.0; temperature = 0.0;
humidity = 0.0; humidity = 0.0;
...@@ -277,34 +272,29 @@ namespace sensor { ...@@ -277,34 +272,29 @@ namespace sensor {
} }
void setAutoCalibration(int32_t autoCalibration) { void setAutoCalibration(int32_t autoCalibration) {
Serial.println(F("Implement ME!")); Serial.println(F("TODO: Implement ME!"));
} }
void setTimer(int32_t timestep) { void setTimer(int32_t timestep) {
Serial.println(F("Implement ME!")); if (timestep >= 4) {
Serial.print(F("Setting Measurement Interval to : "));
Serial.print(timestep);
Serial.println(F("s."));
check_timestep = timestep;
config::measurement_timestep = timestep;
led_effects::showKITTWheel(color::green, 1);
}
} }
void calibrateSensorToSpecificPPM(int32_t calibrationLevel) { void calibrateSensorToSpecificPPM(int32_t calibrationLevel) {
if (calibrationLevel >= 400 && calibrationLevel <= 2000) { Serial.println(F("TODO: Implement ME!"));
Serial.print(F("Force calibration, at "));
config::co2_calibration_level = calibrationLevel;
Serial.print(config::co2_calibration_level);
Serial.println(F(" ppm."));
startCalibrationProcess();
}
} }
void calibrateSensorRightNow(int32_t calibrationLevel) { void calibrateSensorRightNow(int32_t calibrationLevel) {
if (calibrationLevel >= 400 && calibrationLevel <= 2000) { Serial.println(F("TODO: Implement ME!"));
Serial.print(F("Force calibration, right now, at "));
config::co2_calibration_level = calibrationLevel;
Serial.print(config::co2_calibration_level);
Serial.println(F(" ppm."));
calibrate();
}
} }
void resetSCD() { void resetSCD() {
Serial.println(F("Implement ME!")); Serial.println(F("TODO: Implement ME! (or delete me)"));
} }
} }
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