Page 1 of 1
Mask relay off
Posted: Tue Jan 22, 2013 3:03 pm
by DrewPalmer04
Any way to mask the relay off after feeding mode ends? Then I can choose when to turn the relay back on via my iPhone app. This is extra helpful for coral feeding when the skimmer should remain off. Not default back to on when the feeding mode ends.
Mask relay off
Posted: Tue Jan 22, 2013 4:16 pm
by lnevo
You can use delayed on for that. Or if you look at my code, i have a section fir my vortech when i come out of feeding mode. You could use the same condition to enable a mask.
Re: Mask relay off
Posted: Tue Jan 22, 2013 4:29 pm
by DrewPalmer04
Delay on is messing with my RTC tinkering lol so no go there. How do I look at your code? I'd like for the mask to be applied only after feeding mode.
Mask relay off
Posted: Tue Jan 22, 2013 4:35 pm
by lnevo
http://forum.reefangel.com/viewtopic.php?p=17807#p17807
Essentially this code here:
// Enable Feeding Mode flag
if (ReefAngel.DisplayedMenu==FEEDING_MODE) isFeeding=true;
// Here's what we do if we're just out of feeding mode...
if (ReefAngel.DisplayedMenu==DEFAULT_MENU && isFeeding) {
isFeeding=false;
feedDelay=true; // This will let us know we want some extra time before Smart_NTM
setRFtimer(30); // Start Smart_NTM in 30 minutes...
}
Re: Mask relay off
Posted: Tue Jan 22, 2013 4:44 pm
by DrewPalmer04
This would help with delaying more. But I'd love to just have it off until I hit the mask button on my iPhone to have it unmask the port, thus turn on the skimmer. But I'd like to have manual control to "undo" the mask when I'd like on the iPhone app. No set delay time
Re: Mask relay off
Posted: Tue Jan 22, 2013 4:51 pm
by DrewPalmer04
lnevo wrote:http://forum.reefangel.com/viewtopic.php?p=17807#p17807
Essentially this code here:
// Enable Feeding Mode flag
if (ReefAngel.DisplayedMenu==FEEDING_MODE) isFeeding=true;
// Here's what we do if we're just out of feeding mode...
if (ReefAngel.DisplayedMenu==DEFAULT_MENU && isFeeding) {
isFeeding=false;
feedDelay=true; // This will let us know we want some extra time before Smart_NTM
setRFtimer(30); // Start Smart_NTM in 30 minutes...
}
Thanks so much for the help/idea though

Mask relay off
Posted: Tue Jan 22, 2013 6:01 pm
by lnevo
Forget what im doing in th if loop.....
Just change the meat of the code to set the mask you want...
I set masks later on..look at what i do later on with the skimmer when return pump goes off or when atolow is active...
Mask relay off
Posted: Tue Jan 22, 2013 6:01 pm
by lnevo
I was answering how to do stuff when feeding mode is done...like set a mask

Re: Mask relay off
Posted: Tue Jan 22, 2013 6:06 pm
by DrewPalmer04
Oh thanks!
Re: Mask relay off
Posted: Sat Jan 26, 2013 6:13 pm
by DrewPalmer04
could I do this?
setup()
{
ReefAngel.CustomVar[0]=0;
ReefAngel.CustomVar[7]=255;
}
loop()
{
ReefAngel.CustomVar[0]=InternalMemory.read(FeedingTimer_read);
if ( ReefAngel.CustomVar[0]== 0 )
{
ReefAngel.Relay.RelayMaskOff=~Port4Bit;
}
}
Mask relay off
Posted: Sat Jan 26, 2013 6:49 pm
by lnevo
The feed timer doesn't update in memory as its counting down...
Re: Mask relay off
Posted: Sat Jan 26, 2013 7:34 pm
by DrewPalmer04
Cool. Didn't know. It looked simpler.
Mask relay off
Posted: Sat Jan 26, 2013 8:33 pm
by lnevo
What was wrong with the code i gave you coming out of feeding mode?
Re: Mask relay off
Posted: Sun Jan 27, 2013 1:14 pm
by Piper
What lnevo posted should work just fine. I used the same think to make my own "poor mans's" nutrient export mode with with Koralia powerheads. Is it not doing what you want it to do?
Code: Select all
// At the top where you define other globals set this:
boolean isFeeding = false;
Code: Select all
// Enable Feeding Mode flag
if (ReefAngel.DisplayedMenu==FEEDING_MODE) isFeeding=true;
// Here's what we do if we're just out of feeding mode...
if (ReefAngel.DisplayedMenu==DEFAULT_MENU && isFeeding) {
isFeeding=false;
ReefAngel.Relay.RelayMaskOff=~Port4Bit;
}
If you want to make it even easier you can just trigger it when you enter into feeding mode.
Code: Select all
// Turn off the skimmer when we go into feeding mode
if (ReefAngel.DisplayedMenu==FEEDING_MODE) ReefAngel.Relay.RelayMaskOff=~Port4Bit;
I just happen to leave my skimmer running when I'm in feeding mode but I shut off the main pump. The skimmer basically processes sump water during feeding mode.
Re: Mask relay off
Posted: Mon Jan 28, 2013 6:15 pm
by DrewPalmer04
Thanks! I'll use the second idea!!
Re: Mask relay off
Posted: Mon Jan 28, 2013 7:33 pm
by DrewPalmer04
It masked off ports 1-4 when ==feeding mode?
Re: Mask relay off
Posted: Mon Jan 28, 2013 7:35 pm
by DrewPalmer04
Piper wrote:
[/code]
If you want to make it even easier you can just trigger it when you enter into feeding mode.
Code: Select all
// Turn off the skimmer when we go into feeding mode
if (ReefAngel.DisplayedMenu==FEEDING_MODE) ReefAngel.Relay.RelayMaskOff=~Port4Bit;
I just happen to leave my skimmer running when I'm in feeding mode but I shut off the main pump. The skimmer basically processes sump water during feeding mode.
Used this.
Mask relay off
Posted: Mon Jan 28, 2013 7:36 pm
by lnevo
That syntax never worked for me which is why i use setbit/clearbit functions. Maybe roberto can chime in with the right syntax here. I would love to use the PortXBit variables this way instead too...
Re: Mask relay off
Posted: Mon Jan 28, 2013 7:46 pm
by DrewPalmer04
Yeah I'd prefer it too. The syntax above only applies mask from 1-4 during feeding mode then ends (for obvious reasons)
Re: Mask relay off
Posted: Mon Jan 28, 2013 7:59 pm
by DrewPalmer04
Until then. I'll just use the good ol iPhone app

Re: Mask relay off
Posted: Mon Jan 28, 2013 8:24 pm
by rimai
Feeding mode already applies a mask off.
All you need is this:
Code: Select all
ReefAngel.FeedingModePorts = Port4Bit;
Re: Mask relay off
Posted: Mon Jan 28, 2013 8:27 pm
by DrewPalmer04
I'm trying to find a way to have it permenarely mask off even when the feeding countdown reaches 0. This way I'll have control when I want to mask on the relay from my iPhone.
Re: Mask relay off
Posted: Mon Jan 28, 2013 8:32 pm
by rimai
You will need to create a variable that holds the state of the feeding mode and then when feeding mode changes, you apply the mask again.
The controller will always remove the mask on feeding mode exit, no matter what.
Re: Mask relay off
Posted: Mon Jan 28, 2013 8:45 pm
by DrewPalmer04
Ok thanks!