Skip to content

Commit 2057e2e

Browse files
authored
Bug with manual button not sending status
This mod fixes an issue where the status of the system was NOT sent to the controller on a manual button operation due to the lastState being updated to a new state in the displayMenu. The displayMenu was called just before the lastState = state; line which meant the state was never iterated with the changed value from the displayMenu. The relays would click but the status was never transmitted. Also added some minor 50ms delays on the status updates to reduce radio saturation. Changed some DEBUG messages to show the Zone names on time change and made the VAR_3 display consistent with other VAR debug displays.
1 parent 4c79b0a commit 2057e2e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

examples/IrrigationController/IrrigationController.ino

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ void loop()
329329
{
330330
send(msg1valve.setSensor(i).set(false), false);
331331
}
332+
wait(50);
332333
}
333334
}
334335
lastValve = valveNumber;
@@ -364,6 +365,7 @@ void loop()
364365
for (byte i = 0; i <= NUMBER_OF_VALVES; i++)
365366
{
366367
send(msg1valve.setSensor(i).set(false), false);
368+
wait(50);
367369
}
368370
DEBUG_PRINT(F("State = "));
369371
DEBUG_PRINTLN(state);
@@ -386,6 +388,7 @@ void loop()
386388
{
387389
send(msg1valve.setSensor(i).set(false), false);
388390
}
391+
wait(50);
389392
}
390393
DEBUG_PRINTLN(F("State Changed, Single Zone Running..."));
391394
DEBUG_PRINT(F("Zone: "));
@@ -425,11 +428,14 @@ void loop()
425428
state = STAND_BY_ALL_OFF;
426429
}
427430
}
428-
else if (state == ZONE_SELECT_MENU)
431+
if (state == ZONE_SELECT_MENU)
429432
{
430433
displayMenu();
434+
}
435+
else
436+
{
437+
lastState = state;
431438
}
432-
lastState = state;
433439
}
434440
//
435441
void displayMenu(void)
@@ -594,9 +600,9 @@ void receive(const MyMessage &message)
594600
}
595601
valveNickName[i] = "";
596602
valveNickName[i] += newMessage;
597-
DEBUG_PRINT(F("Recieved new name for zone "));
603+
DEBUG_PRINT(F("Recieved variable3 valve: "));
598604
DEBUG_PRINT(i);
599-
DEBUG_PRINT(F(" and it is now called: "));
605+
DEBUG_PRINT(F(" = "));
600606
DEBUG_PRINTLN(valveNickName[i]);
601607
}
602608
receivedInitialValue = true;
@@ -615,7 +621,9 @@ void receive(const MyMessage &message)
615621
DEBUG_PRINT(F(" individual time: "));
616622
DEBUG_PRINT(valveSoloTime[i]);
617623
DEBUG_PRINT(F(" group time: "));
618-
DEBUG_PRINTLN(allZoneTime[i]);
624+
DEBUG_PRINT(allZoneTime[i]);
625+
DEBUG_PRINT(F(" name: "));
626+
DEBUG_PRINTLN(valveNickName[i]);
619627
recentUpdate = true;
620628
}
621629
}

0 commit comments

Comments
 (0)