Page 1 of 1

Variable RF Speeds for stock modes

Posted: Thu Mar 14, 2013 11:49 am
by DrewPalmer04
I figured it would be worth mentioning that I've made a change (based on lnevo's tinkering).

It is possible to make your MP speeds variable instead of a set speed...even with stock modes.

This uses the ReefCrestMode() function that lnevo found.

I enjoy ShortWave (Short pulse) the most...but I wanted a way to vary the speed...so this is good for anyone who wants the same throughout the day.

Here's how I do it.
Before setup()

Code: Select all

// Default Mode
byte vtMode=ShortWave;
byte vtSpeed=30;
byte vtDuration=7;
//ReefCrest randomization int
int rcSpeed;
in loop()

Code: Select all

 
rcSpeed=ReefCrestMode(vtSpeed);

if (ReefAngel.PWM.GetActinicValue()<10) 
  {
    ReefAngel.RF.UseMemory=false;
    ReefAngel.RF.SetMode(Night,10,0);
  }
  else
  {
    if (ReefAngel.RF.Mode==Night) ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
    ReefAngel.RF.UseMemory=false;
    ReefAngel.RF.SetMode(vtMode, rcSpeed, vtDuration); //set RF normal ShortWave, new varying speed, normal duration
  }
After loop()

Code: Select all

byte ReefCrestMode(int s)
{
  static unsigned long lastmillis=millis();
  static int newspeed=s;
  if ((millis()-lastmillis) > 5000)
  {
    int delta;
    delta=random(20);
    if (delta<10) newspeed--; 
    else newspeed++;
    newspeed=constrain(newspeed,s-10,s+10); //allows -10 or +10 speed increase or decrease
    newspeed=constrain(newspeed,0,100);
    lastmillis=millis();
  }  
  return newspeed;
}
So now the stock ShortWave will stay on my normal duration but the speed can go + or - 10 (of 30) throughout the day! :)

View how it looks here:
http://forum.reefangel.com/status/chart ... filter=rfs

Re: Variable RF Speeds for stock modes

Posted: Thu Mar 14, 2013 12:48 pm
by lnevo
The credit is to Roberto for writing the ReefCrestMode function.

Re: Variable RF Speeds for stock modes

Posted: Thu Mar 14, 2013 1:15 pm
by DrewPalmer04
lnevo wrote:The credit is to Roberto for writing the ReefCrestMode function.

Fair enough...credit to ANYONE involved :) haha