I'm trying to make sure I come up with all the possible scenarios to prevent "bad" stuff from happening accidentally.
To the best of my knowledge, when one enters in one of these modes, they usually are only turning off the Always On ports (Sump, Skimmer) and Wavemakers. Is this correct for everybody? I would like to know. If this is correct, the solution is pretty simple. If it is not correct, then the solution can be a little more complex.
Here are my scenarios that I've come up with so far:
- If a port is always on, it gets turned on inside the setup(). If it gets toggled during one of the modes, it gets turned back on automatically. There is no chance for it to be toggled without the person telling it to turn on. If you manually turn it on via the web interface while in this mode, then you obviously want it on. So this is should be safe.
- Wavemakers get toggled inside the loop(). The way they are toggled, they only turn on/off if not in one of these modes. These are working as expected unless they are overridden via the web interface. See above item about manually turning it on. This should be safe.
- A DelayedOn function (currently a work in progress) would be handled in the loop(). With this function, we can manually check if the port was toggled in the corresponding mode we are in. If it is, we can skip turning it on while in the mode. If it was not toggled, it can be turned on like it would normally be turned on. This discussion / idea should be safe.
- Web / Wifi Interface - This interface has the ability to override the toggling of the ports. The toggling is handled differently than normal. If somebody overrides the port using this method, then they really want the port on. There is not a way to trigger this manual override without somebody specifically overriding it. So if somebody really wants to turn a port on while they are in the middle of Feeding or Water Change mode, then they obviously know what they are doing and we shouldn't interfere with them.
Curt