revert code to normal

This commit is contained in:
interfisch 2024-04-24 00:13:14 +02:00
parent 0a6f4c2e41
commit c0d2cb5e0b
2 changed files with 19 additions and 17 deletions

View File

@ -29,8 +29,7 @@ bool ec_flag_measurement_available=false;
#define EC_RESOLUTION 8 #define EC_RESOLUTION 8
#define EC_FREQUENCY 5000 #define EC_FREQUENCY 5000
//#define EC_CALIB_ARRAY_SIZE 128 #define EC_CALIB_ARRAY_SIZE 128
#define EC_CALIB_ARRAY_SIZE 32 //temporarily changed
uint16_t ec_calib_array[EC_CALIB_ARRAY_SIZE]; uint16_t ec_calib_array[EC_CALIB_ARRAY_SIZE];
uint16_t ec_calib_array_pos=0; uint16_t ec_calib_array_pos=0;
#define EC_CALIB_READ_INTERVAL 250 //interval of reading adc value inside a measurement #define EC_CALIB_READ_INTERVAL 250 //interval of reading adc value inside a measurement
@ -39,7 +38,7 @@ uint16_t ec_calib_array_pos=0;
uint16_t ec_array[EC_ARRAY_SIZE]; uint16_t ec_array[EC_ARRAY_SIZE];
uint16_t ec_array_pos=EC_ARRAY_SIZE; uint16_t ec_array_pos=EC_ARRAY_SIZE;
unsigned long last_measurement_ec=0; unsigned long last_measurement_ec=0;
#define EC_MEASUREMENT_INTERVAL 10*60*1000 //complete filtered measurement every x ms #define EC_MEASUREMENT_INTERVAL 10*60*1000 //complete filtered measurement every x ms
//One filtered measurement takes EC_READ_INTERVAL*EC_ARRAY_SIZE*4 //One filtered measurement takes EC_READ_INTERVAL*EC_ARRAY_SIZE*4
#define EC_READ_INTERVAL 10 //interval of reading adc value inside a measurement. one reading takes about 9-10ms #define EC_READ_INTERVAL 10 //interval of reading adc value inside a measurement. one reading takes about 9-10ms

View File

@ -4,9 +4,9 @@
#include "wifi_functions.h" #include "wifi_functions.h"
bool debug=false; //print Serial information bool debug=true; //print Serial information
bool mqtt=false; bool mqtt=true;
bool eccalibrationoutput=true; //serial output for ec calibration bool eccalibrationoutput=false; //serial output for ec calibration
/* Write to file with: /* Write to file with:
sudo stty -F /dev/ttyUSB0 115200 sudo stty -F /dev/ttyUSB0 115200
cat /dev/ttyUSB0 | tee received.txt cat /dev/ttyUSB0 | tee received.txt
@ -79,8 +79,8 @@ void setup() {
Serial.println("Setup EC"); Serial.println("Setup EC");
ec_setup(); ec_setup();
//Serial.println("Setup Waterlevel"); Serial.println("Setup Waterlevel");
//waterlevel_setup(); //temporarily disabled waterlevel_setup(); //temporarily disabled
Serial.println("Setup Temperature"); Serial.println("Setup Temperature");
temperature_setup(); temperature_setup();
@ -95,15 +95,18 @@ void setup() {
delay(200); delay(200);
//Test adc to ec function output //Test adc to ec function output
/* if (eccalibrationoutput) {
Serial.println(); Serial.println();
for (int i=750;i<14183;i+=100) { Serial.print("adc"); Serial.print(","); Serial.print("ecA"); Serial.print(","); Serial.print("ecB"); Serial.println();
float _ec=ec_getECfromADC(i); for (int i=728;i<14000;i+=100) {
Serial.print(i); Serial.print(","); Serial.print(_ec); Serial.println(); //float _ec=ec_getECfromADC(i);
float _ecA=ec_getECfromADC(i, ec_calibration_polynom_A, sizeof(ec_calibration_polynom_A), ec_calibration_linearize_below_adc_A, ec_calibration_linear_lowADC_A, ec_calibration_linear_lowEC_A);
float _ecB=ec_getECfromADC(i, ec_calibration_polynom_B, sizeof(ec_calibration_polynom_B), ec_calibration_linearize_below_adc_B, ec_calibration_linear_lowADC_B, ec_calibration_linear_lowEC_B);
Serial.print(i); Serial.print(","); Serial.print(_ecA); Serial.print(","); Serial.print(_ecB); Serial.println();
}
delay(100000);
} }
delay(100000);
*/
//Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted,EC,EC25"); //Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted,EC,EC25");
@ -120,7 +123,7 @@ void loop() {
temperature_loop(loopmillis); temperature_loop(loopmillis);
//waterlevel_loop(loopmillis); waterlevel_loop(loopmillis);
flow_loop(loopmillis); flow_loop(loopmillis);