Re: Multiple on/off times
Posted: Tue May 28, 2013 8:54 am
Actually, if you look closely, it's the other way around...
The scheduling is 1st and the override is 2nd.
The scheduling is 1st and the override is 2nd.
Community discussion about Reef Angel Controllers and reefing related subjects
https://forum.reefangel.com/
How do you mean, Roberto?rimai wrote:Actually, if you look closely, it's the other way around...
The scheduling is 1st and the override is 2nd.
I added what you asked at the top and replaced the other code with what you gave me and I'm getting the following error...cosmith71 wrote:ReefAngel.Relay.Status returns a 0 for off and a 1 for on (boolean, true/false) so you can't just add 120 there.
Try this:
This goes near the top right above ////// Place global variable code above here
Remove this:Code: Select all
unsigned long ATOUpdate=0;
And try this instead:Code: Select all
if (ReefAngel.Relay.Status(Port5)) ReefAngel.Relay.Off(Port6); else ReefAngel.WaterLevelATO(Port6,720,29,31);
--ColinCode: Select all
if (ReefAngel.Relay.Status(Port5) && ATOUpdate==0) // Check to see if port 5 is on and update time is empty { ATOUpdate = now(); // If so, set the update time to now ReefAngel.Relay.Off (Port6); } // and turn off the ATO pump if (now() - ATOUpdate >= 120 && ATOUpdate != 0) // If it's been 120 sec, and the update time is NOT empty { ATOUpdate = 0; // Empty out the update time ReefAngel.WaterLevelATO(Port6,720,29.31); } // and turn the ATO sensor back on
Steves_Custom_Wave_Sketch.cpp: In function 'void loop()':
Steves_Custom_Wave_Sketch:78: error: no matching function for call to 'ReefAngelClass::WaterLevelATO(int, int, double)'
C:\Users\Steve\Documents\Arduino\libraries\ReefAngel/ReefAngel.h:322: note: candidates are: void ReefAngelClass::WaterLevelATO(byte, int, byte, byte)
C:\Users\Steve\Documents\Arduino\libraries\ReefAngel/ReefAngel.h:353: note: void ReefAngelClass::WaterLevelATO(byte)
I added what you asked at the top and replaced the other code with what you gave me and I'm getting the following error...cosmith71 wrote:ReefAngel.Relay.Status returns a 0 for off and a 1 for on (boolean, true/false) so you can't just add 120 there.
Try this:
This goes near the top right above ////// Place global variable code above here
Remove this:Code: Select all
unsigned long ATOUpdate=0;
And try this instead:Code: Select all
if (ReefAngel.Relay.Status(Port5)) ReefAngel.Relay.Off(Port6); else ReefAngel.WaterLevelATO(Port6,720,29,31);
--ColinCode: Select all
if (ReefAngel.Relay.Status(Port5) && ATOUpdate==0) // Check to see if port 5 is on and update time is empty { ATOUpdate = now(); // If so, set the update time to now ReefAngel.Relay.Off (Port6); } // and turn off the ATO pump if (now() - ATOUpdate >= 120 && ATOUpdate != 0) // If it's been 120 sec, and the update time is NOT empty { ATOUpdate = 0; // Empty out the update time ReefAngel.WaterLevelATO(Port6,720,29.31); } // and turn the ATO sensor back on
Steves_Custom_Wave_Sketch.cpp: In function 'void loop()':
Steves_Custom_Wave_Sketch:78: error: no matching function for call to 'ReefAngelClass::WaterLevelATO(int, int, double)'
C:\Users\Steve\Documents\Arduino\libraries\ReefAngel/ReefAngel.h:322: note: candidates are: void ReefAngelClass::WaterLevelATO(byte, int, byte, byte)
C:\Users\Steve\Documents\Arduino\libraries\ReefAngel/ReefAngel.h:353: note: void ReefAngelClass::WaterLevelATO(byte)
That was it. I wasn't even looking there because the error seemed to be referring to something different.rimai wrote:I think you typed wrong....
ReefAngel.WaterLevelATO(Port6,720,29.31);
Not your fault Colin.cosmith71 wrote:Oops. Sorry!
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 <ReefAngel.h>
////// Place global variable code below here
unsigned long ATOUpdate=0;
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port4Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
// Use T2 probe as temperature and overheat functions
ReefAngel.TempProbe = T2_PROBE;
ReefAngel.OverheatProbe = T2_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );
//Set Standard Menu
ReefAngel.AddStandardMenu();
// Ports that are always on
ReefAngel.Relay.On( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardLights( Port1,12,0,22,0 );
ReefAngel.StandardLights( Port2,13,0,21,0 );
ReefAngel.Relay.Set( Port3, !ReefAngel.Relay.Status( Port1 ) );
ReefAngel.StandardLights( Port7,13,0,21,0 );
ReefAngel.Relay.Set(Port5,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
ReefAngel.Relay.Set(Port8,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
if (ReefAngel.Relay.Status(Port5) && ATOUpdate==0) // Check to see if port 5 is on and update time is empty
{ ATOUpdate = now(); // If so, set the update time to now
ReefAngel.Relay.Off (Port6); } // and turn off the ATO pump
if (now() - ATOUpdate >= 120 && ATOUpdate != 0) // If it's been 120 sec, and the update time is NOT empty
{ ATOUpdate = 0; // Empty out the update time
ReefAngel.WaterLevelATO(Port6,720,29,31); } // and turn the ATO sensor back on
ReefAngel.PWM.SetActinic(MyCustomWave(50));
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(0);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Sacohen","Seth0310" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Water Level
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,66, "WL:" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,66, ReefAngel.WaterLevel.GetLevel() );
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 92, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
byte MyCustomWave(byte maxspeed)
{
static byte randomspeed=0;
if (now()%11<5)
{
return randomspeed;
}
else if (now()%11>=5 && now()%11<10)
{
return maxspeed;
}
else
{
randomspeed=random(35,maxspeed);
return 0;
}
}
We should add ato timout and overheat flags to the r99 output..Sacohen wrote:I'm not 100% sure, because I'm not at home to look at the head unit.
I only have access to the Portal & the Reef Angel Client, would it show me a time out on either of those?
I don't think it is because if I look at the relay activity Port6 has not activated since Thursday May 28th at 7:24 am and when I came home from work yesterday it was at the 32% level.
Code: Select all
ReefAngel.WaterLevelATO(Port6,720,29,31); // Enable ATO the ATO
if (ReefAngel.Relay.Status(Port5)) // Check to see if port 5 is on and update time is empty
{
ATOUpdate = now(); // If so, set the update time to now
}
if (now() - ATOUpdate < 120) // If it hasnt been 120 seconds turn off the port
{
ReefAngel.Relay.Off (Port6); // and turn off the ATO pump
}