Page 1 of 1

How to trigger an ATO Timeout Flag

Posted: Mon Dec 08, 2014 4:39 pm
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

Re: How to trigger an ATO Timeout Flag

Posted: Mon Dec 08, 2014 8:00 pm
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);

Re: How to trigger an ATO Timeout Flag

Posted: Mon Dec 08, 2014 10:21 pm
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*/}

Re: How to trigger an ATO Timeout Flag

Posted: Tue Dec 09, 2014 5:29 am
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 */}

Re: How to trigger an ATO Timeout Flag

Posted: Tue Dec 09, 2014 12:02 pm
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

Re: How to trigger an ATO Timeout Flag

Posted: Tue Dec 09, 2014 12:31 pm
by lnevo
It's ReefAngel.isATOTimeOut();

Cool :)

Re: How to trigger an ATO Timeout Flag

Posted: Tue Dec 09, 2014 5:12 pm
by binder
awesome...i was close. :)

Re: How to trigger an ATO Timeout Flag

Posted: Thu Dec 11, 2014 12:59 pm
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?

Re: How to trigger an ATO Timeout Flag

Posted: Thu Dec 11, 2014 1:04 pm
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

Re: How to trigger an ATO Timeout Flag

Posted: Thu Dec 11, 2014 4:37 pm
by lnevo
Yes the new libraries were released today!

Re: How to trigger an ATO Timeout Flag

Posted: Sun Dec 14, 2014 7:13 pm
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!