From 9a538ba014a1071e638d421f80b7b1dbfcd065b6 Mon Sep 17 00:00:00 2001 From: Denis Denisov Date: Fri, 29 Jul 2022 16:51:42 +0300 Subject: [PATCH] Some fixes after field testing --- well_control.ino | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/well_control.ino b/well_control.ino index 63fd53b..b0f3bed 100644 --- a/well_control.ino +++ b/well_control.ino @@ -166,7 +166,7 @@ unsigned long last_pump_switch = 0; void UpdatePump() { unsigned long current = millis(); - int new_state = 0; + int new_state = cur_state; if (cur_mode == MODE_AUTO) { if (cur_p < p_on) new_state = 1; @@ -174,6 +174,12 @@ void UpdatePump() if ((current < last_pump_switch || current - last_pump_switch > PUMP_SWITCH_INTERVAL) && new_state != cur_state) { + Serial.print("CHANGE STATE "); + Serial.print(cur_p); + Serial.print(" "); + Serial.print(p_on); + Serial.print(" "); + Serial.print(p_off); cur_state = new_state; mb.Hreg(REGISTER_CUR_STATE, cur_state); last_pump_switch = current;