Page 1 of 1

ATO saftey code

Posted: Sun Aug 07, 2016 6:56 am
by Smotz
Can someone help me with this? I posted this in "How do I code?" but not getting much traffic there, I think.


I use the below code to override my ATO port if the water level is too high.

How can I get this to ignore feeding and water change mode? Not just during but for a few seconds after also so the water level stabilizes?

Code: Select all

// just to be safe if the water level gets to 135 or greater, OVERRIDE the topoff.
   if ( ReefAngel.WaterLevel.GetLevel(1) >= 145 ) ReefAngel.Relay.Override (Topoff,0);
// End Main Top Off

Re: ATO saftey code

Posted: Sun Aug 07, 2016 9:25 pm
by lnevo
unsigned long atoIgnore=0;

if (ReefAngel.DisplayedMenu==FEEDING_MODE || ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
atoIgnore=now();
}

if (now()-atoIgnore > 30) { // Wait 30 seconds before starting ATO
// just to be safe if the water level gets to 135 or greater, OVERRIDE the topoff.
if ( ReefAngel.WaterLevel.GetLevel(1) >= 145 ) ReefAngel.Relay.Override (Topoff,0);
// End Main Top Off
}

Re: ATO saftey code

Posted: Mon Aug 08, 2016 4:29 am
by Smotz
Thanks Lee - dumb question: in this example, are the {} needed?

Code: Select all

if (ReefAngel.DisplayedMenu==FEEDING_MODE || ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
  atoIgnore=now();
}
lnevo wrote:unsigned long atoIgnore=0;

if (ReefAngel.DisplayedMenu==FEEDING_MODE || ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
atoIgnore=now();
}

if (now()-atoIgnore > 30) { // Wait 30 seconds before starting ATO
// just to be safe if the water level gets to 135 or greater, OVERRIDE the topoff.
if ( ReefAngel.WaterLevel.GetLevel(1) >= 145 ) ReefAngel.Relay.Override (Topoff,0);
// End Main Top Off
}

ATO saftey code

Posted: Mon Aug 08, 2016 8:26 pm
by lnevo
If you only have one command inside then no