Multiple on/off times
Re: Multiple on/off times
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.
Roberto.
Re: Multiple on/off times
Thanks Roberto.
Again I'll try it when I get home from work tonight.
Again I'll try it when I get home from work tonight.
Re: Multiple on/off times
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.
--Colin
Re: Multiple on/off times
I meant that your code comes in 2nd and not the 1st as he was thinking.
Roberto.
Re: Multiple on/off times
Oh, OK. 
And thanks for the original framework for that code.
--Colin

And thanks for the original framework for that code.

--Colin
Re: Multiple on/off times
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)
Re: Multiple on/off times
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)
Re: Multiple on/off times
I think you typed wrong....
ReefAngel.WaterLevelATO(Port6,720,29.31);
ReefAngel.WaterLevelATO(Port6,720,29.31);
Roberto.
Re: Multiple on/off times
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);
The 7pm cycle is coming up so I'll see what happens.
I got to start figuring this stuff out. I hate asking for help like this.
Thanks Colin and Roberto.
Re: Multiple on/off times
If you look at the error code, it gives exactly where the problem is:
Steves_Custom_Wave_Sketch:78: error: no matching function for call to 'ReefAngelClass::WaterLevelATO(int, int, double)'
That is the line in your code that is causing the error.
Steves_Custom_Wave_Sketch:78: error: no matching function for call to 'ReefAngelClass::WaterLevelATO(int, int, double)'
That is the line in your code that is causing the error.
Roberto.
Re: Multiple on/off times
OK. I will try harder next time.
I was in a bit of a rush to get that uploaded before the 7pm cycle, so I can see how it works, because the next one is at 1am and I won't be awake to watch that one.
I was in a bit of a rush to get that uploaded before the 7pm cycle, so I can see how it works, because the next one is at 1am and I won't be awake to watch that one.
Re: Multiple on/off times
Oops. Sorry! 

Re: Multiple on/off times
Not your fault Colin.cosmith71 wrote:Oops. Sorry!
Your original code had ReefAngel.WaterLevelATO(Port6,60,75,79);
I changed it to be the settings for my WaterLevlATO which is
ReefAngel.WaterLevelATO(Port6,720,29,31);
I must have typed it wrong while I was doing other stuff at work.
Thanks for the code thought it seems to be working perfectly.
Just finished the 7pm cycle and the ATO did not kick in when the water exchange stopped at 7:20 and the level in the sump was still at 28% because all the water had not returned to the sump yet.
Final step is going to be rewiring the controller that came with the NatuReef De-nitrification chamber so the dosing pump can be plugged into the RA relay.
It won't be hard I looked at it over the weekend, but didn't want to do it until I knew all the other parts were working properly.
Re: Multiple on/off times
Glad it's working for you!
Re: Multiple on/off times
Colin;
Something isn't working with delay for the Water Level.
My water level has been at 26% all morning and the ATO has not turned on to bring the level up.
It's supposed to turn on at 29% and off at 31%
Something in the delay we set up yesterday is not turning the sensor back on.
////// Place global variable code below here
unsigned long ATOUpdate=0;
////// Place global variable code above here
And
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
Something isn't working with delay for the Water Level.
My water level has been at 26% all morning and the ATO has not turned on to bring the level up.
It's supposed to turn on at 29% and off at 31%
Something in the delay we set up yesterday is not turning the sensor back on.
////// Place global variable code below here
unsigned long ATOUpdate=0;
////// Place global variable code above here
And
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
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;
}
}
Re: Multiple on/off times
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.
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.
Re: Multiple on/off times
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.
Re: Multiple on/off times
Yeah, I even created a new variable to hold the status all flags 
ReefAngel.Flags
It currently holds these flags as declared in Globals.h
// Flags bits
#define ATOTimeOutFlag 0
#define OverheatFlag 1
#define BusLockFlag 2
#define LightsOnFlag 3
I just need to put them in /r99 and SendPortal functions.

