From 46ab83262422adcf5d855a5e39171a17b49f12dc Mon Sep 17 00:00:00 2001 From: Ollo Date: Mon, 28 Dec 2020 14:26:41 +0100 Subject: [PATCH] Voltsensor test series has a constant, too --- esp32/include/ControllerConfiguration.h | 1 + esp32/src/main.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/esp32/include/ControllerConfiguration.h b/esp32/include/ControllerConfiguration.h index 85db895..ad2bb04 100644 --- a/esp32/include/ControllerConfiguration.h +++ b/esp32/include/ControllerConfiguration.h @@ -101,6 +101,7 @@ #define TEMPERATUR_TIMEOUT 3000 /**< 3 Seconds timeout for the temperatur sensors */ #define TEMP_SENSOR_MEASURE_SERIES 5 +#define VOLT_SENSOR_MEASURE_SERIES 5 /* @} */ #endif \ No newline at end of file diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index 21e2c22..261614b 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -85,8 +85,8 @@ int readCounter = 0; bool mConfigured = false; long nextBlink = 0; /**< Time needed in main loop to support expected blink code */ -RunningMedian lipoRawSensor = RunningMedian(5); -RunningMedian solarRawSensor = RunningMedian(5); +RunningMedian lipoRawSensor = RunningMedian(VOLT_SENSOR_MEASURE_SERIES); +RunningMedian solarRawSensor = RunningMedian(VOLT_SENSOR_MEASURE_SERIES); RunningMedian waterRawSensor = RunningMedian(5); RunningMedian lipoTempSensor = RunningMedian(TEMP_SENSOR_MEASURE_SERIES); RunningMedian waterTempSensor = RunningMedian(TEMP_SENSOR_MEASURE_SERIES); @@ -180,7 +180,7 @@ long getDistance() */ void readSystemSensors() { - for (int i = 0; i < 5; i++) + for (int i = 0; i < VOLT_SENSOR_MEASURE_SERIES; i++) { lipoRawSensor.add(analogRead(SENSOR_LIPO)); solarRawSensor.add(analogRead(SENSOR_SOLAR));