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
ReefAngel.Init(); //Initialize controller
ReefAngel.AddStandardMenu(); // Add Standard Menu
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
ReefAngel.AddMultiChannelWaterLevelExpansion(); // Multi-Channel Water Level Expanion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port7Bit;
ReefAngel.FeedingModePortsE[0] = Port3Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port4Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.WaterChangePortsE[0] = Port3Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port3Bit | Port5Bit | Port7Bit;
ReefAngel.OverheatShutoffPortsE[0] = Port1Bit | Port2Bit | Port3Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
ReefAngel.LightsOnPortsE[0] = Port1Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T2_PROBE;
ReefAngel.OverheatProbe = T2_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 840 );
// Ports that are always on
//*ReefAngel.Relay.On( Port1 ); - place holder for Webwizard. Using ActinicLights code for Port 1
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port3 );
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Box1_Port5 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardLights( Port2 );
ReefAngel.StandardHeater1( Box1_Port2 );
ReefAngel.Relay.Set( Port3, !ReefAngel.Relay.Status( Port2 ) );
ReefAngel.StandardHeater1( Port5 );
ReefAngel.WaterLevelATO( 1,Port8 );
///if ( ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port8); - Not yet installed
ReefAngel.Relay.DelayedOn( Port7 );
ReefAngel.StandardFan1( Port6 );
if ( ReefAngel.Params.PH > 840 ) ReefAngel.Relay.Off( Port8 );
///if ( ReefAngel.LowATO.IsActive()) ReefAngel.Relay.On(Port8); - Not yet installed
////// Place your custom code below here
ReefAngel.WaterLevelATO( 2,Box1_Port4,5,95,14400 ); // hard codes ATO reservoir settings since only one available in Uapp.
MyOwnStandardLights(Port1,-InternalMemory.ActinicOffset_read()); // Calls my new offset to allow negative offset.
////// Place your custom code above here
ReefAngel.CloudPortal();
// This should always be the last line
ReefAngel.ShowInterface();
}
void MyOwnStandardLights(byte Relay, int MinuteOffset)
{
int onTime=NumMins(InternalMemory.StdLightsOnHour_read(),InternalMemory.StdLightsOnMinute_read())-MinuteOffset;
int offTime=NumMins(InternalMemory.StdLightsOffHour_read(),InternalMemory.StdLightsOffMinute_read())+MinuteOffset;
ReefAngel.StandardLights(Relay,
onTime/60,
onTime%60,
offTime/60,
offTime%60
);
}
// RA_STRING1=U2FsdGVkX1/MRai+5HT5Qq9ZfbEK1mzFXKwT07B7oyM=
// RA_STRING2=U2FsdGVkX1+PuVSO4WlfFCjqa//mhJqdV9c4vId+V1I=
// RA_STRING3=Chloe's House-2.4