remove unused code

This commit is contained in:
interfisch 2023-05-10 17:33:52 +02:00
parent a0f4c25a53
commit 1f9897d280
1 changed files with 15 additions and 81 deletions

View File

@ -17,7 +17,7 @@ ADS1115 ADS(0x48);
// ######## Water Level
#include "waterlevel.h"
//#include "waterlevel.h"
// ######## Flow Rate
@ -55,8 +55,8 @@ void setup() {
Serial.println("Setup EC");
ec_setup();
Serial.println("Setup Waterlevel");
waterlevel_setup();
//Serial.println("Setup Waterlevel");
//waterlevel_setup();
Serial.println("Setup Temperature");
temperature_setup();
@ -82,7 +82,7 @@ void setup() {
//Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted,EC,EC25");
Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted");
//Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted");
}
@ -93,7 +93,7 @@ void loop() {
temperature_loop(loopmillis);
waterlevel_loop(loopmillis);
//waterlevel_loop(loopmillis);
flow_loop(loopmillis);
@ -103,18 +103,13 @@ void loop() {
static bool getReading=false;
if (!digitalRead(PIN_BUTTON)) {
last_check=loopmillis;
valueError=false;
//Serial.println("Reset ValueError flag by user");
//digitalWrite(PIN_LED,valueError);
Serial.println("Reset ValueError flag by user");
digitalWrite(PIN_LED,valueError);
delay(100);
last_measurement_ec=0; //force reading
getReading=true;
ec_flag_measurement_available=false;
digitalWrite(PIN_LED,HIGH);
}
/*
if (ec_flag_measurement_available && getReading) {
ec_flag_measurement_available=false;
getReading=false;
@ -125,7 +120,7 @@ void loop() {
Serial.print(ec_adc); Serial.print(",");
Serial.print(ec_adc_adjusted);
Serial.println();
}
}*/
if (loopmillis>last_check+2000) { //check values
@ -137,9 +132,9 @@ void loop() {
if (tempCmean_air==DEVICE_DISCONNECTED_C || tempCmean_reservoir==DEVICE_DISCONNECTED_C) {
valueError=true;
}
if (waterlevel==WATERLEVEL_UNAVAILABLE) {
valueError=true;
}
//if (waterlevel==WATERLEVEL_UNAVAILABLE) {
// valueError=true;
//}
if (sm_mean1==SM_DISCONNECTED || sm_mean2==SM_DISCONNECTED) {
valueError=true;
}
@ -201,77 +196,16 @@ void loop() {
Serial.print(ec25);
Serial.println();
Serial.print("Waterlevel distance,volume = "); Serial.print(waterlevel); Serial.print(","); Serial.print(watervolume);
/*Serial.print("Waterlevel distance,volume = "); Serial.print(waterlevel); Serial.print(","); Serial.print(watervolume);
if (waterlevel_failcounter>0) {
Serial.print(" fails="); Serial.print(waterlevel_failcounter);
}
}*/
Serial.println();
}
/*
Serial.print(millis()/1000.0,2); Serial.print(",");
Serial.print(getMeanf(tempCmean_reservoir_array,TEMPMEAN_SIZE)); Serial.print(",");
//Serial.print(getMean(sm_mean,SM_SIZE)); Serial.print(",");
Serial.print(ec_calib_adc); Serial.print(",");
Serial.print(ec_adc); Serial.print(",");
Serial.print(ec_adc_adjusted); Serial.print(",");
Serial.print(ec); Serial.print(",");
Serial.print(ec25);
Serial.print(getMean(sm_mean,SM_SIZE));
Serial.println();
if (tempCmean_reservoir!=DEVICE_DISCONNECTED_C){
Serial.print("\t Treservoir="); Serial.print(tempCmean_reservoir); Serial.print("\t Tair="); Serial.print(tempCmean_air);
}else{
Serial.print("\t waiting for temperature");
}
if (isValueArrayOKf(waterlevelMean,WATERLEVELMEAN_SIZE,-1.0)){
float _max=getMaxf(waterlevelMean,WATERLEVELMEAN_SIZE);
float _min=getMinf(waterlevelMean,WATERLEVELMEAN_SIZE);
float _filteredWaterlevel=getFilteredf(waterlevelMean,WATERLEVELMEAN_SIZE,8);
float _meanWaterlevel=getMeanf(waterlevelMean,WATERLEVELMEAN_SIZE);
Serial.print("\t Dist="); Serial.print(_filteredWaterlevel); Serial.print("mm"); Serial.print("(+- "); Serial.print((_max-_min)/2.0); Serial.print(")"); Serial.print(" [mean="); Serial.print(_meanWaterlevel); Serial.print("]");
}else{
Serial.print("\t waiting for distance");
}
Serial.print("\t Flow="); Serial.print(flow,2);
Serial.print("\t Flowsum="); Serial.print(flow_counter_sum);
Serial.println();
*/
}
}
/*
TODO:
- recalibrate EC. Note min max (shorted, open) values. Test screw terminal connection. Recalibrate EC Probe.
*/
}