Wave patterns

Related to the development libraries, released by Curt Binder
ReeferBee
Posts: 55
Joined: Wed May 08, 2013 6:23 pm
Location: North GA

Re: Wave patterns

Post by ReeferBee »

tomek77pl wrote:Hi Is it possible to have a both wave patters for one pump? I want it to run nutrition export for 2 hrs a day then go back into the reef crest mode. Is this possible? If yes how can this be done? Thanks :)

Yep you can. Which wave patterns are you trying to run, and at what times?

Here's an example. I have different modes run throughout the day.

Code: Select all

if (hour()>=8 && hour()<11)
{
  vtechmode=6;
  ReefAngel.PWM.SetDaylight( TidalSwellMode(40,true) ); // Tidal Swell at 40% on sync mode
  ReefAngel.PWM.SetActinic( TidalSwellMode(40,false) ); // Tidal Swell at 40% on anti-sync mode
}
else if (hour()>=11 && hour()<12)
{
  vtechmode=2;
  ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(50,20,false) ); // ReefCrest at 50% + - 20 on anti-sync mode
}
else if (hour()>=12 && hour()<13)
{
  vtechmode=0;
  ReefAngel.PWM.SetDaylight( millis()%1000>800?80:0); // WaveMode on sync mode
  ReefAngel.PWM.SetActinic( ElseMode(70,30,true) ); // ElseMode at 70  on anti-sync mode
}
else if (hour()>=13 && hour()<14)
{
  vtechmode=2;
  ReefAngel.PWM.SetDaylight( ReefCrestMode(70,20,true) ); // ReefCrest at 70% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(70,20,false) ); // ReefCrest at 70% + - 20 on anti-sync mode
}  
else if (hour()>=15 && hour()<18)
{
  vtechmode=0;
  ReefAngel.PWM.SetDaylight( ElseMode(70,30,true) ); // Else on sync mode
  ReefAngel.PWM.SetActinic( millis()%1000>800?80:0); // Wave on anti-sync mode
}
else if (hour()>=18 && hour()<21)
{
  vtechmode=5;
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); // Nutrient Transport on sync mode
  ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,false) ); //   Nutrient Transport on anti-sync mode
}
else if (hour()>=21 && hour()<24)
{
  vtechmode=1;
  ReefAngel.PWM.SetDaylight( millis()%1000>800?70:0); // Wave on sync mode
  ReefAngel.PWM.SetActinic( ElseMode(70,30,true) ); // Else on anti-sync mode
}
else
{
  vtechmode=4;
  ReefAngel.PWM.SetDaylight( LongPulseMode(40,40,10,true) ); // Long pulse at 40% with 10s pulse on syncy mode
  ReefAngel.PWM.SetActinic( LongPulseMode(40,40,10,false) ); // Long pulse at 40% with 10s pulse on on anti-sync mode
} 

 if (ReefAngel.DisplayedMenu==FEEDING_MODE)
  {
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.PWM.SetDaylight(0);
  }
  if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE)
  {
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.PWM.SetDaylight(0);
  }
Barry

Current tank info: 150g mixed reef

"Some of the worst mistakes of my life were hair cuts" -Jim Morrison
tomek77pl
Posts: 21
Joined: Sun Jun 09, 2013 3:17 pm

Re: Wave patterns

Post by tomek77pl »

Lets say I want nutrition export to run from 4pm-6pm and reef crest to run the remaining 22 hrs. This is for the jeabo pump.
ReeferBee
Posts: 55
Joined: Wed May 08, 2013 6:23 pm
Location: North GA

Re: Wave patterns

Post by ReeferBee »

Try this, although Nutrient export needs to be ran 2.5 hours to complete the mode.

Code: Select all

if (hour()>=16 && hour()<18)
{
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); //  Nutrient Transport on sync mode
  ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,false) ); // Nutrient Transport on anti-sync mode
}
else if (hour()>=18 && hour()<16)
{
  ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(50,20,false) ); // ReefCrest at 50% + - 20 on anti-sync mode
}
You can change the values of the modes too, if its too much flow
Last edited by ReeferBee on Sun Jun 30, 2013 8:20 pm, edited 1 time in total.
Barry

Current tank info: 150g mixed reef

"Some of the worst mistakes of my life were hair cuts" -Jim Morrison
tomek77pl
Posts: 21
Joined: Sun Jun 09, 2013 3:17 pm

Re: Wave patterns

Post by tomek77pl »

Thank you!!! I just made it for 3 hrs instead of 2 so at least it finished one cycle of nutrition export.
AnesthDoc
Posts: 17
Joined: Mon Dec 09, 2013 8:08 am

