From d354b2c05fb217d22112256d9c0f491a863ed30c Mon Sep 17 00:00:00 2001 From: Eric Duminil <eric.duminil@gmail.com> Date: Tue, 22 Mar 2022 09:17:50 +0100 Subject: [PATCH] Compiles again. Not working yet --- ampel-firmware/co2_sensor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp index 833968f..4f2a3ec 100644 --- a/ampel-firmware/co2_sensor.cpp +++ b/ampel-firmware/co2_sensor.cpp @@ -226,9 +226,11 @@ namespace sensor { * Returns true if fresh data is available, for further processing (e.g. MQTT, CSV or LoRa) */ bool processData() { - bool freshData = scd30.dataAvailable(); - + static unsigned long last_measurement = 0; + unsigned long now = seconds(); + bool freshData = now - last_measurement > config::measurement_timestep; if (freshData) { + last_measurement = now; ntp::getLocalTime(timestamp); co2 = sensor_S8->get_co2(); temperature = 0.0; -- GitLab