From 2e052710e22d092ae1cf8a5f7b43390bdfc9f5ab Mon Sep 17 00:00:00 2001 From: c3ma Date: Wed, 21 Jul 2021 21:34:14 +0200 Subject: [PATCH] missing sensor error --- esp32/include/PlantCtrl.h | 3 +++ esp32/src/main.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/esp32/include/PlantCtrl.h b/esp32/include/PlantCtrl.h index a98b65b..1946cf4 100644 --- a/esp32/include/PlantCtrl.h +++ b/esp32/include/PlantCtrl.h @@ -82,6 +82,9 @@ public: float getCurrentMoisture() { + if(mMoisture_freq < MOIST_SENSOR_MIN_FRQ){ + return MISSING_SENSOR; + } return mMoisture_freq; } diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index 147c6e1..8cfcc76 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -273,6 +273,11 @@ void readPowerSwitchedSensors() mPlants[i].stopMoistureMeasurement(); } + for (int i = 0; i < MAX_PLANTS; i++) + { + Serial << "Plant " << i << " measurement: " << mPlants[i].getCurrentMoisture() << " hz" << endl; + } + waterRawSensor.clear(); Wire.setPins(SENSOR_TANK_TRG, SENSOR_TANK_ECHO); Wire.begin();