Re: Wave patterns

Post by AnesthDoc »

Barry,
A question for you.
I am just beginning to learn the arduino language and at the moment only using the Wizard for the basic settings.

If I want to use your wave pattern code (different waves throughout the day), I understand I will have to cut and paste the code in the wizard where it says "your custom code goes below this line" but do I need to remove any lines from the wizard code or make any other changes?

I recall a similar situation where a member suggested to remove a code line before using a custom wave pattern code.
Appreciate your help.
AnesthDoc
Posts: 17
Joined: Mon Dec 09, 2013 8:08 am

Re: Wave patterns

Post by AnesthDoc »

Can someone else help me?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Wave patterns

Post by rimai »

Did you try to use the code he posted?
Roberto.
ReEfnWrX
Posts: 234
Joined: Tue Nov 05, 2013 8:40 am
Location: Houston TX

Re: Wave patterns

Post by ReEfnWrX »

Anesthdoc,

His code states specific times during the day, and what wave pattern runs during those times. The first line is an if statement everything following that for different times is an else if statement.

Code: Select all

if (hour()>=16 && hour()<18)
{
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); //  Nutrient Transport on sync mode
  ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,false) ); // Nutrient Transport on anti-sync mode
}
else if (hour()>=18 && hour()<16)
{
  ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(50,20,false) ); // ReefCrest at 50% + - 20 on anti-sync mode
}
Add as many else if statements as you want. Make sure the times don't overlap. Also, he made a mistake in his code. For the last code in the day, let's say you want it to run between 11pm and 8 am you would use || (or) instead of && (and). the time cannot be greater than 11pm and less than 2am as the RA logic only views a 24 hour time period. So you would use

Code: Select all

else if (hour()>=18 || hour()<16)
Also, I find it easier to always use >= and always use just < by itself.

if you want to add in minutes you could do this

Code: Select all

if ((hour()>=18 && minute()>=30) || (hour()<16 && minute()==0)) // >=6:30pm ||(OR) <4:00pm
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Wave patterns

Post by lnevo »

That last example with minute() will not work. It will only cover 18:30-18:59 then 19:30-19:59 and so on. Or you'll need another || hour()>=19
ReEfnWrX
Posts: 234
Joined: Tue Nov 05, 2013 8:40 am
Location: Houston TX

Re: Wave patterns

Post by ReEfnWrX »

Good catch, I wrote that real quick off the top of my head. I just looked at my old code and I did have the additional || hour()
Image
AnesthDoc
Posts: 17
Joined: Mon Dec 09, 2013 8:08 am

Re: Wave patterns

Post by AnesthDoc »

Great,
Appreciate your help.
ReEfnWrX
Posts: 234
Joined: Tue Nov 05, 2013 8:40 am
Location: Houston TX

Re: Wave patterns

Post by ReEfnWrX »

anesthdoc,

Due to Lnevo's recommendations a while back I actually switched to using seconds to define time which simplifies the coding.

instead of

Code: Select all

if (hour()>=10 && hour()<20)
do hour * 3600 (60 minutes * 60 seconds)

Code: Select all

if (now()%SECS_PER_DAY>=36000 && now()%SECS_PER_DAY<72000)
Image
Ademster
Posts: 144
Joined: Tue Aug 14, 2012 1:11 pm

Re: Wave patterns

Post by Ademster »

ReeferBee wrote:
tomek77pl wrote:Hi Is it possible to have a both wave patters for one pump? I want it to run nutrition export for 2 hrs a day then go back into the reef crest mode. Is this possible? If yes how can this be done? Thanks :)

Yep you can. Which wave patterns are you trying to run, and at what times?

Here's an example. I have different modes run throughout the day.

Code: Select all

