Compare commits
No commits in common. "c0d2cb5e0b560473cca4e177db1917a3e52cf566" and "e1fa5273692643002219f136faab2b025a2de67e" have entirely different histories.
c0d2cb5e0b
...
e1fa527369
|
@ -29,7 +29,8 @@ 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
|
||||||
|
@ -38,7 +39,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
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,5 @@ float ec_calibration_linearize_below_adc_B=2000; //use linear approximation belo
|
||||||
float ec_calibration_linear_lowADC_B=728; //x0
|
float ec_calibration_linear_lowADC_B=728; //x0
|
||||||
float ec_calibration_linear_lowEC_B=0; //y0
|
float ec_calibration_linear_lowEC_B=0; //y0
|
||||||
|
|
||||||
Funktion getestet. Ergebnis in 20240423_FunctionTest.ods
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
31
src/main.cpp
31
src/main.cpp
|
@ -4,9 +4,9 @@
|
||||||
|
|
||||||
#include "wifi_functions.h"
|
#include "wifi_functions.h"
|
||||||
|
|
||||||
bool debug=true; //print Serial information
|
bool debug=false; //print Serial information
|
||||||
bool mqtt=true;
|
bool mqtt=false;
|
||||||
bool eccalibrationoutput=false; //serial output for ec calibration
|
bool eccalibrationoutput=true; //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,18 +95,15 @@ void setup() {
|
||||||
delay(200);
|
delay(200);
|
||||||
|
|
||||||
//Test adc to ec function output
|
//Test adc to ec function output
|
||||||
if (eccalibrationoutput) {
|
/*
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.print("adc"); Serial.print(","); Serial.print("ecA"); Serial.print(","); Serial.print("ecB"); Serial.println();
|
for (int i=750;i<14183;i+=100) {
|
||||||
for (int i=728;i<14000;i+=100) {
|
float _ec=ec_getECfromADC(i);
|
||||||
//float _ec=ec_getECfromADC(i);
|
Serial.print(i); Serial.print(","); Serial.print(_ec); Serial.println();
|
||||||
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");
|
||||||
|
@ -123,7 +120,7 @@ void loop() {
|
||||||
|
|
||||||
temperature_loop(loopmillis);
|
temperature_loop(loopmillis);
|
||||||
|
|
||||||
waterlevel_loop(loopmillis);
|
//waterlevel_loop(loopmillis);
|
||||||
|
|
||||||
flow_loop(loopmillis);
|
flow_loop(loopmillis);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue