From fe0234280e1160ce35914d02293182f94fb09e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20K=C3=A4ppler?= <michael_kaeppler@web.de> Date: Wed, 28 Apr 2021 21:15:43 +0200 Subject: [PATCH] co2_sensor: Reset SCD30 after startup Sometimes after a hard reset of the ESP the SCD30 needs a long time until returning the first measurement. Resetting it after startup seems to fix this behaviour. --- ampel-firmware/co2_sensor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ampel-firmware/co2_sensor.cpp b/ampel-firmware/co2_sensor.cpp index 3b2e3c2..8756ca0 100644 --- a/ampel-firmware/co2_sensor.cpp +++ b/ampel-firmware/co2_sensor.cpp @@ -83,6 +83,11 @@ namespace sensor { ESP.restart(); } + // Changes of the SCD30's measurement timestep do not come into effect + // before the next measurement takes place. That means that after a hard reset + // of the ESP the SCD30 sometimes needs a long time until switching back to 2 s + // for acclimatization. Resetting it after startup seems to fix this behaviour. + scd30.reset(); switchState(BOOTUP); Serial.print(F("Setting temperature offset to -")); -- GitLab