if (hour()>=8 && hour()<11)
{
  vtechmode=6;
  ReefAngel.PWM.SetDaylight( TidalSwellMode(40,true) ); // Tidal Swell at 40% on sync mode
  ReefAngel.PWM.SetActinic( TidalSwellMode(40,false) ); // Tidal Swell at 40% on anti-sync mode
}
else if (hour()>=11 && hour()<12)
{
  vtechmode=2;
  ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(50,20,false) ); // ReefCrest at 50% + - 20 on anti-sync mode
}
else if (hour()>=12 && hour()<13)
{
  vtechmode=0;
  ReefAngel.PWM.SetDaylight( millis()%1000>800?80:0); // WaveMode on sync mode
  ReefAngel.PWM.SetActinic( ElseMode(70,30,true) ); // ElseMode at 70  on anti-sync mode
}
else if (hour()>=13 && hour()<14)
{
  vtechmode=2;
  ReefAngel.PWM.SetDaylight( ReefCrestMode(70,20,true) ); // ReefCrest at 70% + - 20 on sync mode
  ReefAngel.PWM.SetActinic( ReefCrestMode(70,20,false) ); // ReefCrest at 70% + - 20 on anti-sync mode
}  
else if (hour()>=15 && hour()<18)
{
  vtechmode=0;
  ReefAngel.PWM.SetDaylight( ElseMode(70,30,true) ); // Else on sync mode
  ReefAngel.PWM.SetActinic( millis()%1000>800?80:0); // Wave on anti-sync mode
}
else if (hour()>=18 && hour()<21)
{
  vtechmode=5;
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); // Nutrient Transport on sync mode
  ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,false) ); //   Nutrient Transport on anti-sync mode
}
else if (hour()>=21 && hour()<24)
{
  vtechmode=1;
  ReefAngel.PWM.SetDaylight( millis()%1000>800?70:0); // Wave on sync mode
  ReefAngel.PWM.SetActinic( ElseMode(70,30,true) ); // Else on anti-sync mode
}
else
{
  vtechmode=4;
  ReefAngel.PWM.SetDaylight( LongPulseMode(40,40,10,true) ); // Long pulse at 40% with 10s pulse on syncy mode
  ReefAngel.PWM.SetActinic( LongPulseMode(40,40,10,false) ); // Long pulse at 40% with 10s pulse on on anti-sync mode
} 

 if (ReefAngel.DisplayedMenu==FEEDING_MODE)
  {
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.PWM.SetDaylight(0);
  }
  if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE)
  {
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.PWM.SetDaylight(0);
  }


I tried Using this code to test it out see how I like it. but I get an error vtechmode was not declared in this scope. I am using a single jaebo wp-10. I am going to use it on the daylight channel. I deleted all actinic code. but with or with out deleting the actinic channel the error happens.
Adam
58 Gal
Image
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Wave patterns

Post by Piper »

Get rid of the vtechmode variable in the code you posted. You didn't post your full code so I'm just guessing here but I'm betting you're not using the vtechmode mode anywhere as you haven't defined it.

If that doesn't help, post your full code to better assist you.

~Charlie
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

The vtechmode is just an int. You can declare it like this

Code: Select all

int vtechmode;
You can put this in between the comments for global variables. This can now be used if you have a DrawCustomMain() function so you can display what mode your in...

Or as Piper suggested you can just remove the lines that have vtechmode (or comment them)
Ademster
Posts: 144
Joined: Tue Aug 14, 2012 1:11 pm

Re: Wave patterns

Post by Ademster »

I haven't uploaded to this code yet, but this is what I want to use. but eliminate all of the actinic code. I am only using one pump at the moment. I will probably buy another wp-10 soon...

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port2Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );
    ReefAngel.Relay.On( Port8 );
    ReefAngel.Relay.On( Box1_Port1 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.Relay.DelayedOn( Port2 );
    ReefAngel.StandardHeater( Port3 );
    ReefAngel.Wavemaker1( Port5 );
    ReefAngel.StandardATO( Box1_Port2 );
    ReefAngel.CO2Control( Box1_Port3 );
    ReefAngel.PHControl( Box1_Port4 );
    ReefAngel.PWM.Channel0PWMSlope();
    ReefAngel.PWM.Channel1PWMSlope();
    ReefAngel.PWM.Channel2PWMSlope();
    ReefAngel.PWM.Channel3PWMSlope();
    ReefAngel.DCPump.UseMemory = true;
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = None;
    ReefAngel.DCPump.ExpansionChannel[0] = None;
    ReefAngel.DCPump.ExpansionChannel[1] = None;
    ReefAngel.DCPump.ExpansionChannel[2] = None;
    ReefAngel.DCPump.ExpansionChannel[3] = None;
    ReefAngel.DCPump.ExpansionChannel[4] = None;
    ReefAngel.DCPump.ExpansionChannel[5] = None;
    ////// Place your custom code below here
        if (hour()>=8 && hour()<11)
    {
      vtechmode=6;
      ReefAngel.PWM.SetDaylight( TidalSwellMode(40,true) ); // Tidal Swell at 40% on sync mode
     }
    else if (hour()>=11 && hour()<12)
    {
      vtechmode=2;
      ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
    
    }
    else if (hour()>=12 && hour()<13)
    {
      vtechmode=0;
      ReefAngel.PWM.SetDaylight( millis()%1000>800?80:0); // WaveMode on sync mode
    
    }
    else if (hour()>=13 && hour()<14)
    {
      vtechmode=2;
      ReefAngel.PWM.SetDaylight( ReefCrestMode(70,20,true) ); // ReefCrest at 70% + - 20 on sync mode
     
    } 
    else if (hour()>=15 && hour()<18)
    {
      vtechmode=0;
      ReefAngel.PWM.SetDaylight( ElseMode(70,30,true) ); // Else on sync mode
     
    }
    else if (hour()>=18 && hour()<21)
    {
      vtechmode=5;
      ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); // Nutrient Transport on sync mode
      
    }
    else if (hour()>=21 && hour()<24)
    {
      vtechmode=1;
      ReefAngel.PWM.SetDaylight( millis()%1000>800?70:0); // Wave on sync mode
     
    }
    else
    {
      vtechmode=4;
      ReefAngel.PWM.SetDaylight( LongPulseMode(40,40,10,true) ); // Long pulse at 40% with 10s pulse on syncy mode
     
    }
     if (ReefAngel.DisplayedMenu==FEEDING_MODE)
      {
                ReefAngel.PWM.SetDaylight(0);
      }
      if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE)
      {
               ReefAngel.PWM.SetDaylight(0);
      }


    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "ademster" );
    ReefAngel.ShowInterface();
}

