From 4a86d8c41c1b06d9b9cf332f647738c128d01c8b Mon Sep 17 00:00:00 2001 From: Empire Date: Fri, 29 Apr 2022 10:14:50 +0200 Subject: [PATCH] fixed analog probe being backwards, extended range for frequency one --- esp32/include/ControllerConfiguration.h | 8 ++++---- esp32/include/PlantCtrl.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/esp32/include/ControllerConfiguration.h b/esp32/include/ControllerConfiguration.h index 8fa4e50..3d0ac5e 100644 --- a/esp32/include/ControllerConfiguration.h +++ b/esp32/include/ControllerConfiguration.h @@ -86,7 +86,7 @@ #define CONFIG_COMPILER_CXX_EXCEPTIONS -#define FIRMWARE_VERSION "2.3 @ 0.10b" +#define FIRMWARE_VERSION "2.4 HW0.10b" #define TIMED_LIGHT_PIN CUSTOM1_PIN5 #define FLOWMETER_PIN CUSTOM1_PIN1 @@ -95,10 +95,10 @@ #endif #define MOIST_SENSOR_MAX_FRQ 60000 // 60kHz (500Hz margin) -#define MOIST_SENSOR_MIN_FRQ 1000 // 1kHz (500Hz margin) +#define MOIST_SENSOR_MIN_FRQ 500 // 0.5kHz (500Hz margin) -#define ANALOG_SENSOR_MAX_MV 4095 /**< Maximum according https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/adc.html */ -#define ANALOG_SENSOR_MIN_MV 100 +#define ANALOG_SENSOR_MAX_MV 1300 //successive approximation of good range +#define ANALOG_SENSOR_MIN_MV 300 //successive approximation of good range #define SOLAR_VOLT_FACTOR 11 #define BATTSENSOR_INDEX_SOLAR 0 diff --git a/esp32/include/PlantCtrl.h b/esp32/include/PlantCtrl.h index 397d48f..ed211e4 100644 --- a/esp32/include/PlantCtrl.h +++ b/esp32/include/PlantCtrl.h @@ -131,7 +131,7 @@ public: case CAPACITIVE_FREQUENCY: return mapf(mMoisture_raw.getMedian(), MOIST_SENSOR_MAX_FRQ, MOIST_SENSOR_MIN_FRQ, 0, 100); case ANALOG_RESISTANCE_PROBE: - return mapf(mMoisture_raw.getMedian(), ANALOG_SENSOR_MIN_MV, ANALOG_SENSOR_MAX_MV, 0, 100); + return mapf(mMoisture_raw.getMedian(), ANALOG_SENSOR_MAX_MV, ANALOG_SENSOR_MIN_MV, 0, 100); } return MISSING_SENSOR; }