diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp index 1ec5e189228e6d13fed275712edbe00d1e628424..32680a200a5cb849b512d90f823d57d7d0f447a7 100644 --- a/ampel-firmware/co2_sensor.cpp +++ b/ampel-firmware/co2_sensor.cpp @@ -66,6 +66,7 @@ namespace sensor { void setAutoCalibration(int32_t autoCalibration); void initialize() { + Serial.println(F("Sensor : Senseair S8")); S8_serial.begin(S8_BAUDRATE); sensor_S8 = new S8_UART(S8_serial); #endif @@ -81,18 +82,14 @@ namespace sensor { } // Show basic S8 sensor info - Serial.println(">>> SenseAir S8 NDIR CO2 sensor <<<"); - printf("Firmware version: %s\n", s8.firm_version); + Serial.print(F("S8 - Firmware : ")); + Serial.println(s8.firm_version); s8.sensor_id = sensor_S8->get_sensor_ID(); - Serial.print("Sensor ID: 0x"); + Serial.print("S8 - ID : 0x"); printIntToHex(s8.sensor_id, 4); Serial.println(""); - Serial.println("Setup done!"); - Serial.flush(); - - Serial.print(F("Auto-calibration is ")); - Serial.println(config::auto_calibrate_sensor ? "ON." : "OFF."); + //TODO: Auto-calibration on/off? // S8 has its own timer (constant 4s) Serial.println(); @@ -102,7 +99,7 @@ namespace sensor { check_timestep = config::measurement_timestep_bootup; 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::defineIntCommand("calibrate", calibrateSensorToSpecificPPM, // F("600 (Starts calibration process, to given ppm)")); @@ -152,10 +149,7 @@ namespace sensor { Serial.print(timestamp); Serial.print(F(" - co2(ppm): ")); Serial.print(co2); - Serial.print(F(" temp(C): ")); - Serial.print(temperature, 1); - Serial.print(F(" humidity(%): ")); - Serial.println(humidity, 1); + Serial.println(F(" temp(C): ? humidity(%): ?")); } void switchState(state new_state) { @@ -246,6 +240,7 @@ namespace sensor { last_measurement = now; ntp::getLocalTime(timestamp); co2 = sensor_S8->get_co2(); + //TODO: Check if there's really no temperature info available. temperature = 0.0; humidity = 0.0; @@ -277,34 +272,29 @@ namespace sensor { } void setAutoCalibration(int32_t autoCalibration) { - Serial.println(F("Implement ME!")); + Serial.println(F("TODO: Implement ME!")); } 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) { - if (calibrationLevel >= 400 && calibrationLevel <= 2000) { - Serial.print(F("Force calibration, at ")); - config::co2_calibration_level = calibrationLevel; - Serial.print(config::co2_calibration_level); - Serial.println(F(" ppm.")); - startCalibrationProcess(); - } + Serial.println(F("TODO: Implement ME!")); } void calibrateSensorRightNow(int32_t calibrationLevel) { - if (calibrationLevel >= 400 && calibrationLevel <= 2000) { - Serial.print(F("Force calibration, right now, at ")); - config::co2_calibration_level = calibrationLevel; - Serial.print(config::co2_calibration_level); - Serial.println(F(" ppm.")); - calibrate(); - } + Serial.println(F("TODO: Implement ME!")); } void resetSCD() { - Serial.println(F("Implement ME!")); + Serial.println(F("TODO: Implement ME! (or delete me)")); } }