Adam
58 Gal
Image
Piper
Posts: 296
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA

Re: Wave patterns

Post by Piper »

Try this code if you haven't already got this sorted out. I did not test it but it should compile OK.

Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
  // This must be the first line
  ReefAngel.Init();  //Initialize controller
  ReefAngel.Use2014Screen();  // Let's use 2014 Screen
  ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
  ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port1Bit | Port2Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = 0;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port3Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;

  // Feeding and Water Change mode speed
  ReefAngel.DCPump.FeedingSpeed=0;
  ReefAngel.DCPump.WaterChangeSpeed=0;


  // Ports that are always on
  ReefAngel.Relay.On( Port1 );
  ReefAngel.Relay.On( Port4 );
  ReefAngel.Relay.On( Port6 );
  ReefAngel.Relay.On( Port7 );
  ReefAngel.Relay.On( Port8 );
  ReefAngel.Relay.On( Box1_Port1 );

  ////// Place additional initialization code below here
  

  ////// Place additional initialization code above here
}

void loop() {
  ReefAngel.Relay.DelayedOn( Port2 );
  ReefAngel.StandardHeater( Port3 );
  ReefAngel.Wavemaker1( Port5 );
  ReefAngel.StandardATO( Box1_Port2 );
  ReefAngel.CO2Control( Box1_Port3 );
  ReefAngel.PHControl( Box1_Port4 );
  ReefAngel.PWM.Channel0PWMSlope();
  ReefAngel.PWM.Channel1PWMSlope();
  ReefAngel.PWM.Channel2PWMSlope();
  ReefAngel.PWM.Channel3PWMSlope();
  ReefAngel.DCPump.UseMemory = true;
  ReefAngel.DCPump.DaylightChannel = Sync;
  ReefAngel.DCPump.ActinicChannel = None;
  ReefAngel.DCPump.ExpansionChannel[0] = None;
  ReefAngel.DCPump.ExpansionChannel[1] = None;
  ReefAngel.DCPump.ExpansionChannel[2] = None;
  ReefAngel.DCPump.ExpansionChannel[3] = None;
  ReefAngel.DCPump.ExpansionChannel[4] = None;
  ReefAngel.DCPump.ExpansionChannel[5] = None;
  ////// Place your custom code below here
  if (hour()>=8 && hour()<11) {
    ReefAngel.PWM.SetDaylight( TidalSwellMode(40,true) ); // Tidal Swell at 40% on sync mode
  }
  else if (hour()>=11 && hour()<12) {
    ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
  }
  else if (hour()>=12 && hour()<13) {
    ReefAngel.PWM.SetDaylight( millis()%1000>800?80:0); // WaveMode on sync mode
  }
  else if (hour()>=13 && hour()<14) {
    ReefAngel.PWM.SetDaylight( ReefCrestMode(70,20,true) ); // ReefCrest at 70% + - 20 on sync mode
  }
  else if (hour()>=15 && hour()<18) {
    ReefAngel.PWM.SetDaylight( ElseMode(70,30,true) ); // Else on sync mode
  }
  else if (hour()>=18 && hour()<21) {
    ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); // Nutrient Transport on sync mode
  }
  else if (hour()>=21 && hour()<24) {
    ReefAngel.PWM.SetDaylight( millis()%1000>800?70:0); // Wave on sync mode
  }
  else {
    ReefAngel.PWM.SetDaylight( LongPulseMode(40,40,10,true) ); // Long pulse at 40% with 10s pulse on sync mode
  }

  if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
    ReefAngel.PWM.SetDaylight(0);
  }
  if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
    ReefAngel.PWM.SetDaylight(0);
  }

  ////// Place your custom code above here

  // This should always be the last line
  ReefAngel.Portal("ademster");
  ReefAngel.ShowInterface();
}
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Wave patterns