ReefAngel.Flags
It currently holds these flags as declared in Globals.h
// Flags bits
#define ATOTimeOutFlag 0
#define OverheatFlag 1
#define BusLockFlag 2
#define LightsOnFlag 3
I just need to put them in /r99 and SendPortal functions.
Roberto.
Re: Multiple on/off times
Doesn't it say something on the head unit if it was in a timeout?
I was using the head unit most of the night yesterday and didn't notice and warnings, the screen looked normal to me.
I was using the head unit most of the night yesterday and didn't notice and warnings, the screen looked normal to me.
Re: Multiple on/off times
You would have a red light on the head unit. Do you have the Android app? You can clear it remotely.
Re: Multiple on/off times
The status light would be red?
If that's the case then there is not an ATO time out. I did not see that yesterday.
No I don't have the Android app. I'm not that far into the 21st century yet.
I still have an old Samsung Gravity 3.
My next phone will probably be an Andriod or IPhone when my contract runs out in a couple of weeks.
If that's the case then there is not an ATO time out. I did not see that yesterday.
No I don't have the Android app. I'm not that far into the 21st century yet.
I still have an old Samsung Gravity 3.
My next phone will probably be an Andriod or IPhone when my contract runs out in a couple of weeks.
Re: Multiple on/off times
Ok. I got home and checked and the Status light was not on, just to be sure I went into the menu and cleared the ATO timeout and it still has not started topping off the water.
The water level is at 25% and I know no water went in today because I happened to mark the level it was on the storage tank when I left this morning and it is still at that level.
So something in the new code is not resetting the ATO to start.
I don't know enough to figure it out yet.
The water level is at 25% and I know no water went in today because I happened to mark the level it was on the storage tank when I left this morning and it is still at that level.
So something in the new code is not resetting the ATO to start.
I don't know enough to figure it out yet.
Re: Multiple on/off times
The problem is here...
This is the block of code where your ato is being called.. But it is only called one cycle when the ato update is reset.
// If it's been 120 sec, and the update time is NOT empty
if (now() - ATOUpdate >= 120 && ATOUpdate != 0)
{
ATOUpdate = 0; // Empty out the update time
ReefAngel.WaterLevelATO(Port6,720,29,31); // and turn the ATO sensor back on
}
I rearranged it a bit to be more readable for me,
This is the block of code where your ato is being called.. But it is only called one cycle when the ato update is reset.
// If it's been 120 sec, and the update time is NOT empty
if (now() - ATOUpdate >= 120 && ATOUpdate != 0)
{
ATOUpdate = 0; // Empty out the update time
ReefAngel.WaterLevelATO(Port6,720,29,31); // and turn the ATO sensor back on
}
I rearranged it a bit to be more readable for me,
Re: Multiple on/off times
This is broken too as its only going to cancel your ato port only for one cycle of loop
// Check to see if port 5 is on and update time is empty
if (ReefAngel.Relay.Status(Port5) && ATOUpdate==0)
{
ATOUpdate = now(); // If so, set the update time to now
ReefAngel.Relay.Off (Port6); // and turn off the ATO pump
}
Give me a few minutes to code up a solution...
// Check to see if port 5 is on and update time is empty
if (ReefAngel.Relay.Status(Port5) && ATOUpdate==0)
{
ATOUpdate = now(); // If so, set the update time to now
ReefAngel.Relay.Off (Port6); // and turn off the ATO pump
}
Give me a few minutes to code up a solution...
Re: Multiple on/off times
Ok try this
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
}
Re: Multiple on/off times
Yes, somehow the WaterLevelATO is never being called on to begin with. Deleted somehow?
--Colin
--Colin
Re: Multiple on/off times
Oh, and sorry Steve. Massive fail on my part. 
--Colin

--Colin
Re: Multiple on/off times
No problem man.
At least you tried, more than I can do right now.
If it got deleted it may have been my fault.
At least you tried, more than I can do right now.
If it got deleted it may have been my fault.
