You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only a few of my stations are plumbed in to my flow meter. When a station without the flow meter runs, the previous station's flow rate is stored in the logs. It should store a 0. The attached screenshot shows the entries in red that should be 0. The values in green are correct. This issue shows up in my case, but also would be present if a station did not water at all due to a valve not opening.
Based on the comments in flow_poll() function, this IF statement jumps out of the function if the sensor never drops from HIGH to LOW, OR it would also jump out if the sensor never changes at all. This is the case for my stations without a flow meter.
void flow_poll() {
...
if(!(prev_flow_state==HIGH && curr_flow_state==LOW)) { // only record on falling edge
prev_flow_state = curr_flow_state;
return;
}
If the sensor never changes, then it will never get to execute any of the following initialization code inside flow_poll() :
/* RAH implementation of flow sensor */
if (flow_start==0) { flow_gallons=0; flow_start=curr;} // if first pulse, record time
if ((curr-flow_start)<90000) { flow_gallons=0; } // wait 90 seconds before recording flow_begin
else { if (flow_gallons==1) { flow_begin = curr;}}
flow_stop = curr; // get time in ms for stop
flow_gallons++; // increment gallon count for each poll
/* End of RAH implementation of flow sensor */
Would it work to move or copy the "flow_gallons=0" from flow_poll() to the turn_on_station() function where the flow_start variable is also reset?
void turn_on_station(byte sid, ulong duration) {
// RAH implementation of flow sensor
flow_start=0;
//Move or copy flow_gallons reset here?//
flow_gallons=0
If flow_gallons=0 is moved, then the existing code in the turn_off_station() function should work properly to log a 0 for flow_last_gpm:
// RAH implementation of flow sensor
if (flow_gallons > 1) {
if(flow_stop <= flow_begin) flow_last_gpm = 0;
else flow_last_gpm = (float) 60000 / (float)((flow_stop-flow_begin) / (flow_gallons - 1));
}// RAH calculate GPM, 1 pulse per gallon
else {flow_last_gpm = 0;} // RAH if not one gallon (two pulses) measured then record 0 gpm
The text was updated successfully, but these errors were encountered:
bb09961
added a commit
to bb09961/OpenSprinkler-Firmware
that referenced
this issue
Sep 21, 2023
…ler#248
If a station did not have a flow meter or open properly, the code was recording the flow amount from the previous station run to the logs. This should reset the flow_gallons counter properly when a station starts.
Only a few of my stations are plumbed in to my flow meter. When a station without the flow meter runs, the previous station's flow rate is stored in the logs. It should store a 0. The attached screenshot shows the entries in red that should be 0. The values in green are correct. This issue shows up in my case, but also would be present if a station did not water at all due to a valve not opening.
Based on the comments in flow_poll() function, this IF statement jumps out of the function if the sensor never drops from HIGH to LOW, OR it would also jump out if the sensor never changes at all. This is the case for my stations without a flow meter.
If the sensor never changes, then it will never get to execute any of the following initialization code inside flow_poll() :
Would it work to move or copy the "flow_gallons=0" from flow_poll() to the turn_on_station() function where the flow_start variable is also reset?
If flow_gallons=0 is moved, then the existing code in the turn_off_station() function should work properly to log a 0 for flow_last_gpm:
The text was updated successfully, but these errors were encountered: