I am at a loss as to what is happening. Luckily, it has happened 2 times whilst I have been nearby and managed to catch it.
If I use the portal or iphone app, I am able to turn the skimmer back on.
Any advise please, as its a bit concerning if Im out and my skimmer turns off.
I look forward to your advise!!
#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 <ReefAngel.h>
////// Place global variable code below here
unsigned long lastLowSal=now();//salinity >35.1 timer
boolean SALduration=true;//salinity >35.1 for 2 minutes flag
boolean ATOEnabled=false;//enable ATO function for 5 seconds
boolean ATOPumping=true;//disable ATO function for 5 minutes
unsigned long ATOStart=now();//ATO 5 sec run timer
double Salinitytest;
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
ReefAngel.FeedingModePortsE[0] = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
ReefAngel.WaterChangePortsE[0] = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
ReefAngel.LightsOnPortsE[0] = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port6Bit;
ReefAngel.OverheatShutoffPortsE[0] = 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( 260 );
InternalMemory.SalTempComp_write( 255); // Change this to compensation temperature
// Ports that are always on
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port8 );
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port2 );
ReefAngel.Relay.On( Box1_Port4 );
ReefAngel.Relay.On( Box1_Port6 );
ReefAngel.Relay.On( Box1_Port7 );
ReefAngel.Relay.On( Box1_Port8 );
////// Place additional initialization code below here
ReefAngel.Timer[1].SetInterval(1800); // 30 mins before reactivation of ATO
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.Relay.DelayedOn( Port3,5 );//skimmer delay on switching on
ReefAngel.StandardHeater( Port6,252,255 );
ReefAngel.StandardFan( Port7,255,258 );
////// Place your custom code below here
ReefAngel.WaterLevelATO(Port2,180,35,40);// Salinty top up to keep water level correct
// Apply Salinity temp Compensation & salinity calibration
double SalCompensation;
if (ReefAngel.TempSensor.unit)
SalCompensation=ReefAngel.Params.Salinity/(1+((ReefAngel.Params.Temp[T3_PROBE]-InternalMemory.SalTempComp_read())*0.0022));
else
SalCompensation=ReefAngel.Params.Salinity/(1+((ReefAngel.Params.Temp[T3_PROBE]-InternalMemory.SalTempComp_read())*0.001165));
SalCompensation=round(SalCompensation);
// For displaying salinity without temp compensation
Salinitytest=SalCompensation;
///// If salinity >35.1 for 120 sec set SALduration flag
if (SalCompensation<351) lastLowSal=now();
if (now()-lastLowSal>120) SALduration=false;
if (SALduration && ATOPumping)//if salinity>35.1 for 2 minutes enable ATO
{ATOStart=now();
}
else
{
ATOEnabled=true;
ATOPumping=false;
}
if (now()-ATOStart<5)//ATO pump on time 5 seconds
{
if (ATOEnabled) ReefAngel.Relay.On(Port1);
ReefAngel.Timer[1].Start();//start 5 minute disable of ATO
}
else
{
ReefAngel.Relay.Off(Port1);
ATOEnabled=false;
}
if (ReefAngel.Timer[1].IsTriggered())//after 30 minute disable, enable ATO
{
ATOPumping=true;
ATOStart=now();
SALduration=true;
}
///// if skimmer cup full, turn off skimmer
if (ReefAngel.HighATO.IsActive()) {
bitClear(ReefAngel.Relay.RelayMaskOff,2);
}
else {
bitSet(ReefAngel.Relay.RelayMaskOff,2);
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "dazza1304" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 10, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 10, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Salinity
ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,15,46, "SAL:" );
ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,39,46, ReefAngel.Params.Salinity );
pingSerial();
//map of adc temp comp salinity
ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,15,63, "SAT:" );
ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,39,63, (int)Salinitytest );
// ORP
ReefAngel.LCD.DrawText( COLOR_PALEVIOLETRED,DefaultBGColor,75,46, "ORP:" );
ReefAngel.LCD.DrawText( COLOR_PALEVIOLETRED,DefaultBGColor,99,46, ReefAngel.Params.ORP );
pingSerial();
// Water Level
ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,75,63, "WL:" );
ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,99,63, ReefAngel.WaterLevel.GetLevel() );
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 79, TempRelay );
pingSerial();
// Relay Expansion
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox( 12, 98, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}