Page 1 of 5
My Jebao "Else" mode
Posted: Tue Jun 25, 2013 12:30 pm
by cosmith71
UPDATE: Sync and anti-sync added. Someone please test for me as I only have one pump.
I really like the "Else" mode on the Jebao stock controller. It has lots of swings with a wide range of speeds. It's not truly random, but a long, complex sequence. My version is more random.
Call with ElseMode( MidPoint, Offset, Sync );
Where Midpoint is the middle of the range you want, and Offset is the +/- range. Sync and anti-sync are opposites (true for sync or false for anti-sync) For example, ElseMode ( 70, 30, true ) will return values from 40% to 100%. The speed changes every 0.5 to 5 seconds and can be anywhere in between MidPoint +/- Offset.
Code: Select all
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}
--Colin
Re: My Jebao "Else" mode
Posted: Tue Jun 25, 2013 4:56 pm
by avionixx
Nice! I can't wait to try this later!
Re: My Jebao "Else" mode
Posted: Tue Jun 25, 2013 7:26 pm
by jjdezek
is there anything you have to change to make it work? i copied and pasted it into the place custom code here and it gave an error on the first {
Re: My Jebao "Else" mode
Posted: Tue Jun 25, 2013 7:29 pm
by cosmith71
Put it at the very end of everything, past and outside of loop(). Then call like any other wave function.
Re: My Jebao "Else" mode
Posted: Tue Jun 25, 2013 7:37 pm
by jjdezek
can i set it up to be the custom setting under the portal?
Re: My Jebao "Else" mode
Posted: Tue Jun 25, 2013 7:40 pm
by cosmith71
I think so. I don't have WiFi on this tank so I can't test it.
Sent from my M470BSA using Tapatalk 4 Beta
Re: My Jebao "Else" mode
Posted: Tue Jun 25, 2013 7:43 pm
by jjdezek
how would i go about trying that? the last custom code for the jeabo i had to put into the place custom code here and when i selected custom on the portal it would use that code. would i just put some call code in the place custom code here?
Re: My Jebao "Else" mode
Posted: Tue Jun 25, 2013 8:05 pm
by cosmith71
Post your old code that worked before.
Sent from my M470BSA using Tapatalk 4 Beta
Re: My Jebao "Else" mode
Posted: Tue Jun 25, 2013 10:29 pm
by ReeferBee
Thank you! Can't wait to try it out.
Re: My Jebao "Else" mode
Posted: Wed Jun 26, 2013 5:21 am
by jjdezek
this is what im using right now.
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
#define NUMBERS_8x16
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
ReefAngel.LCD.DrawText(COLOR_INDIGO, COLOR_WHITE,25,5, "Jeremy's Reef");
pingSerial();
DrawStatus (20,80);
DrawParams (5,40);
DrawParamsa (0,10);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port7Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 800 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1,60 );
ReefAngel.StandardLights( Port3,18,0,10,0 );
ReefAngel.Wavemaker( Port5,60 );
ReefAngel.Wavemaker( Port6,60 );
ReefAngel.StandardHeater( Port7,751,761 );
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = Sync;
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 (ReefAngel.DCPump.Mode==Custom)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(50,100,2000,true) ); // Nutrient Transport on sync mode
ReefAngel.PWM.SetActinic( NutrientTransportMode(50,100,2000,false) ); // Nutrient Transport on anti-sync mode
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "jjdezek" );
ReefAngel.ShowInterface();
}
void DrawParamsa(int x, int y){
char buf[16];
ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x+40,y+10,"WP40L:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1);
ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+40,y+20,"WP40R:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x+78, y+20,1);
}
void DrawParams(int x, int y) {
char buf[16];
ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+5,y,"Temp:");
ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+80, y, "PH:");
// Temp and PH
y+=10;
ConvertNumToString(buf, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawLargeText(T1TempColor, DefaultBGColor, x+5, y, buf, Num8x16);
ConvertNumToString(buf, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+80, y, buf, Num8x16);
y+=5;
}
void DrawStatus(int x, int y) {
int t=x;
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,15,y,"High",Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,85,y,"Low",Font8x16);
if (ReefAngel.HighATO.IsActive()) {
ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_GREEN);
} else {
ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_RED);
}
if (ReefAngel.LowATO.IsActive()) {
ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_GREEN);
} else {
ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_RED);
}
}
void DrawCustomGraph()
{
}
Re: My Jebao "Else" mode
Posted: Wed Jun 26, 2013 6:36 am
by cosmith71
jjdezek wrote:this is what im using right now.
Try this:
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
#define NUMBERS_8x16
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
ReefAngel.LCD.DrawText(COLOR_INDIGO, COLOR_WHITE,25,5, "Jeremy's Reef");
pingSerial();
DrawStatus (20,80);
DrawParams (5,40);
DrawParamsa (0,10);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port7Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 800 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1,60 );
ReefAngel.StandardLights( Port3,18,0,10,0 );
ReefAngel.Wavemaker( Port5,60 );
ReefAngel.Wavemaker( Port6,60 );
ReefAngel.StandardHeater( Port7,751,761 );
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = Sync;
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 (ReefAngel.DCPump.Mode==Custom)
{
ReefAngel.PWM.SetDaylight( ElseMode(70,30,true )); // ElseMode on sync mode, 70 +/- 30%
ReefAngel.PWM.SetActinic( ElseMode(70,30,false )); // ElseMode on anti-sync mode, 70 +/- 30%
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "jjdezek" );
ReefAngel.ShowInterface();
}
void DrawParamsa(int x, int y){
char buf[16];
ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x+40,y+10,"WP40L:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1);
ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+40,y+20,"WP40R:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x+78, y+20,1);
}
void DrawParams(int x, int y) {
char buf[16];
ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+5,y,"Temp:");
ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+80, y, "PH:");
// Temp and PH
y+=10;
ConvertNumToString(buf, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawLargeText(T1TempColor, DefaultBGColor, x+5, y, buf, Num8x16);
ConvertNumToString(buf, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+80, y, buf, Num8x16);
y+=5;
}
void DrawStatus(int x, int y) {
int t=x;
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,15,y,"High",Font8x16);
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,85,y,"Low",Font8x16);
if (ReefAngel.HighATO.IsActive()) {
ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_GREEN);
} else {
ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_RED);
}
if (ReefAngel.LowATO.IsActive()) {
ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_GREEN);
} else {
ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_RED);
}
}
void DrawCustomGraph()
{
}
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}
Re: My Jebao "Else" mode
Posted: Wed Jun 26, 2013 6:49 am
by jjdezek
cool thanks for the help. got it working.
Re: My Jebao "Else" mode
Posted: Wed Jun 26, 2013 1:04 pm
by bhazard
Can't wait to try it. A good else mode is the only thing missing for the Jebao pumps. ELSE and W1 were the only two modes I used.
Re: My Jebao "Else" mode
Posted: Wed Jun 26, 2013 8:47 pm
by bhazard
Ok, I really like this one. Its very close to ELSE and more random.
Re: My Jebao "Else" mode
Posted: Thu Jun 27, 2013 12:44 pm
by Smotz
Thanks for this - I will try soon!
Re: My Jebao "Else" mode
Posted: Thu Jun 27, 2013 1:41 pm
by Sacohen
Thanks Collin.
I'm going to try this over the weekend.
Re: My Jebao "Else" mode
Posted: Thu Jun 27, 2013 3:04 pm
by cosmith71
Glad you guys like it!
Sent from my HTC One X using Tapatalk 4 Beta
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 8:56 am
by lnevo
Added to my random rotation
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 4:48 pm
by Sacohen
Collin;
Can this code work properly with just 1 pump?
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 5:33 pm
by jjdezek
that's all I have is one pump and it seems to work fine. just don't have anything plugged into the actinic port.
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 5:37 pm
by Sacohen
Thanks;
I just tried it and it seemed to stay at 20%.
Code: Select all
if (ReefAngel.DCPump.Mode==Custom)
{
ReefAngel.PWM.SetActinic( ElseMode(60,20,true )); // ElseMode on sync mode, 60 +/- 20%
}
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 5:47 pm
by rimai
Do you have any lights port overridden?
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 6:10 pm
by Sacohen
No I did not.
I have currently switched my code back to what was working, but at the time there were no overridden lights or anything out of the norm.
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 6:31 pm
by cosmith71
Sacohen wrote:Collin;
Can this code work properly with just 1 pump?
Yep. I use it with a single pump. I have no idea why it wouldn't work for you. Should be fairly straightforward.
--Colin
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 7:07 pm
by lnevo
You need to do ReefAngel.DCPump.UseMemory=false; and then set it back to true when its not custom mode.
Re: My Jebao "Else" mode
Posted: Sat Jun 29, 2013 7:09 pm
by lnevo
Nevermind, no you don't.. I just re-read what you said.
Can you post your code.. Your probably overriding it somewhere...
Re: My Jebao "Else" mode
Posted: Sun Jun 30, 2013 4:45 am
by Sacohen
Here you go...
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
unsigned long ATOUpdate=0;
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port4Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
// Use T2 probe as temperature and overheat functions
ReefAngel.TempProbe = T2_PROBE;
ReefAngel.OverheatProbe = T2_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
//Set Standard Menu
ReefAngel.AddStandardMenu();
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardLights( Port1,12,0,22,0 );
ReefAngel.StandardLights( Port2,13,0,21,0 );
ReefAngel.Relay.Set( Port3, !ReefAngel.Relay.Status( Port1 ) );
ReefAngel.StandardLights( Port7,13,0,21,0 );
ReefAngel.Relay.Set(Port5,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
ReefAngel.Relay.Set(Port8,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
ReefAngel.WaterLevelATO(Port6,720,30,30); // Enable ATO the ATO
if (ReefAngel.Relay.Status(Port5)) // Check to see if port 5 is on and update time is empty
{
ATOUpdate = now(); // If so, set the update time to now
}
if (now() - ATOUpdate < 120) // If it hasnt been 120 seconds turn off the port
{
ReefAngel.WaterLevelATO(Port6,720,0,1);
}
if (ReefAngel.DCPump.Mode==Custom)
{
ReefAngel.PWM.SetActinic( ElseMode(60,20,true )); // ElseMode on sync mode, 60 +/- 20%
}
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Sacohen","Seth0310" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Water Level
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,66, "WL:" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,66, ReefAngel.WaterLevel.GetLevel() );
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 92, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}
Re: My Jebao "Else" mode
Posted: Sun Jun 30, 2013 10:30 am
by Sacohen
It seems to be working right now.
The PWM Channel is showing a change in the speed, is the DC Pump section?
That stays at 30%.
Thanks.
Re: My Jebao "Else" mode
Posted: Sun Jun 30, 2013 11:11 am
by lnevo
Because your bypassing the dc pump in custom mode..
What i would do is pass the dcpump speed to the elsemode function so you can adjust the else mode by how you set the dcpump in the portal.
Re: My Jebao "Else" mode
Posted: Sun Jun 30, 2013 12:03 pm
by Sacohen
How would you code that?
I looked at your Complete PDE and it doesn't look like you've updated it to include the DCPump.mode and Collins was written as I have it.