Commit 828696f7 authored by Eric Duminil's avatar Eric Duminil
Browse files

Still broken. Don't know why

parent d354b2c0
......@@ -20,7 +20,7 @@ namespace config {
namespace sensor {
S8_UART *sensor_S8;
S8_sensor sensor;
S8_sensor s8;
uint16_t co2 = 0;
float temperature = 0;
float humidity = 0;
......@@ -49,7 +49,7 @@ namespace sensor {
"PREPARE_CALIBRATION_UNSTABLE",
"PREPARE_CALIBRATION_STABLE" };
state current_state = BOOTUP;
state current_state = READY;
void switchState(state);
void setCO2forDebugging(int32_t fakeCo2);
void calibrateSensorToSpecificPPM(int32_t calibrationLevel);
......@@ -70,8 +70,8 @@ namespace sensor {
Serial.println();
// Check if S8 is available
sensor_S8->get_firmware_version(sensor.firm_version);
int len = strlen(sensor.firm_version);
sensor_S8->get_firmware_version(s8.firm_version);
int len = strlen(s8.firm_version);
if (len == 0) {
Serial.println(F("ERROR - Senseair S8 CO2 sensor not detected. Please check wiring!"));
led_effects::showKITTWheel(color::red, 30);
......@@ -80,10 +80,10 @@ namespace sensor {
// Show basic S8 sensor info
Serial.println(">>> SenseAir S8 NDIR CO2 sensor <<<");
printf("Firmware version: %s\n", sensor.firm_version);
sensor.sensor_id = sensor_S8->get_sensor_ID();
printf("Firmware version: %s\n", s8.firm_version);
s8.sensor_id = sensor_S8->get_sensor_ID();
Serial.print("Sensor ID: 0x");
printIntToHex(sensor.sensor_id, 4);
printIntToHex(s8.sensor_id, 4);
Serial.println("");
Serial.println("Setup done!");
......@@ -228,11 +228,16 @@ namespace sensor {
bool processData() {
static unsigned long last_measurement = 0;
unsigned long now = seconds();
bool freshData = now - last_measurement > config::measurement_timestep;
// bool freshData = now - last_measurement > config::measurement_timestep;
bool freshData = now - last_measurement > 4;
if (freshData) {
Serial.println("FRESH!");
last_measurement = now;
ntp::getLocalTime(timestamp);
co2 = sensor_S8->get_co2();
s8.co2 = sensor_S8->get_co2();
Serial.print(s8.co2);
Serial.println(" ppm.");
co2 = s8.co2;
temperature = 0.0;
humidity = 0.0;
......
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