RF and Feeding Mode

Expansion modules and attachments
Post Reply
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

RF and Feeding Mode

Post by Deckoz2302 »

For a custom menu to change modes after feed would it be something like

reefangel.feedmodestart()
Wdt reset
Set timer 30 min
If wdt >1
Reefangel.rf.usememory=false
Reefangel.rf.setmode(ntm,150,35)

Else
Reefangel.rf.usememory=true


I know it looks sloppy just trying to get an idea(typing on phone)
Also would you use the global variable I think its like 857(vortech mode) to display mode on main screen
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

Not sure I understand what you are trying to accomplish.
The RA has a feeding mode built-in and it will put the vortechs on feeding mode too all by itself without the need of programming.
Yes, you can use the internal memory 855 for that.
Roberto.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

When I feed I power the vortechs down completely by relays so I can spot feed and not worry about using a bottle to contain the food around coral mandarins. After feed mode ends I manually put the vortechs in nutrient transport for 30-45 min to stir the uneaten food up to go out my overflow to be fed to my refugium. Basically I want to automate this. Feed mode > end feed mode vortech nutrient transport for 30min > back to reefcrest. I think I would have to reset the watchdog timer after feedmode is over since it uses it and give it a new countdown and as long as the timer is above 1 second the vortechs are in nutrient transport, hit 0 and it uses internal memory? Maybe I'm looking at this the wrong way
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF and Feeding Mode

Post by rimai »

I think you can do it by using a variable to find out when feeding mode has ended and act when it did.
Something like this:
Declare a new boolean variable above setup():

Code: Select all

boolean bFeeding=false;
Then, monitor the variable ReefAngel.DisplayedMenu and use Timer[4] to trigger RF back to internal memory settings:

Code: Select all

  if (ReefAngel.DisplayedMenu==FEEDING_MODE) bFeeding=true;
  if (ReefAngel.DisplayedMenu==DEFAULT_MENU && bFeeding)
  {
    bFeeding=false; 
    ReefAngel.Timer[4].SetInterval(1800); // Timer for 30min
    ReefAngel.Timer[4].Start();
    ReefAngel.RF.UseMemory=false;
    ReefAngel.RF.SetMode(Smart_NTM,170,6);
  }

  if (ReefAngel.Timer[4].IsTriggered())
  {
    ReefAngel.RF.UseMemory=true;
  }
Let me know if it works.
Roberto.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF and Feeding Mode

Post by Deckoz2302 »

That makes more sense then what I was gonna try to do...why do I always avoid boolean statements they're so useful lol. Ill test it when I get off work thanks for your help as always roberto, you are the reef angel masta :P
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF and Feeding Mode

Post by Deckoz2302 »

hmm, this worked for the first day - now it doesnt :\
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF and Feeding Mode

Post by rimai »

Is it changing to NTM?
Roberto.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF and Feeding Mode

Post by Deckoz2302 »

Nope :\ the only thing I've added to it is adding vtechmode global var for display on main screen

Code: Select all

  if (ReefAngel.DisplayedMenu==FEEDING_MODE) bFeeding=true;
  if (ReefAngel.DisplayedMenu==DEFAULT_MENU && bFeeding)
  {
    bFeeding=false; 
    ReefAngel.Timer[4].SetInterval(1800); // Timer for 30min
    ReefAngel.Timer[4].Start();
    ReefAngel.RF.UseMemory=false;
    ReefAngel.RF.SetMode(Smart_NTM,155,5);
    vtechmode = 5;
  }
  if (ReefAngel.Timer[4].IsTriggered())
  {
    ReefAngel.RF.UseMemory=true;
    vtechmode = InternalMemory.RFMode_read();
  }
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF and Feeding Mode

Post by rimai »

Do you have any other part of the code where you change modes?
Roberto.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF and Feeding Mode

Post by Deckoz2302 »

Code: Select all

if (ReefAngel.DisplayedMenu==FEEDING_MODE) bFeeding=true;
  if (ReefAngel.DisplayedMenu==DEFAULT_MENU && bFeeding)
  {
    bFeeding=false; 
    ReefAngel.Timer[4].SetInterval(1800); // Timer for 30min
    ReefAngel.Timer[4].Start();
    ReefAngel.RF.UseMemory=false;
    ReefAngel.RF.SetMode(Smart_NTM,155,5);
    vtechmode = 5;
  }
  if (ReefAngel.Timer[4].IsTriggered())
  {
    ReefAngel.RF.UseMemory=true;
    vtechmode = InternalMemory.RFMode_read();
  }

  if ( hour() <= 6 || hour () >= 19 ) // Moonlights on from 7PM to 7AM
  {
    ReefAngel.PWM.SetActinic(MoonPhase());
    ReefAngel.RF.UseMemory=false;
    ReefAngel.RF.SetMode(Night,15,0);
    vtechmode = 9;
  }
  else
  {
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.RF.UseMemory=true;
    vtechmode = InternalMemory.RFMode_read();
  }
I guess I could merge them
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF and Feeding Mode

Post by rimai »

That's the problem.
You are assigning UseMemory=false when the feeding ends, but the botttom statement puts it back to true when its between 6 and 19hrs.
Roberto.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF and Feeding Mode

Post by Deckoz2302 »

You mean when its not between 6 and 19? the two shouldnt interfere with each other because I dont feed when its night. and they both revert to using memory=true if its not night or not feeding...uh
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF and Feeding Mode

Post by rimai »

Either way.
If it is between 6 and 19, you assign true and when it's not, you assign false and night mode.
So, either choice just override whatever it was previously assigned.
If you want the feeding with higher priority over the night more check, place the feeding code after the night mode check.
Whichever is the latest is the one that will take effect.
The other way is to merge them all, like you said, so there is always just one path to go.
Roberto.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF and Feeding Mode

Post by Deckoz2302 »

Gotta work on the merge, one after the other either way doesn't work. and I obviously need to take a lesson in multidimensional if/else structures because I've tried like 3 or 4 different ways of doing this and its blah
Post Reply