flow sensor calibration
This commit is contained in:
parent
fe6d4e98fa
commit
3f62820e22
48
src/main.cpp
48
src/main.cpp
|
@ -85,18 +85,19 @@ void loop() {
|
|||
flag_print=false;
|
||||
|
||||
|
||||
ec_loop(loopmillis);
|
||||
|
||||
//ec_loop(loopmillis);
|
||||
|
||||
|
||||
temperature_loop(loopmillis);
|
||||
//temperature_loop(loopmillis);
|
||||
|
||||
|
||||
waterlevel_loop(loopmillis);
|
||||
//waterlevel_loop(loopmillis);
|
||||
|
||||
|
||||
flow_loop(loopmillis);
|
||||
|
||||
sm_loop(loopmillis);
|
||||
//sm_loop(loopmillis);
|
||||
|
||||
|
||||
static bool getReading=false;
|
||||
|
@ -108,8 +109,42 @@ void loop() {
|
|||
digitalWrite(PIN_LED,HIGH);
|
||||
}
|
||||
|
||||
static bool started=false;
|
||||
static bool ended=false;
|
||||
static unsigned long started_time=0;
|
||||
static unsigned long ended_time=0;
|
||||
|
||||
if (loopmillis>last_print+2000) {
|
||||
|
||||
if (flow_counter_sum>10 && !started && !ended) { //start
|
||||
started=true;
|
||||
started_time=millis();
|
||||
Serial.println("Started!");
|
||||
}
|
||||
static uint32_t last_flow_counter_sum=0;
|
||||
if (loopmillis>last_print+1000) { //test check
|
||||
last_print=loopmillis;
|
||||
if (started && !ended) {
|
||||
Serial.println(flow_counter_sum-last_flow_counter_sum);
|
||||
if (flow_counter_sum-last_flow_counter_sum<=2){ //stopped
|
||||
ended=true;
|
||||
ended_time=millis();
|
||||
Serial.println("Ended!");
|
||||
}
|
||||
|
||||
last_flow_counter_sum=flow_counter_sum;
|
||||
|
||||
}
|
||||
if (ended) {
|
||||
Serial.println("counts,time");
|
||||
Serial.print(flow_counter_sum);
|
||||
Serial.print(",");
|
||||
Serial.print((ended_time-started_time)/1000.0);
|
||||
Serial.println();
|
||||
delay(10000);
|
||||
}
|
||||
}
|
||||
|
||||
if (loopmillis>last_print+2000 && 1==2) {
|
||||
//if (ec_flag_measurement_available && getReading) {
|
||||
if (ec_flag_measurement_available) {
|
||||
last_print=loopmillis;
|
||||
|
@ -119,6 +154,7 @@ void loop() {
|
|||
|
||||
|
||||
Serial.print(millis()/1000.0,2); Serial.print(",");
|
||||
/*
|
||||
Serial.print(getMeanf(tempCmean_reservoir,TEMPMEAN_SIZE)); Serial.print(",");
|
||||
//Serial.print(getMean(sm_mean,SM_SIZE)); Serial.print(",");
|
||||
|
||||
|
@ -127,6 +163,8 @@ void loop() {
|
|||
Serial.print(ec_adc_adjusted); //Serial.print(",");
|
||||
//Serial.print(ec); Serial.print(",");
|
||||
//Serial.print(ec25);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Serial.println();
|
||||
|
|
Loading…
Reference in New Issue