I used the wizard to generate the initial times, which had the actinics come on an hour before the daylights, then used the client to switch them to actnics on at 11 am and off at 10 pm, and daylights on at 1pm and off at 8:45...any ideas as to why they are not following this schedule?
thanks
Code: Select all
//July 7, 2012, first try with the new 1.0.0 libraries
//Latest, uploaded July 8th, with wavemaker fixes and new screen. Moonlights NOT coded...
#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 <ReefAngel.h>
////// Place global variable code below here
time_t WMRTimer=now();
boolean wmdelay=false;
byte wmport=Port5;
////// Place global variable code above here
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 120);
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 4, 4 , "ROB'S REEF ANGEL");
ReefAngel.LCD.Clear(COLOR_MAROON, 1, 13, 132, 13);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 37, 119, 37);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 75, 119, 75);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 59, 119, 59);
pingSerial();
ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, COLOR_WHITE, 6, 15, "Display");
ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, COLOR_WHITE, 18, 27, "Tank");
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
pingSerial();
ReefAngel.LCD.DrawHugeText(COLOR_GOLDENROD, DefaultBGColor, 65, 17, text);
pingSerial();
ReefAngel.LCD.DrawText(COLOR_RED, COLOR_WHITE,72,39,"Frag:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], COLOR_RED, 104, 39, 10);
ReefAngel.LCD.DrawText(COLOR_DARKORCHID, COLOR_WHITE,72,48,"Room:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], T2TempColor, 104, 48, 10);
//ReefAngel.LCD.DrawText(COLOR_TEAL, COLOR_WHITE, 72, 39,"Moon Phase");
pingSerial();
ReefAngel.LCD.DrawLargeText(COLOR_MEDIUMSEAGREEN, COLOR_WHITE, 8, 44, "pH:");
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, 35, 44, text);
pingSerial();
ReefAngel.LCD.DrawText(DPColor,DefaultBGColor, 5, 64,"WAVE FLOW:");
if (bitRead(ReefAngel.Relay.RelayData,Port5-1)==1) ReefAngel.LCD.DrawText(APColor,DefaultBGColor, 67, 64,"----->"); //port 5 on
else if (bitRead(ReefAngel.Relay.RelayData,Port6-1)==1) ReefAngel.LCD.DrawText(APColor,DefaultBGColor, 67, 64,"<-----"); //port 6 on
else ReefAngel.LCD.DrawText(APColor,DefaultBGColor, 67, 64," 00000 "); //port5 and port 6 off, wavemaker delay: taken away for the
//show the timer for wavemaker
int t=WMRTimer-now();
if (t>=0)
ReefAngel.LCD.Clear(255,105,64,135,74);
ReefAngel.LCD.DrawText(APColor, COLOR_KHAKI,110,64,t);
pingSerial();
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,79,"Actinic");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,89,"FragLt");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,99,"WM RT");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,109,"Fan");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,79,"Fr/Pump");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,89,"DayLts");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,99,"WM LFT");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,109,"Heater");
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawCircleOutletBox(60, 81, TempRelay, true);
}
void DrawCustomGraph()
{
}
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.AddStandardMenu();
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port5Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port7Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Ports that are always on
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.DayLights( Port1 );
ReefAngel.ActinicLights( Port2 );
ReefAngel.DayLights( Port3 );
ReefAngel.DayLights( Port4 );
//ReefAngel.Wavemaker1( Port5 );
//ReefAngel.Wavemaker1( Port6 );
ReefAngel.StandardHeater( Port7 );
ReefAngel.StandardFan( Port8 );
ReefAngel.PWM.SetDaylight( MoonPhase() );
ReefAngel.PWM.SetActinic( MoonPhase() );
////// Place your custom code below here
MyWavemakerRandom(Port5,Port6,35,50); // Turn Port5 on/off random cycles that lasts from 35 to 50 secs
// This should always be the last line
ReefAngel.Portal( "psyrob" );
ReefAngel.ShowInterface();
}
void MyWavemakerRandom(byte WMRelay1, byte WMRelay2, int MinWMTimer, int MaxWMTimer)
{
if (now()>WMRTimer)
{
if ((hour() >= 21) || (hour() <= 8)) //from 9p-8a
{
if (wmdelay)
{
WMRTimer=now()+60;
ReefAngel.Relay.Off(WMRelay1);
ReefAngel.Relay.Off(WMRelay2);
if (wmport==Port5) wmport=Port6;
else wmport=Port5;
wmdelay=false;
}
else
{
WMRTimer=now()+20;
ReefAngel.Relay.On(wmport);
wmdelay=true;
}
}
else
{
WMRTimer=now()+random(MinWMTimer, MaxWMTimer);
ReefAngel.Relay.Toggle(WMRelay1);
ReefAngel.Relay.Set(WMRelay2,!ReefAngel.Relay.Status(WMRelay1)); // Turn Port6 on/off on opposite cycle as Port 5
// Port 5 and 6 are synchronized.
// They work in opposing motion of each other at random times.
}
}
}