From f059509204d5fb9724fc14fa59a2fec829f2ca71 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 6 Mar 2022 13:18:06 +0000 Subject: calibration only needs to be done once! Revert "force calibration" This reverts commit 6aa491b6da5f842f4d147a283f05ddd57fb824dd. --- main.ino | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/main.ino b/main.ino index 8597702..bde8892 100644 --- a/main.ino +++ b/main.ino @@ -48,9 +48,6 @@ void showThings(bool all=false) { display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false); } -unsigned long startTime; -bool frcDone = false; - void setup() { Serial.begin(115200); @@ -98,8 +95,6 @@ void setup() { Serial.println(errorMessage); } - startTime = millis(); - // this will try to re-init Wire, emit a warning, and carry on sensirion_i2c_init(); @@ -131,44 +126,8 @@ void loop() { char errorMessage[256]; delay(5000); - Serial.println(millis()); - - if (!frcDone && (millis() - startTime > (3*60 + 30)*1000)) { // 3½ minutes - Serial.println("calibration"); - frcDone=true; - display.fillScreen(GxEPD_WHITE); - display.setCursor(0,20); - display.print("FRC"); - display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false); - scd4x.stopPeriodicMeasurement(); - delay(500); - - uint16_t frcCorrection; - error = scd4x.performForcedRecalibration(420,frcCorrection); - if (error != 0) { - Serial.print("scd4x error "); - errorToString(error, errorMessage, 256); - Serial.println(errorMessage); - } - Serial.println(frcCorrection); - Serial.println(frcCorrection - 0x8000); - - display.fillScreen(GxEPD_WHITE); - display.setCursor(0,20); - display.print("FRC ");display.print(frcCorrection); - display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false); - delay(500); - scd4x.startPeriodicMeasurement(); - delay(2000); - } - error = scd4x.readMeasurement(co2, temperature, humidity); - if (error != 0) { - Serial.print("scd4x error "); - errorToString(error, errorMessage, 256); - Serial.println(errorMessage); - } char serial[SPS30_MAX_SERIAL_LEN]; uint16_t data_ready; @@ -188,7 +147,7 @@ void loop() { ret = sps30_read_measurement(&m); - if (error || ret <0) { + if (error || ret <0 || co2 ==0) { return; } -- cgit v1.2.3