Page 8 of 9

Re: PaulTurner911 Code

Posted: Sat Dec 13, 2014 10:14 am
by lnevo
ReefAngel.StandardHeater(Port2,74,76);

Re: PaulTurner911 Code

Posted: Sat Dec 13, 2014 10:58 am
by Paulturner911
I put it below void loop, it didnt activate after upload. Should I have it below void setup? I also changed it to 75 :)
**Put it in both and it still hadnt turned the heater on.
I lost one of my codes and modified the second most recent but also update the libs. I could use a set of eyes on my current code. I think i put everything back and removed the ELSE definition because its in the libs now and was giving an error.

Code: Select all

void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port6Bit | Port7Bit ;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port6Bit | Port7Bit ;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts =  Port3Bit | Port7Bit ;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit |Port2Bit | Port3Bit | Port6Bit | Port7Bit ;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Heater (75-76)
ReefAngel.StandardHeater(Port2,75,76);
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;

// Ports that are always on


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


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

void loop()
{
ReefAngel.Relay.DelayedOn( Port1,1 ); // Return Pump
//Port 2 Heater (75-76)
ReefAngel.StandardHeater(Port2,75,76);
ReefAngel.ActinicLights( Port3 ); // Actinic LEDS
//Port4 Kalk/ATO
//Port5 Empty
ReefAngel.Relay.DelayedOn( Port6,120 );//Port6 Skimmer
ReefAngel.DayLights( Port7 ); // White LEDS
//Port8 Empty
//Moonlight Phase 9pm-10am (CH4-CH5)
if ( (hour() >=10) && (hour() <21) ) 
ReefAngel.PWM.SetChannel( 4,(0) );
else 
ReefAngel.PWM.SetChannel( 4, MoonPhase() );
if ( (hour() >=10) && (hour() <21) ) 
ReefAngel.PWM.SetChannel( 5,(0) );
else
ReefAngel.PWM.SetChannel( 5, MoonPhase() );

//Over Flow Protection
if (ReefAngel.HighATO.IsActive())
ReefAngel.Relay.On(Port1);
else
ReefAngel.Relay.Off(Port1);

//ATO Protection
if (ReefAngel.LowATO.IsActive())
ReefAngel.Relay.On(Port4);
else
ReefAngel.Relay.Off(Port4);

//Kalk Dose 60sec @ 11pm-12pm (every 15min)
if (hour() >=23 || hour() < 12)
ReefAngel.Relay.Set(Port4, now()%900<60);
else
ReefAngel.Relay.Off(Port4);



ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
////// Place your custom code below here

///// Place your custom code below here

// Add random mode if we set to Mode to Custom in portal
static int rmode;
static boolean changeMode=true;

// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { Else, Lagoon, ReefCrest, ShortPulse, LongPulse, Gyre, NutrientTransport };

if (now()%SECS_PER_DAY==0 || changeMode==true) { // Change at midnight or if controller rebooted
rmode=random(100)%sizeof(modes); // Change the mode once per day to pick from our array
changeMode=false;
}

// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();

if (now()-feeding<900) { 
  // First 15 minutes after feeding mode stops. Return Pump is off
  ReefAngel.Relay.Off(Port1);
  // First 15 minutes after feeding mode stops. Smart_NTM
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()-feeding<4500) { // 15 minutes plus 1 hour
  // Continue NTM for the next 60 minutes (75 minutes total)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<30600 || now()%SECS_PER_DAY>=81000) { // 8:30am / 10:30pm
  // Night mode (go to 30%)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=Constant;
  ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) { 
  // Custom Mode and nothing else going on
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
  if (modes[rmode]==Else) {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Mode=Constant;
    ReefAngel.DCPump.Speed=ElseMode(InternalMemory.DCPumpSpeed_read(),25,true );    // ElseMode on sync mode, Portal Speed Setting +/- 25%
  } else {
    ReefAngel.DCPump.Mode=modes[rmode];  // Put the mode to the random mode :)
    ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
  }
} else {
  ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}

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

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

void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();

// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();

// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 80, TempRelay );
pingSerial();

// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}

void DrawCustomGraph()
{
}
Thank you!!

Re: PaulTurner911 Code

Posted: Sat Dec 13, 2014 12:31 pm
by lnevo
The temp in your tank is 76.2 it won't go on until it drops below 75.

Re: PaulTurner911 Code

Posted: Sun Dec 14, 2014 6:42 am
by Paulturner911
I checked the relay activity, it didnt activate port 2. I woke up and took it off the RA and plugged it in to a power strip and cranked the house heater.

Please help

Re: PaulTurner911 Code

Posted: Sun Dec 14, 2014 7:10 am
by lnevo
Where'd you put it in the code? Can you post again?

Re: PaulTurner911 Code

Posted: Sun Dec 14, 2014 7:13 am
by lnevo
Actually your code looks fine. Not sure why its not on. Are you sure you loaded the code above?

Re: PaulTurner911 Code

Posted: Sun Dec 14, 2014 7:43 am
by Paulturner911
I have the code in both viod setup and viod loop, i was not sure where to put it, it compiles fine in both locations within the code.
This whats on there, uploaded it once with 74 as the activation, then 75. My chiller and RA are pretty far off on calibration. Ill throw a third on there to try to get an average and set the chillers correction factor. Ill upload it again and triple check.

Code: Select all

void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port6Bit | Port7Bit ;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port6Bit | Port7Bit ;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts =  Port3Bit | Port7Bit ;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit |Port2Bit | Port3Bit | Port6Bit | Port7Bit ;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Heater (75-76)
ReefAngel.StandardHeater(Port2,75,76);
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;

// Ports that are always on


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


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

void loop()
{
ReefAngel.Relay.DelayedOn( Port1,1 ); // Return Pump
//Port 2 Heater (75-76)
ReefAngel.StandardHeater(Port2,75,76);
ReefAngel.ActinicLights( Port3 ); // Actinic LEDS
//Port4 Kalk/ATO
//Port5 Empty
ReefAngel.Relay.DelayedOn( Port6,120 );//Port6 Skimmer
ReefAngel.DayLights( Port7 ); // White LEDS
//Port8 Empty
//Moonlight Phase 9pm-10am (CH4-CH5)
if ( (hour() >=10) && (hour() <21) ) 
ReefAngel.PWM.SetChannel( 4,(0) );
else 
ReefAngel.PWM.SetChannel( 4, MoonPhase() );
if ( (hour() >=10) && (hour() <21) ) 
ReefAngel.PWM.SetChannel( 5,(0) );
else
ReefAngel.PWM.SetChannel( 5, MoonPhase() );

//Over Flow Protection
if (ReefAngel.HighATO.IsActive())
ReefAngel.Relay.On(Port1);
else
ReefAngel.Relay.Off(Port1);

//ATO Protection
if (ReefAngel.LowATO.IsActive())
ReefAngel.Relay.On(Port4);
else
ReefAngel.Relay.Off(Port4);

//Kalk Dose 60sec @ 11pm-12pm (every 15min)
if (hour() >=23 || hour() < 12)
ReefAngel.Relay.Set(Port4, now()%900<60);
else
ReefAngel.Relay.Off(Port4);



ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
////// Place your custom code below here

///// Place your custom code below here

// Add random mode if we set to Mode to Custom in portal
static int rmode;
static boolean changeMode=true;

// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { Else, Lagoon, ReefCrest, ShortPulse, LongPulse, Gyre, NutrientTransport };

if (now()%SECS_PER_DAY==0 || changeMode==true) { // Change at midnight or if controller rebooted
rmode=random(100)%sizeof(modes); // Change the mode once per day to pick from our array
changeMode=false;
}

// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();

if (now()-feeding<900) { 
  // First 15 minutes after feeding mode stops. Return Pump is off
  ReefAngel.Relay.Off(Port1);
  // First 15 minutes after feeding mode stops. Smart_NTM
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()-feeding<4500) { // 15 minutes plus 1 hour
  // Continue NTM for the next 60 minutes (75 minutes total)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<30600 || now()%SECS_PER_DAY>=81000) { // 8:30am / 10:30pm
  // Night mode (go to 30%)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=Constant;
  ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) { 
  // Custom Mode and nothing else going on
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
  if (modes[rmode]==Else) {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Mode=Constant;
    ReefAngel.DCPump.Speed=ElseMode(InternalMemory.DCPumpSpeed_read(),25,true );    // ElseMode on sync mode, Portal Speed Setting +/- 25%
  } else {
    ReefAngel.DCPump.Mode=modes[rmode];  // Put the mode to the random mode :)
    ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
  }
} else {
  ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}

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

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

void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();

// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();

// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 80, TempRelay );
pingSerial();

// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}

void DrawCustomGraph()
{
}
Its uploading without any issues... Port 2 is still not on
Something in my code conflicting? Could it have to do with the internal memory setting in the portal? I have assigned temps to them , but how would they know the ports for the chiller and heater?

Could or should I run the wizard again and cut my code in?

Re: PaulTurner911 Code

Posted: Sun Dec 14, 2014 10:15 am
by lnevo
The internal memory is not used with the command i gave you.

For now i recommend just manually tirn the port on and rely on the heater thermostat plus you have the chiller. I'm not sure why its not working. It should also be in loop not setup.

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 12:55 pm
by Paulturner911
Ok, Ill remove it from the void setup section.

I would really like to have this functioning properly in the near future? What can I do to help troubleshoot? Can i confirm the file on the RA? Like I said, it should give an error if the RA was not taking the code, its uploading fine all around.

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 1:02 pm
by lnevo
Maybe Roberto could take a look. I dont have an extra probe I can test with at the moment but I don't see anything wrong. I'll try and take another look later tonight.

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 1:25 pm
by Paulturner911
I found my temp probe was out of the water in the sump, but it still should have activated anytime under 75, which it didnt.

This also "fixed" the calibration "issues" between the RA and the chiller, since the probe was in and out of the water level. Dumb mistake, but still doesnt justify it not turning on under 75. Thank you Lee

Could it have something to do with the temp probe assignments? In my code it pulls overheat from temp probe 1. You would think thats the trigger, but Im reaching for anything to make it jive in my eyes within the code...

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 2:49 pm
by lnevo
Oh the standard heater only works with the T1 probe. If you cant switch them i'll write you a function

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 3:31 pm
by Paulturner911
T1 IS the probe in the sump, T2 is in the stand basically ambient temp.... I can switch them, but why?

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 4:06 pm
by lnevo
Nevermind was hoping that was it. Roberto can you check the code. I need some more eyes on it.

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 4:29 pm
by rimai
It should be this:

Code: Select all

ReefAngel.StandardHeater(Port2,750,760);
instead of this:

Code: Select all

ReefAngel.StandardHeater(Port2,75,76);

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 5:21 pm
by Paulturner911
You rock!!

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 5:35 pm
by lnevo
I'm so slow...

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 6:08 pm
by Paulturner911
Lee!! You've walked me through EVERYTHING! You're the man!!

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 6:24 pm
by lnevo
Roberto,

Do you think if we convert the function that if the values are less than 100 we multiply by 10 automatically? I don't think anyone is going to want 2.4 degrees to 2.6 degrees celsius in any aquarium, nor do we want 7.5 -7.8, etc.

Also, I think we could add a StandardHeater2 or a StandardHeater function with an arg for the temp probe? What do you think?

Re: PaulTurner911 Code

Posted: Mon Dec 15, 2014 6:48 pm
by rimai
That works :)

Re: PaulTurner911 Code

Posted: Wed Dec 24, 2014 10:38 am
by lnevo
Patch submitted. There's now functions for StandardHeater2 and StandardHeater3 same for StandardFan. And if you pass a temp param less than 100 it will be multiplied by 10.

Re: PaulTurner911 Code

Posted: Sat Mar 07, 2015 10:47 am
by Paulturner911

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
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit ;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit ;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts =  Port7Bit | Port3Bit ;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit |Port2Bit | Port3Bit | Port5Bit| Port6Bit | Port7Bit| Port8Bit ;
// 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


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


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

void loop()
{
ReefAngel.Relay.DelayedOn( Port1,1 ); // Return Pump
ReefAngel.Relay.DelayedOn( Port2,90 );// Skimmer
ReefAngel.ActinicLights( Port3 ); // Actinic LEDS
ReefAngel.StandardFan(Port4,790,800);//Chiller 79-80
ReefAngel.StandardHeater(Port5,750,760);//Heater 75-76
//Port6 Kalk/ATO
ReefAngel.DayLights( Port7 ); // White LEDS
//Port 8 Empty
//Moonlight Phase 9pm-10am (CH4-CH5)
if ( (hour() >=10) && (hour() <21) ) 
ReefAngel.PWM.SetChannel( 4,(0) );
else 
ReefAngel.PWM.SetChannel( 4, MoonPhase() );
if ( (hour() >=10) && (hour() <21) ) 
ReefAngel.PWM.SetChannel( 5,(0) );
else
ReefAngel.PWM.SetChannel( 5, MoonPhase() );

//Over Flow Protection
if (ReefAngel.HighATO.IsActive())
ReefAngel.Relay.On(Port1);
else
ReefAngel.Relay.Off(Port1);

//ATO Protection
if (ReefAngel.LowATO.IsActive())
ReefAngel.Relay.On(Port6);
else
ReefAngel.Relay.Off(Port6);

//Kalk Dose  10pm-11pm
if (hour() >=22 || hour() < 23)
ReefAngel.Relay.On(Port6);
else
ReefAngel.Relay.Off(Port6);



ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
////// Place your custom code below here

///// Place your custom code below here

// Add random mode if we set to Mode to Custom in portal
static int rmode;
static boolean changeMode=true;

// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { Else, Lagoon, ReefCrest, ShortPulse, LongPulse, Gyre, NutrientTransport };

if (now()%SECS_PER_DAY==0 || changeMode==true) { // Change at midnight or if controller rebooted
rmode=random(100)%sizeof(modes); // Change the mode once per day to pick from our array
changeMode=false;
}

// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();

if (now()-feeding<900) { 
  // First 15 minutes after feeding mode stops. Return Pump is off
  ReefAngel.Relay.Off(Port1);
  // First 15 minutes after feeding mode stops. Smart_NTM
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()-feeding<4500) { // 15 minutes plus 1 hour
  // Continue NTM for the next 60 minutes (75 minutes total)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<30600 || now()%SECS_PER_DAY>=81000) { // 8:30am / 10:30pm
  // Night mode (go to 30%)
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Mode=Constant;
  ReefAngel.DCPump.Speed=30;
} else if (InternalMemory.DCPumpMode_read()==11) { 
  // Custom Mode and nothing else going on
  ReefAngel.DCPump.UseMemory=false;
  ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
  if (modes[rmode]==Else) {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Mode=Constant;
    ReefAngel.DCPump.Speed=ElseMode(InternalMemory.DCPumpSpeed_read(),25,true );    // ElseMode on sync mode, Portal Speed Setting +/- 25%
  } else {
    ReefAngel.DCPump.Mode=modes[rmode];  // Put the mode to the random mode :)
    ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
  }
} else {
  ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}

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

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

void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();

// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();

// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 80, TempRelay );
pingSerial();

// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}

void DrawCustomGraph()
{
}

I coded this and the ATO should only run from 10pm-11pm in my eyes. BUT, It doesnt seem to function correctly since I just uploaded and its 12.45pm and Port6 is ON. Any help would be great.

Re: PaulTurner911 Code

Posted: Sat Mar 07, 2015 11:25 am
by lnevo
Change the || to &&

Re: PaulTurner911 Code

Posted: Sat Mar 07, 2015 2:46 pm
by Paulturner911
Thank You!!

Re: PaulTurner911 Code

Posted: Sun Jun 14, 2015 11:16 am
by Paulturner911
Any idea what kind of run time I should get with two pumps on the Jeabo battery backup kit...??

Re: PaulTurner911 Code

Posted: Mon Nov 02, 2020 6:36 pm
by Paulturner911
Hi guys! Its been ages since Ive messed with the tank and/or this program. My skimmer is returning very light product. I think I want it to run every other day.

Skimmer is Port 2. How could I code that?

Thank you in advance!

Re: PaulTurner911 Code

Posted: Tue Nov 03, 2020 8:37 am
by rimai
Replace this:

Code: Select all

//Over Flow Protection
if (ReefAngel.HighATO.IsActive())
ReefAngel.Relay.On(Port1);
else
ReefAngel.Relay.Off(Port1);
with this:

Code: Select all

//Over Flow Protection
if (ReefAngel.HighATO.IsActive())
{
  if (day()%2==0)
  {
    ReefAngel.Relay.On(Port1);
  }
  else
  {
    ReefAngel.Relay.Off(Port1);
  }
}
else
{
  ReefAngel.Relay.Off(Port1);
}

Re: PaulTurner911 Code

Posted: Tue Nov 03, 2020 7:49 pm
by Paulturner911
Thanks for the reply Roberto. Im not sure that will do what I want. Pump 1 is my return pump, I would like my skimmer to run for 24hr on and 24hr off, but still turn off when I use the feed mode.

Re: PaulTurner911 Code

Posted: Tue Nov 03, 2020 8:46 pm
by rimai
Duh... Misread the post. I read Port 1 :(
I'll send code later. Typing on phone....

Re: PaulTurner911 Code

Posted: Thu Nov 05, 2020 7:28 am
by rimai
Replace this:

Code: Select all

ReefAngel.Relay.DelayedOn( Port2,90 );// Skimmer
With this:

Code: Select all

if (day()%2==0)
{
  ReefAngel.Relay.DelayedOn( Port2,90 );// Skimmer
}
else
{
  ReefAngel.Relay.Off(Port2);
}