From b85a68622b5739608a3d45229d03b9d274ca6900 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 2 Apr 2022 12:07:09 +0100 Subject: prefix for Serial prints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * `#` → debug * `!` → warn --- co2.h | 10 +++++----- datalog.h | 10 +++++----- main.ino | 2 +- pm.h | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/co2.h b/co2.h index ee4f6f2..f75c94c 100644 --- a/co2.h +++ b/co2.h @@ -23,14 +23,14 @@ public: // stop potentially previously started measurement error = scd4x.stopPeriodicMeasurement(); if (error) { - Serial.print("CO2 stopPeriodicMeasurement() error: "); + Serial.print("! CO2 stopPeriodicMeasurement() error: "); errorToString(error, errorMessage, 256); Serial.println(errorMessage); } error = scd4x.setAutomaticSelfCalibration(1); if (error) { - Serial.print("CO2 setAutomaticSelfCalibration() error: "); + Serial.print("! CO2 setAutomaticSelfCalibration() error: "); errorToString(error, errorMessage, 256); Serial.println(errorMessage); } @@ -38,7 +38,7 @@ public: // Start Measurement error = scd4x.startLowPowerPeriodicMeasurement(); if (error) { - Serial.print("CO2 startLowPowerPeriodicMeasurement() error: "); + Serial.print("! CO2 startLowPowerPeriodicMeasurement() error: "); errorToString(error, errorMessage, 256); Serial.println(errorMessage); } @@ -51,7 +51,7 @@ public: error = scd4x.getDataReadyStatus(ready); if (error) { - Serial.print("CO2 getDataReadyStatus() error: "); + Serial.print("! CO2 getDataReadyStatus() error: "); errorToString(error, errorMessage, 256); Serial.println(errorMessage); return false; @@ -67,7 +67,7 @@ public: error = scd4x.readMeasurement(data->co2, data->temperature, data->humidity); if (error) { - Serial.print("CO2 readMeasurement() error: "); + Serial.print("! CO2 readMeasurement() error: "); errorToString(error, errorMessage, 256); Serial.println(errorMessage); } diff --git a/datalog.h b/datalog.h index 57a6b9f..96a3dfd 100644 --- a/datalog.h +++ b/datalog.h @@ -30,9 +30,9 @@ public: void start() { bool sdok=SD.begin(mySD_CS, mySD_MOSI, mySD_MISO, mySD_SCLK); - Serial.print("sdok: ");Serial.println(sdok); + Serial.print("# sdok: ");Serial.println(sdok); logfile = SD.open("quality.csv",FILE_WRITE); - Serial.print("file: ");Serial.println(logfile.name()); + Serial.print("# file: ");Serial.println(logfile.name()); uint32_t fileSize = logfile.size(); logfile.seek(fileSize); if (fileSize == 0) { @@ -59,13 +59,13 @@ public: data->batteryVoltage ); size_t written=logfile.write((uint8_t *)line,lineLength); - Serial.write(line); - Serial.print("written: ");Serial.println(written); + Serial.print("# ");Serial.write(line); + Serial.print("# written: ");Serial.println(written); if (++linesSinceLastFlush > flushThreshold) { logfile.flush(); linesSinceLastFlush=0; - Serial.println("flushed"); + Serial.println("# flushed"); } } }; diff --git a/main.ino b/main.ino index e51c3ea..1963870 100644 --- a/main.ino +++ b/main.ino @@ -34,7 +34,7 @@ void setup() { battery.start(); co2.start(); pm.start(); - Serial.println("Waiting for first measurement... (5 sec)"); + Serial.println("# Waiting for first measurement... (5 sec)"); delay(5000); } diff --git a/pm.h b/pm.h index 4bfc10c..7ac2050 100644 --- a/pm.h +++ b/pm.h @@ -33,7 +33,7 @@ public: sensirion_i2c_init(); while (sps30_probe() != 0) { - Serial.print("PM sensor probing failed\n"); + Serial.println("! PM sensor probing failed"); delay(500); } @@ -41,13 +41,13 @@ public: ret = sps30_set_fan_auto_cleaning_interval_days(auto_clean_days); if (ret) { - Serial.print("PM setting the auto-clean interval error: "); + Serial.print("! PM setting the auto-clean interval error: "); Serial.println(ret); } ret = sps30_start_measurement(); if (ret < 0) { - Serial.print("PM starting measurement error\n"); + Serial.println("! PM starting measurement error"); } awake=true; @@ -75,7 +75,7 @@ public: ret = sps30_read_data_ready(&data_ready); if (ret < 0) { - Serial.print("PM reading data-ready flag error: "); + Serial.print("! PM reading data-ready flag error: "); Serial.println(ret); return false; } else if (!data_ready) { @@ -92,7 +92,7 @@ public: ret = sps30_read_measurement(&(data->pm)); if (ret <0) { - Serial.print("PM reading measurement error: "); + Serial.print("! PM reading measurement error: "); Serial.println(ret); return; } -- cgit v1.2.3