remove unused code
This commit is contained in:
parent
a0f4c25a53
commit
1f9897d280
94
src/main.cpp
94
src/main.cpp
|
@ -17,7 +17,7 @@ ADS1115 ADS(0x48);
|
||||||
|
|
||||||
|
|
||||||
// ######## Water Level
|
// ######## Water Level
|
||||||
#include "waterlevel.h"
|
//#include "waterlevel.h"
|
||||||
|
|
||||||
|
|
||||||
// ######## Flow Rate
|
// ######## Flow Rate
|
||||||
|
@ -55,8 +55,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();
|
//waterlevel_setup();
|
||||||
|
|
||||||
Serial.println("Setup Temperature");
|
Serial.println("Setup Temperature");
|
||||||
temperature_setup();
|
temperature_setup();
|
||||||
|
@ -82,7 +82,7 @@ void setup() {
|
||||||
|
|
||||||
|
|
||||||
//Serial.println("time,tempReservoir,ECadcCalib,ECadc,ECadcAdjusted,EC,EC25");
|
//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);
|
temperature_loop(loopmillis);
|
||||||
|
|
||||||
waterlevel_loop(loopmillis);
|
//waterlevel_loop(loopmillis);
|
||||||
|
|
||||||
flow_loop(loopmillis);
|
flow_loop(loopmillis);
|
||||||
|
|
||||||
|
@ -103,18 +103,13 @@ void loop() {
|
||||||
static bool getReading=false;
|
static bool getReading=false;
|
||||||
|
|
||||||
if (!digitalRead(PIN_BUTTON)) {
|
if (!digitalRead(PIN_BUTTON)) {
|
||||||
last_check=loopmillis;
|
|
||||||
valueError=false;
|
valueError=false;
|
||||||
//Serial.println("Reset ValueError flag by user");
|
Serial.println("Reset ValueError flag by user");
|
||||||
//digitalWrite(PIN_LED,valueError);
|
digitalWrite(PIN_LED,valueError);
|
||||||
delay(100);
|
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) {
|
if (ec_flag_measurement_available && getReading) {
|
||||||
ec_flag_measurement_available=false;
|
ec_flag_measurement_available=false;
|
||||||
getReading=false;
|
getReading=false;
|
||||||
|
@ -125,7 +120,7 @@ void loop() {
|
||||||
Serial.print(ec_adc); Serial.print(",");
|
Serial.print(ec_adc); Serial.print(",");
|
||||||
Serial.print(ec_adc_adjusted);
|
Serial.print(ec_adc_adjusted);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (loopmillis>last_check+2000) { //check values
|
if (loopmillis>last_check+2000) { //check values
|
||||||
|
|
||||||
|
@ -137,9 +132,9 @@ void loop() {
|
||||||
if (tempCmean_air==DEVICE_DISCONNECTED_C || tempCmean_reservoir==DEVICE_DISCONNECTED_C) {
|
if (tempCmean_air==DEVICE_DISCONNECTED_C || tempCmean_reservoir==DEVICE_DISCONNECTED_C) {
|
||||||
valueError=true;
|
valueError=true;
|
||||||
}
|
}
|
||||||
if (waterlevel==WATERLEVEL_UNAVAILABLE) {
|
//if (waterlevel==WATERLEVEL_UNAVAILABLE) {
|
||||||
valueError=true;
|
// valueError=true;
|
||||||
}
|
//}
|
||||||
if (sm_mean1==SM_DISCONNECTED || sm_mean2==SM_DISCONNECTED) {
|
if (sm_mean1==SM_DISCONNECTED || sm_mean2==SM_DISCONNECTED) {
|
||||||
valueError=true;
|
valueError=true;
|
||||||
}
|
}
|
||||||
|
@ -201,77 +196,16 @@ void loop() {
|
||||||
Serial.print(ec25);
|
Serial.print(ec25);
|
||||||
Serial.println();
|
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) {
|
if (waterlevel_failcounter>0) {
|
||||||
Serial.print(" fails="); Serial.print(waterlevel_failcounter);
|
Serial.print(" fails="); Serial.print(waterlevel_failcounter);
|
||||||
}
|
}*/
|
||||||
Serial.println();
|
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.
|
|
||||||
*/
|
|
Loading…
Reference in New Issue