dangerous "do" loops
Posted: Fri Aug 19, 2011 10:24 pm
In a lot of the sub-functions, there are do {} loops that will wait
for button presses and so on.
For example, PH calibration, feeding mode, light setup, etc.
The big danger is if one of the dosing pumps or ATO is on when you enter those modes.
It appears that the relays will remain on while in the mode.
For pH calibration, that could be 20 minutes or even longer if you go off an forget.
You could end up with a flood, or a ton of Alk.
The simple fix is to do something like RelayMask, where you make sure critical relays are off.
A better but way more complex long term fix is to have all those menus state based,
so there is no do loop, but you instead go all the way back to the main loop.
A bit like DisplayMenuHeading is done, but instead of just displaying, it goes to that handler.
for button presses and so on.
For example, PH calibration, feeding mode, light setup, etc.
The big danger is if one of the dosing pumps or ATO is on when you enter those modes.
It appears that the relays will remain on while in the mode.
For pH calibration, that could be 20 minutes or even longer if you go off an forget.
You could end up with a flood, or a ton of Alk.
The simple fix is to do something like RelayMask, where you make sure critical relays are off.
A better but way more complex long term fix is to have all those menus state based,
so there is no do loop, but you instead go all the way back to the main loop.
A bit like DisplayMenuHeading is done, but instead of just displaying, it goes to that handler.