Code: Select all
//The following features are enabled for this File:
//#define VersionMenu
#define DisplayLEDPWM
#define wifi
//#define WDT
//#define SIMPLE_MENU
#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 <ReefAngel.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
////// Place global variable code below here
void DrawCustomMain()
{
byte x = 6;
byte y = 2;
byte t;
char text[7];
//static byte vtechmode=0;
ReefAngel.LCD.DrawDate(6, 2);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
pingSerial();
ReefAngel.LCD.DrawLargeText(0,255,8,16,"Redneck Reefin!", Font8x8);
pingSerial();
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 6, 90, "--------------------");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 6, 126, "--------------------");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 93, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 103, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 113, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 2, 123, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 93, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 103, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 113, "|");
ReefAngel.LCD.DrawText(COLOR_BLACK,255, 126, 123, "|");
ReefAngel.LCD.DrawText(0,255,10,30,"Display");
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_BLACK, 255, 10, 40, text, Num8x16);
pingSerial();
ReefAngel.LCD.DrawText(0,255,100,30,"pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(COLOR_BLACK, 255, 85, 40, text, Num8x16);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 77, TempRelay);
ReefAngel.LCD.DrawText(0,255,8,68,"Light");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], COLOR_BLACK, 40, 68, 10);
ReefAngel.LCD.DrawText(0,255,70,68,"Room");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], COLOR_BLACK, 99, 68, 10);
ReefAngel.LCD.DrawText(0,255,8,100, "CWLED");
ReefAngel.LCD.DrawText(COLOR_BLACK,255,15,119, ReefAngel.PWM.GetDaylightValue());
//ReefAngel.PWM.GetDaylightValue(),
ReefAngel.LCD.DrawText(0,255,88,100, "RBLED");
ReefAngel.LCD.DrawText(COLOR_NAVY,255,90,119, ReefAngel.PWM.GetActinicValue());
//ReefAngel.PWM.GetActinicValue());
//ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
//ReefAngel.PWM.GetDaylightValue(),
//ReefAngel.PWM.GetActinicValue());
}
void DrawCustomGraph()
{
}
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 860 );
ReefAngel.SingleATO( true,Port2,60,0 );
pinMode(lowATOPin,OUTPUT);
// Ports that are always on
ReefAngel.Relay.On(Port3);
ReefAngel.Relay.On(Port4);
ReefAngel.Relay.On(Port7);
ReefAngel.Relay.On(Port8);
ReefAngel.Relay.On(Port5);
////// Place additional initialization code below here
//randomSeed(analogRead(0));
//ReefAngel.Init(); //Initialize controller
//ReefAngel.Timer[1].SetInterval(random(15,35));
//ReefAngel.Timer[1].Start();
//ReefAngel.Relay.On(Port5);
ReefAngel.AddWifi();
////// Place additional initialization code above here
}
void loop()
{
// Specific functions that use Internal Memory values
ReefAngel.StandardLights( Port1,19,0,6,30 );
ReefAngel.StandardHeater( Port4,740,770 );
ReefAngel.StandardLights( Port7,6,0,20,0 );
ReefAngel.StandardLights( Port8,7,0,19,0 );
//////// ReefAngel.Wavemaker1(Port5);
/////// ReefAngel.Wavemaker2(Port6);
//ReefAngel.PWM.SetActinic( MoonPhase ) Test for Meanwells
ReefAngel.PWM.SetDaylight( PWMParabola(7,5,19,0,0,85,0) );
ReefAngel.PWM.SetActinic( PWMParabola(6,5,21,0,0,85,0) );
///if ( ReefAngel.Timer[1].IsTriggered() )
/// {
/// ReefAngel.Timer[1].SetInterval(random(15,35));
/// ReefAngel.Timer[1].Start();
/// ReefAngel.Relay.Toggle(Port5);
/// ReefAngel.Relay.Toggle(Port6);
/// }
////// Place your custom code below here
if (hour()>=6 && hour()<20)
analogWrite(lowATOPin,0);
else
analogWrite(lowATOPin,(int)MoonPhase()*2.55);
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}