I just uploaded the code last night and the heater is not turning on, I have to override from Auto to ON. The other issue is more of a question. Given the code shown below, would setting a Jebao mode on the UAPP cause the RA to use that mode? I know the code from the loop will use ReefCrest if I set the portal to Custom, but not sure what would happen if I set to another mode.
If I need to add code to be able to override the mode via the UAPP, what should I add? Thanks in advance for any help or insight.
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
// Here is the port assignment for this code:
// Port1 - ATO
// Port2 - Heater
// Port3 - Refugium
// Port4 - BRS Reactor
// Port5 - Skimmer
// Port6 - Main Return DC6000
// Port7 - Fuge Flow
// Port8 - LED Lights
////// Place global variable code below here
//#define DC6000_Normal_Speed 50
//#define DC6000_Feeding_Speed 0
#define MaxpH_for_ATO 840
//#define Storm_Duration 10 // Number of minutes
unsigned long lastmaxph=now()-7200;
unsigned long lastfeed=now();
boolean feed=false;
//boolean storm=false;
////// 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.AddSalinityExpansion(); // Salinity Expansion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port4Bit | Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port4Bit | Port5Bit | Port6Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port2Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 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( 780 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Port6 );
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
//ReefAngel.CustomLabels[0] = "ATO";
//ReefAngel.CustomLabels[1] = "Heaters";
//ReefAngel.CustomLabels[2] = "FugeLt";
//ReefAngel.CustomLabels[3] = "Reactor";
//ReefAngel.CustomLabels[4] = "Skimmer";
//ReefAngel.CustomLabels[5] = "DCPump";
//ReefAngel.CustomLabels[6] = "FugeFlow";
//ReefAngel.CustomLabels[7] = "LEDs";
////// Place additional initialization code above here
}
void loop()
{
// ReefAngel.StandardATO( Port1,60 );
ReefAngel.StandardHeater( T1_PROBE,Port2,680,780 );
ReefAngel.StandardLights( Port3,18,0,6,0 );
ReefAngel.Relay.DelayedOn( Port5,10 );
ReefAngel.Relay.DelayedOn( Port1,15 );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
ReefAngel.DCPump.Threshold = 20;
////// Place your custom code below here
if (ReefAngel.Params.PH>MaxpH_for_ATO) lastmaxph=now();
if (now()-lastmaxph>7200)
ReefAngel.Relay.On( Port1 ); // ATO normal
else
ReefAngel.Relay.Off( Port1 ); // ATO Off
//ReefAngel.DCPump.SetMode( Lagoon,50,0 ); // ReefCrest at 50% +/- 20%
// if (hour()>=18 || hour()<6)
// ReefAngel.DCPump.SetMode( Constant,25,0 ); // Constant at 30%
// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
if (now()-feeding<1800) {
// Continue NTM for the 30 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( NutrientTransport, 90,70 ); // Nutrient Transport at 90% with 700ms Pulse
} else if (hour()>=21 || hour()<7) { // 7am / 9pm
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( Constant,35,0 ); // Constant at 35%
} else if (InternalMemory.DCPumpMode_read()==11) { // Custom Mode and nothing else going on
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( ReefCrest,70,20 ); // ReefCrest at 70% +/- 20%
} else {
ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}
//ReefAngel.DCPump.SetMode( ReefCrest,70,20 ); // ReefCrest at 70% +/- 20%
// if (hour()>=18 || hour()<6)
// ReefAngel.DCPump.SetMode( Constant,35,0 ); // Constant at 35%
// if (ReefAngel.DisplayedMenu!=FEEDING_MODE && feed==true)
// {
// feed=false;
// lastfeed=now();
// }
// if (now()-lastfeed<1800)
// ReefAngel.DCPump.SetMode( NutrientTransport, 90,70 ); // Nutrient Transport at 90% with 700ms Pulse
////// Place your custom code above here
ReefAngel.CloudPortal();
// This should always be the last line
ReefAngel.ShowInterface();
}
void CheckSwitches() {
// Turn off protein skimmer if skimmer container is full (Low ATO)
if (!ReefAngel.LowATO.IsActive()) { // switch on by default
ReefAngel.Relay.Override(Port5,0);
}
}
// RA_STRING1=null
// RA_STRING2=null
// RA_STRING3=null
// RA_LABEL LABEL_ACTINIC=WP25.2
// RA_LABEL LABEL_DAYLIGHT=WP25.1