remove interval variable from functions
This commit is contained in:
parent
9e539682e8
commit
fc000c95ff
|
@ -19,8 +19,8 @@ void flow_setup() {
|
||||||
attachInterrupt(FLOW_PIN, isr_flow, CHANGE);
|
attachInterrupt(FLOW_PIN, isr_flow, CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flow_loop(unsigned long loopmillis, unsigned long pInterval) {
|
void flow_loop(unsigned long loopmillis) {
|
||||||
if (loopmillis>=last_read_flow+pInterval) {
|
if (loopmillis>=last_read_flow+READINTERVAL_FLOW) {
|
||||||
flow=flow_counter*1000.0/(loopmillis-last_read_flow)/2.0; //Frequency [Hz]
|
flow=flow_counter*1000.0/(loopmillis-last_read_flow)/2.0; //Frequency [Hz]
|
||||||
flow/=flow_factor; //[L/min]
|
flow/=flow_factor; //[L/min]
|
||||||
|
|
||||||
|
|
|
@ -78,12 +78,12 @@ void temperature_setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void temperature_loop(unsigned long loopmillis, unsigned long pInterval) {
|
void temperature_loop(unsigned long loopmillis) {
|
||||||
|
|
||||||
static unsigned long last_read_ds18b20;
|
static unsigned long last_read_ds18b20;
|
||||||
static bool flag_requestTemperatures=false;
|
static bool flag_requestTemperatures=false;
|
||||||
if (loopmillis>last_read_ds18b20+pInterval) {
|
if (loopmillis>last_read_ds18b20+READINTERVAL_DS18B20) {
|
||||||
if (loopmillis>last_read_ds18b20+pInterval*10) { //timeout
|
if (loopmillis>last_read_ds18b20+READINTERVAL_DS18B20*10) { //timeout
|
||||||
Serial.println("Warn: Request Temperatures Timeout!");
|
Serial.println("Warn: Request Temperatures Timeout!");
|
||||||
flag_requestTemperatures=false;
|
flag_requestTemperatures=false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ void waterlevel_setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void waterlevel_loop(unsigned long loopmillis, unsigned long pInterval) {
|
void waterlevel_loop(unsigned long loopmillis) {
|
||||||
|
|
||||||
static unsigned long last_read_hcsr04;
|
static unsigned long last_read_hcsr04;
|
||||||
if (loopmillis>=last_read_hcsr04+pInterval) {
|
if (loopmillis>=last_read_hcsr04+READINTERVAL_HCSR04) {
|
||||||
last_read_hcsr04=loopmillis;
|
last_read_hcsr04=loopmillis;
|
||||||
float temperature=20.0;
|
float temperature=20.0;
|
||||||
if (tempC_air!=DEVICE_DISCONNECTED_C && isValueArrayOKf(tempCmean_air,TEMPMEAN_SIZE,DEVICE_DISCONNECTED_C)) { //sensor ok
|
if (tempC_air!=DEVICE_DISCONNECTED_C && isValueArrayOKf(tempCmean_air,TEMPMEAN_SIZE,DEVICE_DISCONNECTED_C)) { //sensor ok
|
||||||
|
|
12
src/main.cpp
12
src/main.cpp
|
@ -51,22 +51,24 @@ void loop() {
|
||||||
flag_print=false;
|
flag_print=false;
|
||||||
|
|
||||||
|
|
||||||
ec_loop(loopmillis, EC_READ_INTERVAL);
|
ec_loop(loopmillis);
|
||||||
|
|
||||||
|
|
||||||
temperature_loop(loopmillis, READINTERVAL_DS18B20);
|
temperature_loop(loopmillis);
|
||||||
|
|
||||||
|
|
||||||
waterlevel_loop(loopmillis, READINTERVAL_HCSR04);
|
waterlevel_loop(loopmillis);
|
||||||
|
|
||||||
|
|
||||||
flow_loop(loopmillis, READINTERVAL_FLOW);
|
flow_loop(loopmillis);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (loopmillis>last_print+500) {
|
if (loopmillis>last_print+500) {
|
||||||
last_print=loopmillis;
|
last_print=loopmillis;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
if (isValueArrayOK(ec_array,EC_ARRAY_SIZE,0))
|
if (isValueArrayOK(ec_array,EC_ARRAY_SIZE,0))
|
||||||
{
|
{
|
||||||
Serial.print("EC=");
|
Serial.print("EC=");
|
||||||
|
@ -76,6 +78,7 @@ void loop() {
|
||||||
Serial.print("Waiting for EC");
|
Serial.print("Waiting for EC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isValueArrayOKf(tempCmean_reservoir,TEMPMEAN_SIZE,DEVICE_DISCONNECTED_C)){
|
if (isValueArrayOKf(tempCmean_reservoir,TEMPMEAN_SIZE,DEVICE_DISCONNECTED_C)){
|
||||||
Serial.print("\t Treservoir="); Serial.print(getMeanf(tempCmean_reservoir,TEMPMEAN_SIZE)); Serial.print("\t Tair="); Serial.print(getMeanf(tempCmean_air,TEMPMEAN_SIZE));
|
Serial.print("\t Treservoir="); Serial.print(getMeanf(tempCmean_reservoir,TEMPMEAN_SIZE)); Serial.print("\t Tair="); Serial.print(getMeanf(tempCmean_air,TEMPMEAN_SIZE));
|
||||||
}else{
|
}else{
|
||||||
|
@ -103,6 +106,7 @@ void loop() {
|
||||||
|
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue