ATO saftey code

Basic / Standard Reef Angel hardware
Post Reply
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

ATO saftey code

Post 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
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: ATO saftey code

Post 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
}
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: ATO saftey code

Post 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
}
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

ATO saftey code

Post by lnevo »

If you only have one command inside then no
Post Reply