From af139331b1ed2b943371abdd018c8b5819edb510 Mon Sep 17 00:00:00 2001 From: Phat Nguyen Date: Tue, 20 Feb 2024 21:05:13 +0700 Subject: [PATCH] Show message when sensor module not found on display --- examples/ONE_I-9PSL/ONE_I-9PSL.ino | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/examples/ONE_I-9PSL/ONE_I-9PSL.ino b/examples/ONE_I-9PSL/ONE_I-9PSL.ino index 9b2ff32..10b10bd 100644 --- a/examples/ONE_I-9PSL/ONE_I-9PSL.ino +++ b/examples/ONE_I-9PSL/ONE_I-9PSL.ino @@ -1351,6 +1351,11 @@ static void setRGBledColor(char color) { ag.ledBar.setColor(r, g, b, ledNum); } +void dispSensorNotFound(String ss) { + displayShowText("Sensor init", "Error:", ss + " not found"); + delay(2000); +} + /** * @brief Initialize board */ @@ -1365,12 +1370,14 @@ static void boardInit(void) { if (ag.sgp41.begin(Wire) == false) { Serial.println("SGP41 sensor not found"); hasSensorSGP = false; + dispSensorNotFound("SGP41"); } /** INit SHT */ if (ag.sht.begin(Wire) == false) { Serial.println("SHTx sensor not found"); hasSensorSHT = false; + dispSensorNotFound("SHT"); } /** Init watchdog */ @@ -1381,12 +1388,15 @@ static void boardInit(void) { // failedHandler("Init SenseAirS8 failed"); Serial.println("CO2 S8 sensor not found"); hasSensorS8 = false; + dispSensorNotFound("S8"); } /** Init PMS5003 */ if (ag.pms5003.begin(Serial0) == false) { Serial.println("PMS sensor not found"); hasSensorPMS = false; + + dispSensorNotFound("PMS"); } }