Post by AlanM »

I'm making some changes to Globals.cpp, and I'm tempted to change ReefCrest, NutrientTransport and the rest to return a speed constrained to x=0 or 30<x<=100 because I'm running the Tunze and Jebao pumps on it.

This would let them go to 0 when called for, but would just round down to 0 at speed values of 15 or less and up to 30 at values of 15 or more.

What does anyone think of this?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

You could wrap it in a map function. I would put the constraint functionality into the dcpump class. I've also been meaning to add a factor in for each channel so you could change the threshold for different styles of pumps.
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Wave patterns

Post by AlanM »

OK. Since I'd thought about it as a kind of coarse rounding for values below 30 I was going to do it like this in the Globals.cpp functions. The point about different thresholds for different pumps is a good one. I had heard that Tunze and Jebao were all 30. I don't know any other models for those thresholds. Are there others?

Code: Select all

	if (PulseSync)
	{
		if (speed <= 15) 
		{
			return = 0;
		}
		else if ((speed > 15) && (speed < 30)) 
		{
			return 30;
		}
		else
		{
			return speed;
		}
	}
	else
	{
		if (anti_speed <= 15) 
		{
			return = 0;
		}
		else if ((anti_speed > 15) && (anti_speed < 30)) 
		{
			return 30;
		}
		else
		{
			return anti_speed;
		}
	
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

But I'm using those functions with my Vortech or someone may want to use it with leds or something we havent tbought of. Plus the thresholds on some jaebo is 20 something.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

Thats why doing it in the class where you can persistently define what is the threshold and doing the remapping there instead of in the global generic function.
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Wave patterns

Post by AlanM »

Ah, got it. I didn't realize that people were directly driving their vortech speeds with the RA. I figured you'd just tell the WES controller to flip you to a different mode with given parameters.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

I could but i could also use one of the RA modes or custom functions like ElseMode and one the bhazard did that I setup as custom functions. I can also do each channel individually letting me change which pump is sync anti sync on the fly. I also added an offset so I can change the power level of the anti sync pump.
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Wave patterns

Post by AlanM »

OK, so if I added in a Threshold value in DCPump.cpp (and .h of course) for each possible pump, Daylight, Actinic, LowATO, 6 Expansions, and 16 extra Expansions, I would have to look for those thresholds in the ReefAngel.cpp and constrain what the calls to the wave modes give out when calling the SetDaylight, SetChannel, etc. methods. I'd probably add a function in Globals that returns 0 or threshold->max when given a value and just call that one each time.

I understand that the values set in DCPump.DaylightChannnel are booleans that are Sync or AntiSync, so 0 or 1, and I see that each call in ReefAngel.cpp subtracts one from those values, what is the -1 for in those calls to wave modes?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

I think because sync is 1 and anti sync is 2 and therefore the -1 brings it to 0 and 1 which correspond to true/false

Btw roberto not sure bools actually save any space as i think arduino stores bools as a byte...
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Wave patterns

Post by AlanM »

I submitted a pull request to include my PWM profile and also ElseMode since lots of people are using it. However, I see that in the ReefAngel.cpp there is a switch statement that figures out the different modes set in the DCPump classes. Where are those modes defined? I can't find them. In the process of prowling more code I'm finding more dependencies in different places.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

The modes are defined in the Globals.h

The case statements match the "Vortech" modes that are listed in the Portal. For any new modes, you'd use the "Custom" mode that's defined in the portal and then handle the condition in your INO.
AlanM
Posts: 263
Joined: Wed Jan 01, 2014 7:26 am

Re: Wave patterns

Post by AlanM »

Oh really? OK. I get it, I think.

Sounds like adding ElseMode to the DCPump class is a bit more complicated than just including it in that switch/case statement because it wouldn't work to just make a #define ElseMode 7 line in there. I'd leave ElseMode out of my copy of ReefAngel.cpp and DCPump.Mode until figuring it out.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

Yeah, find the modes that are defined in Globals.h because the first available may not be until after 11 or 12... I think there are some that apply to the Radions. Not sure that's really a conflict. I dont' think there's anythign that would prevent it from being added into the code, except that if we wanted to advertise the support for it, it would need to be added in the portal. That's really a chicken and the egg discussion though... but if you build it they will come.. so they say ;)
Post Reply