dangerous "do" loops

Related to the development libraries, released by Curt Binder
Post Reply
rygh
Posts: 21
Joined: Wed Jun 08, 2011 5:07 pm

dangerous "do" loops

Post by rygh »

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.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: dangerous "do" loops

Post by binder »

Thanks for the input. The menu system isn't perfect by any means (from what you can tell). I'll look into it more unless you want to make some fixes and send me your proposed changes.

curt
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: dangerous "do" loops

Post by rimai »

I thought the water change and feeding mode was going to main loop since a couple of releases back.
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: dangerous "do" loops

Post by binder »

rimai wrote:I thought the water change and feeding mode was going to main loop since a couple of releases back.
They are in the main loop. The only ones that are not are any of the setup screens.

curt
Post Reply