Some fixes after field testing

This commit is contained in:
ftc
2022-07-29 16:51:42 +03:00
parent 5c5d490c20
commit 9a538ba014
+7 -1
View File
@@ -166,7 +166,7 @@ unsigned long last_pump_switch = 0;
void UpdatePump() void UpdatePump()
{ {
unsigned long current = millis(); unsigned long current = millis();
int new_state = 0; int new_state = cur_state;
if (cur_mode == MODE_AUTO) if (cur_mode == MODE_AUTO)
{ {
if (cur_p < p_on) new_state = 1; 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) if ((current < last_pump_switch || current - last_pump_switch > PUMP_SWITCH_INTERVAL)
&& new_state != cur_state) && 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; cur_state = new_state;
mb.Hreg(REGISTER_CUR_STATE, cur_state); mb.Hreg(REGISTER_CUR_STATE, cur_state);
last_pump_switch = current; last_pump_switch = current;