How to trigger an ATO Timeout Flag

Do you have a question on how to do something.
Ask in here.
Post Reply
gaberosenfield
Posts: 89
Joined: Thu Mar 08, 2012 5:11 pm
Location: Redwood City, California

How to trigger an ATO Timeout Flag

Post by gaberosenfield »

Hi coding whizzes,

As part of my automatic water change system and new arrival acclimation system, I want my RA to act as if an ATO timeout has occurred without having to call the StandardATO or SingleATO functions. I'm sure there is an easy way to do this, but in my ignorance I couldn't find the answer with a quick search of the forum and I'm not sure where to look to figure this out. Could someone help me?

Thanks,
Gabe
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How to trigger an ATO Timeout Flag

Post by binder »

gaberosenfield wrote:Hi coding whizzes,

As part of my automatic water change system and new arrival acclimation system, I want my RA to act as if an ATO timeout has occurred without having to call the StandardATO or SingleATO functions. I'm sure there is an easy way to do this, but in my ignorance I couldn't find the answer with a quick search of the forum and I'm not sure where to look to figure this out. Could someone help me?

Thanks,
Gabe
Inside your code somewhere, you would use this function:

Code: Select all

// Set the Timeout Flag
bitSet(ReefAngel.AlertFlags,ATOTimeOutFlag);
gaberosenfield
Posts: 89
Joined: Thu Mar 08, 2012 5:11 pm
Location: Redwood City, California

Re: How to trigger an ATO Timeout Flag

Post by gaberosenfield »

Awesome, thanks binder!

One more question: How can I use the status of the ATO timeout flag as an input to another function? I had hoped that the answer to this question would be obvious to me after the first question was answered, but it is not...

I want to do something analogous to the following using the ATO timeout flag status instead of a boolean:

boolean trigger = false;

boolean functionThatReturns0or1()
{/*function code*/}

trigger = functionThatReturns0or1();

if (trigger == true)
{/*do something else*/}
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: How to trigger an ATO Timeout Flag

Post by lnevo »

Here's a few different ways. There may be some functions to read the flags directly rather than bitread, but not sure they are there yet. If not they should be :)

boolean trigger = bitRead(ReefAngel.AlertFlags,ATOTimeOutFlag);

boolean functonThatReturns0or1()
{ return bitRead(ReefAngel.AlertFlags,ATOTimeOutFlag); }

if ( bitRead(ReefAngel.AlertFlags,ATOTimeOutFlag) )
{ /*do something else */}
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How to trigger an ATO Timeout Flag

Post by binder »

lnevo wrote:Here's a few different ways. There may be some functions to read the flags directly rather than bitread, but not sure they are there yet. If not they should be :)
they are at least in the latest dev libraries from a while ago. i saw them last night while looking at the code. i can't remember the name off hand but it's something like isAtoFlagSet(). I would have to double check though.


Sent from my iPad mini
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: How to trigger an ATO Timeout Flag

Post by lnevo »

It's ReefAngel.isATOTimeOut();

Cool :)
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How to trigger an ATO Timeout Flag

Post by binder »

awesome...i was close. :)
gaberosenfield
Posts: 89
Joined: Thu Mar 08, 2012 5:11 pm
Location: Redwood City, California

Re: How to trigger an ATO Timeout Flag

Post by gaberosenfield »

Sorry for the late reply everyone!

So ReefAngel.isATOTimeOut() will return a 1 if the ATO time out flag has been triggered and a 0 otherwise?
gaberosenfield
Posts: 89
Joined: Thu Mar 08, 2012 5:11 pm
Location: Redwood City, California

Re: How to trigger an ATO Timeout Flag

Post by gaberosenfield »

Hmm, ReefAngel.isATOTimeOut() doesn't work for me. I must not have the latest development libraries or something... I must not know how to download them, cause I just downloaded what I thought were the latest libraries like 2 weeks ago. Unless this has been added since then... Oh well, I guess I can just use bitRead(ReefAngel.AlertFlags,ATOTimeOutFlag). Thanks so much!

Gabe
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: How to trigger an ATO Timeout Flag

Post by lnevo »

Yes the new libraries were released today!
gaberosenfield
Posts: 89
Joined: Thu Mar 08, 2012 5:11 pm
Location: Redwood City, California

Re: How to trigger an ATO Timeout Flag

Post by gaberosenfield »

I just downloaded the new libraries and now my code compiles using ReefAngel.isATOTimeOut(). I'm off to see if it works the way I want it to. Thanks for helping me!
Post Reply