Variable RF Speeds for stock modes

Related to the development libraries, released by Curt Binder
Post Reply
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Variable RF Speeds for stock modes

Post 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
Last edited by DrewPalmer04 on Thu Mar 14, 2013 8:33 pm, edited 1 time in total.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Variable RF Speeds for stock modes

Post by lnevo »

The credit is to Roberto for writing the ReefCrestMode function.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Variable RF Speeds for stock modes

Post by DrewPalmer04 »

lnevo wrote:The credit is to Roberto for writing the ReefCrestMode function.

Fair enough...credit to ANYONE involved :) haha
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
Post Reply