Code: Select all
void SeasonalTemps ()
{
static int heatArray[][2] = { {792,796},// default in case of error in month=0 (June)
{770,774},//January (winter)
{774,778},//February (winter)
{775,779},//March (early spring)
{779,783},//April (spring)
{785,789},//May (spring)
{792,796},//June (early summer)
{799,803},//July (summer)
{806,810},//August (summer)
{796,800},//September (early fall)
{787,791},//October (fall)
{780,784},//November (fall)
{775,779} };//December (early winter)
ReefAngel.StandardHeater( Port2,heatArray[month()][0],heatArray[month()][1]);
}//end seasonalTemps
is there anything I need to change or remove from my current code?
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 <PAR.h>
#include <ReefAngel.h>
////// Place global variable code below here
////// Place global variable code above here
void setup()
{
// This must be the first line
InternalMemory.LCDID_write(0); //this line was added when i got a replacement RA+ board
ReefAngel.Init(); //Initialize controller
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | 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 | Port3Bit | Port5Bit | Port6Bit;
// 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( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.ActinicLights( Port1 );
ReefAngel.DayLights( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.Relay.DelayedOn(Port5 );
ReefAngel.DosingPumpRepeat1( Port7 );
ReefAngel.DosingPumpRepeat2( Port8 );
ReefAngel.PWM.DaylightPWMSlope();
ReefAngel.PWM.ActinicPWMSlope();
ReefAngel.DCPump.LowATOChannel = Sync; // WP40
ReefAngel.DCPump.HighATOChannel = AntiSync; // SW-8
ReefAngel.DCPump.AntiSyncOffset = 125;
////// Place your custom code below here
// Wavemaker
if ( ((hour() >= 2) && (hour() < 8)) || ((hour() >= 15) && (hour() < 19)) ) // off from 2am-8am & 3pm-7pm
{
ReefAngel.Relay.Off(Port6);
}
else
{
ReefAngel.WavemakerRandom( Port6, 30, 150 ); // random between 30 and 150 seconds
}
// DC pumps....................................
static int rmode;
static boolean changeMode=true;
// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { ReefCrest, Lagoon, TidalSwell, ShortPulse, Sine, Else, Gyre, NutrientTransport };
if (now()%1800==0 || changeMode==true) // Change every 30 mins (1800seconds) or controller reboot
{
rmode=random(100)%sizeof(modes); // Change the mode by picking from our array
changeMode=false;
}
// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
// Continue NutrientTranspot Mode for 30 minutes after feeding
if (now()-feeding<1800)
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=ReefCrest;
ReefAngel.DCPump.Speed=75;
}
// Night/Quiet mode
else if (hour()>=2 && hour()<8 ) // 2am to 8am
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( Gyre,40,10 );
}
else if (hour()>=15 && hour()<19) // 3pm and 7pm
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( ShortPulse,40,30 );
}
//Storm mode
else if (hour()>=1 && hour()<2) // 1am and 2am
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( Else,70,15 );
}
else if (hour()>=11 && hour()<12) // 11am and 12pm
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( ReefCrest,80,15 );
}
// Custom Mode and nothing else going on
else if (InternalMemory.DCPumpMode_read()==11)
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
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( "" );
ReefAngel.DDNS( "" ); // Your DDNS is
ReefAngel.ShowInterface();
}