#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
////// 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 = Port5Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 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( 869 );
// Ports that are always on
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardLights( Port1,14,0,22,0 );
ReefAngel.StandardHeater( Port2,770,780 );
ReefAngel.SingleATO( true,Port3,90,0 );
ReefAngel.StandardHeater( Port4,770,780 );
ReefAngel.StandardLights( Port6,22,0,12,0 );
ReefAngel.PWM.SetDaylight( PWMSlope(14,0,22,0,15,100,60,15) );
////// Place your custom code below here
ReefAngel.CustomVar[0]=InternalMemory.read(ATO_Single_Exceed_Flag);
ReefAngel.CustomVar[1]=InternalMemory.read(Overheat_Exceed_Flag);
ReefAngel.CustomVar[7]=255;
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "marcwake" );
ReefAngel.ShowInterface();
}
Trouble with ATO Custom Variable
Trouble with ATO Custom Variable
I have my ATO in single mode and it is working fine but I copied code from the forum to set Custom Var 0 for the ATO Exceed flag. This was working fine for a while but now Custom Var 0 shows as 42 and I can't get it to reset at all. I ran the ATO to timeout and reset the unit but no luck. The ATO is functioning properly but the Custom Var is not.
Re: Trouble with ATO Custom Variable
It will clear it and allow the ATO to work again but has no effect on the Custom Var
Re: Trouble with ATO Custom Variable
It stays 42 on the custom var even when it times out but it stops the ago pump properly
Re: Trouble with ATO Custom Variable
Ok, you just found a major bug 
The libraries are writing to memory constantly when the timeout happens.
There is no check and it is causing the memory to get corrupt.
This is probably happening to the other exceed flags too and need to be corrected.
I opened a ticket for this issue:
https://github.com/reefangel/Libraries/issues/69
In the mean time, you can edit the Globals.h file.
Replace this line:
With this:
We are relocating the memory location and avoiding that particular address.
Thanks for contributing

The libraries are writing to memory constantly when the timeout happens.
There is no check and it is causing the memory to get corrupt.
Code: Select all
#ifdef ENABLE_EXCEED_FLAGS
InternalMemory.write(ATO_Single_Exceed_Flag, 1);
#endif // ENABLE_EXCEED_FLAGS
I opened a ticket for this issue:
https://github.com/reefangel/Libraries/issues/69
In the mean time, you can edit the Globals.h file.
Replace this line:
Code: Select all
#define ATO_Single_Exceed_Flag 733 //747
Code: Select all
#define ATO_Single_Exceed_Flag 800 //733 //747
Thanks for contributing

Roberto.
Re: Trouble with ATO Custom Variable
Ok thanks that seems to have worked. When I first re-uploaded the code the exceed flag was set to 255 but once i cleared the ATO flag it seems to work properly. So does that mean that the old exceed flag memory location is corrupt forever now? Doesn't really matter just wondering. Thanks for the help RA is the best
Re: Trouble with ATO Custom Variable
Yeah, when it gets corrupt, you shouldn't use it anymore.
EEPROM has a write repetition of thousands of cycles, but when you are writing over and over without any check, it gets there pretty quick.
EEPROM has a write repetition of thousands of cycles, but when you are writing over and over without any check, it gets there pretty quick.
Roberto.
Re: Trouble with ATO Custom Variable
Just watch for timeouts until the next lib update gets released or you will end up corrupting this location too.
I'll try to give you the patch before it gets released just to ensure you won't burn that address too.
I'll try to give you the patch before it gets released just to ensure you won't burn that address too.
Roberto.
Trouble with ATO Custom Variable
i was worried about that when i did my vortech code...constantly writing memory...i made my code do a check and only write if the location has changed...may want to consider it, not sure what performance hit would be..
Re: Trouble with ATO Custom Variable
Ya I tended to leave the timeout for a day before I got to topping off my ATO container so that is probably why it happened so fast. I will try to stay on top of it till you get a fix going. Thanks again
Re: Trouble with ATO Custom Variable
It's a good thing you guys are finding all of these "features". 
