ATO alarm putting RA into overheat mode

Related to the development libraries, released by Curt Binder
Post Reply
Sebyte

ATO alarm putting RA into overheat mode

Post by Sebyte »

Hi

Over the past day I have gone "live" with RA on my reef tank. The problem I have is that for some reason I get an ATO alarm (red led on), and RA shuts off my lights and skimmer, which are the options to be turned off for an over heat situation.

I know that the event is not an overheat as I am using the tank water temperature set to 85*f as the overheat point, and the client suite tells me that the temperature range over the last 24hrs has been min 78.4*f and max 81.7*f.

I am using two float switches in series (one set above the other) connected to ATOlow port. I also only have the ATO port live for six periods of on hour per day, 00:00 to 01:00, 04:00 to 05:00, 08:00 to 09"00, 12:00 to 13:00, 16:00 to 17:00, 20:00 to 21:00.

I am also using ATOhi as a PMW output to drive a 5v DC SSR. This controls the mixing pump in my Kalk reactor. As I need to have a settling time for the kalk before I pump water through the reactor into the tank from my RO/DI reservoir, whan the ATO kicks in, ATOhi is available six time per day for half an hour. Starting 30 mins after the ATO period has ended. i.e. 01:30 to 02:00 etc.

(The above has been part of two other postings by myself, and commented on by Roberto and Binder)

Under test I did not notice this happen, but I was not running the ATO sensors or the SSR on ATOhi all the time. I just tested that they cam on and went off at the right times by changing the clock time.

I believe the problem is to do with the use of ATOhi as a PWM output, as the turning off of the lights and skimmer happens during that period. I have set the time out for that port to 255, but as I am not using it as for ATO sensing, it did not make any difference.

I don't understand why I get an overheat shut down caused by an ATO alarm call, and also why I ma getting the alarm in the first place?

I can simply resolve the problem by moving back to time switches and not using the RA, and my have to do that while I fine a solution. But that kind of goes against the grain :roll:

Any ideas?

I am running Dev. Libs 0.8.5.19, and here is my PDE file.
// Autogenerated file by RAGen (v1.1.0.126), (11/19/2011 11:36)
// gold_build.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
 #define DisplayImages
 #define WavemakerSetup
 #define DateTimeSetup
 #define VersionMenu
 #define ATOSetup
 #define MetalHalideSetup
 #define DirectTempSensor
 #define wifi
 #define SingleATOSetup
 #define StandardLightSetup
 #define WDT
 #define CUSTOM_MAIN
 #define ENABLE_ATO_LOGGING
 */


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

#include <avr/pgmspace.h>
// Labels for the web banner
prog_char id_label[] PROGMEM = "sebyte";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "Not%20Used";
prog_char relay1_label[] PROGMEM = "Skimmer";
prog_char relay2_label[] PROGMEM = "ATO";
prog_char relay3_label[] PROGMEM = "Heater";
prog_char relay4_label[] PROGMEM = "Chiller";
prog_char relay5_label[] PROGMEM = "Wave%20Maker";
prog_char relay6_label[] PROGMEM = "Pumps";
prog_char relay7_label[] PROGMEM = "Actinics";
prog_char relay8_label[] PROGMEM = "Daylight";
PROGMEM const char *webbanner_items[] = {
  id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
  relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};

void DrawCustomMain()
{
  // the graph is drawn/updated when we exit the main menu &
  // when the parameters are saved
  ReefAngel.LCD.DrawDate(6, 112);
  pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}

void DrawCustomGraph()
{
  ReefAngel.LCD.DrawGraph(5, 5);
}


void setup()
{
  ReefAngel.Init();  //Initialize controller
  // Initialize and start the web banner timer
  ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
  ReefAngel.Timer[4].SetInterval(180);  // set interval to 180 seconds
  ReefAngel.Timer[4].Start();

 
  ReefAngel.FeedingModePorts = B00110001;
  ReefAngel.WaterChangePorts = B00111111;
  ReefAngel.OverheatShutoffPorts = B11000001;
  ReefAngel.LightsOnPorts = B11000000;
  
  // Change Overheat Temperature Probe from (default Temp2) to Temp1
  ReefAngel.OverheatTempProbe = &ReefAngel.Params.Temp1;

  // Ports that are always on
  ReefAngel.Relay.On(Port1);
  ReefAngel.Relay.On(Port6);
  
 

}

void loop()
{
  // Specific functions
  ReefAngel.SingleATOLow(Port2);
  ReefAngel.StandardHeater(Port3);
  ReefAngel.StandardFan(Port4);
  ReefAngel.Wavemaker1(Port5);
  ReefAngel.StandardLights(Port7);
  ReefAngel.MHLights(Port8);

  // ATO available 6 times per day - 00:00 to 01:00, 04:00 to 05:00, 08:00 to 09:00, 12:00 to 13:00, 16:00 to 17:00, 20:00 to 21:00,


  if (hour() % 4 == 0 && ReefAngel.LowATO.IsActive()) //Rev made 19/11/11
  {

    ReefAngel.Relay.On(Port2);
  }
  else
  { 
    ReefAngel.Relay.Off(Port2);
  }


  // Kalk Reactor available 6 times per day - 01:30 to 2:00, 05:30 to 06:00, 09:30 to 10:00,
  // 13:30 to 14:00, 17:30 to 18:00, 21:30 to 2:00.

  if (hour() % 4 == 1 && minute()>30)
  {
    pinMode(highATOPin,OUTPUT);
    digitalWrite(highATOPin,HIGH); // Turn on Solid State Relay
  }
  else
  {
    pinMode(highATOPin,OUTPUT);
    digitalWrite(highATOPin,LOW); // Turn off Solid State Relay
  } 


  // Wavemaker not available 9 pm to 10 am

  if ( (hour() >= 20) || (hour() <= 9) )
  {

    ReefAngel.Relay.Off(Port5);

   }


  // Web Banner stuff
  if(ReefAngel.Timer[4].IsTriggered())
  {
    ReefAngel.Timer[4].Start();
    ReefAngel.WebBanner();
  }

  ReefAngel.ShowInterface();
}




rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

I'm still investigating this issue.
I had the same problem and Marcelo from Brazil is also getting something similar.
I started a thread, but never had the time to investigate this further.
http://forum.reefangel.com/viewtopic.php?f=7&t=432
We all have the custom screen in common.
My suspicion was the custom screen that is causing this and I suspected of ConvertNumToString() function in particular was the culprit.
But, by looking at your code, you are not even using this function.
So, let me finish some of the things I wanted to get done today and I'll tackle this in the evening.
Roberto.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

Many thanks Robert.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

I don't see anything wrong with your code and I can't replicate the problem either.
One thing that has nothing to do with the problem you are having is the below line that is doing nothing to you:

Code: Select all

ReefAngel.SingleATOLow(Port2);
The only thing I can think of is to remove this from your features file:

Code: Select all

 #define DirectTempSensor
Give it a try and let me know if it helps.
Roberto.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

Had a look at features.h and found

Code: Select all

 // #define DirectTempSensor
, so it was not active anyway.

The ATO, kalk mix cycle has just finished, and I got an ATO alarm and red light, with lamps and skimmer going off during the ATO available period. Nothing happened during the kalk mix time.

I am really at a loss as to what to do, I will remove

Code: Select all

ReefAngel.SingleATOLow(Port2);
from my PDE file, and see what happens at the next ATO available period which starts at 8pm.

I will let you know what happens, but I have a feeling that nothing has changed :cry:
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

I have sat through several cycles and I think that I am getting a genuine ATO timeout alarm with red LED. Also I have not seen the lamps and skimmer turn off like before, will keep watching for that.

I have noticed that on one occasion at 4min 36sec after the start of ATO being available the LED came on. Also the ATO pump was still running.

Because I top off with Kalkwasser I pump it in slow and I guess that I am exceeding the pre-sets.

I have looked at http://forum.reefangel.com/viewtopic.php?f=12&t=192

And it would seem that you can eliminate the ATO timeout function by editing ReefAngel.cpp. I am not happy with altering the Dev Files and having a non standard library. Is there another way that I can either remover the Alarm, or better still increase it to say six minutes?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

If you removed the SingleATOLow() from your code, it can't be ATO timeout.
That would only occur if you had the function in your loop() section.
What happens if you remove or comment out this line?

Code: Select all

  ReefAngel.OverheatTempProbe = &ReefAngel.Params.Temp1;
Roberto.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

I removed

Code: Select all

 ReefAngel.OverheatTempProbe = &ReefAngel.Params.Temp1;
I ran the ATO cycle without any alarm coming on, so that piece of code seems to be the culprit! Why would that be?

Now that the above code has been removed, is there a way I can have an overheat call at 85*f based on the water temperature, keeping in mind I am using Temp1 probe in the water.

I do have a second probe which is measuring the room temperature that I could switch to a different use. I could then buy a third probe later for room temperature measurement although that is not critical.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: ATO alarm putting RA into overheat mode

Post by binder »

hmmm... it appears to be a pointer reference error. that is odd. looks like i need to make some changes to how i alter the overheat checks. good catches. i was afraid this was the case based on the previous errors.

curt
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

I will watch and wait for your conclusion.

Best wishes
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

Hi Roberto, and Curt,

The system has behaved itself all week until just now.

At exactly 5pm, the RA went into an overheat condition with red LED on. I checked to see if it was an ATO alarm as 5pm is the end of one of the ATO available periods. But it needed the overheat to be reset. The tank was 80.4*f and the room 76.5*f, so nothing was overheating.

The lamps and skimmer shutdown and the canceling of the overheat brought them back on.

The strange thing was that the wifi was unavailable to the client app as well as the iPAD app. I had to do a hard reset to clear the condition. (unplug from mains)

I am concerned that should this happen when I am not around, and I do travel away from home for several days at atime, the tank will drop temperature and the lamps will stay off. If the wifi has also become unavailable I would not be able to reset things remotely. This was the main reason for getting RA.

Any advice will be very welcome.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

The same thing happened at 6pm, which is the end of the Kalk mixing period.

What is going on?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

Ok, I just can't understand why this is happening.
Can you try using the standard display instead of the custom main. That's the only thing left.
If it is not that, we are going to have to replace your unit, but I doubt it is hardware because it comes back when you reset the overheat.
There is something tripping that overheat flag.
Roberto.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

I will change the display tomorrow and see how it goes. Also I will swap Temp1 and Temp2. As I understand it Temp2 is the default overheat sensor, just incase it is effecting the logic in the Dev libs. My code is using Temp1 to control the heater and chiller.

It just seems strange that it worked ok for the period of time and then reoccurred.

Another thought I have is could it be stray currents in the tank? Say that the wave maker kicked in at the same moment the two time periods ended. I am just clutching at straws, but I could install an earthing rod to the tank if you thought it might help.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: ATO alarm putting RA into overheat mode

Post by binder »

Could you post the current PDE & Features file that you are using? I know you posted the original ones but we've made changes and I want to make sure that I'm following along properly. I've got an idea but I want to confirm what you've got before I proceed.

curt
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

Here are my current files, and I will not make any changes until you have commented on the below.

ReefAngel_Features.h

Code: Select all

/*
 * Copyright 2010 Curt Binder
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __REEFANGEL_FEATURES_H__
#define __REEFANGEL_FEATURES_H__

/*
This contains all the defines for enabling/disabling features with the controller software.

This file can be AutoGenerated by using the RAGenFeatures program.
*/

/*
If your sketch/compile size is getting too big or if you are running out of RAM and having bizarre events
happen with the controller, you may want to not display the graphics on screen which can save some memory.
Just comment out the next line to prevent any graphics from being displayed, you will have text only screens
during water changes and feeding modes.

Approximately 346 bytes to have this feature
*/
#define DisplayImages  // do we display the graphics for feeding or water change mode

/*
The next line is for displaying the setup screens to configure the values for the Feeding Mode timer and
the LCD shutoff timer.  The defaults are fine, BUT if you would like to have the ability to change them
from the setup screen, uncomment the next line.  This will increase the file size.  If you do not plan
to change these values often (or at all), keep the next line commented out.

Approximately 362 bytes to have this feature
*/
//#define SetupExtras  // feeding mode & screensaver timeout setup. ACTIVATE WITH CAUTION

/*
Since we may or may not need to always configure the Wavemakers, give the option to
turn off the setup screens to keep the compile size down.  You can still use the Wavemakers,
you just will not have the setup screen available to configure the values.  You will have to manually set
the intervals inside the Sketch (hardcode or have it read from memory if the memory contains the correct values).

Approximately 378 bytes to have WavemakerSetup
*/
//#define WavemakerSetup

/*
These next two options are for the Dosing Pumps.  They operate differently, so read carefully to determine
what option you want.

DosingPumpSetup
  Allows for specifying a specific time in which you want the dosing pump to turn on and run for.
  It only runs once per day and for the specified duration/run time.
  This feature will allow you to configure the start time and run time from the setup screens.

DosingPumpIntervalSetup
  Allows for specifying a minute interval that you would like the pump to turn on and run for.
  It runs every minute interval for the entire day.  It's start time is based off of midnight of the current day.
  If you specified a 60 minute interval, it will run for the specified duration every hour.
  This feature will allow you to configure the minute interval and run time from the setup screens.

Both options use the same Run Time that is stored in memory, so you will only be able to use one or the other
if you plan on configuring the run time from the setup screens.  If you use the hard coded values, you won't
need to use these options and you can use separate run times.

You can still use the DosingPump and DosingPumpInterval functions without these options,
you will just need to have the memory already be set or specifically set the values in the PDE file.
You just will not be able to change the values from the controller's setup screen.

Approximately 2000 bytes to have DosingPumpSetup
Approximately 368 bytes to have DosingPumpIntervalSetup
*/
//#define DosingPumpSetup
//#define DosingPumpIntervalSetup


/*
Overheat Temperature is fairly constant.  This value will most likely not get changed very often (if ever).
The default value is set to 150.0F.  Once this value is reached, all the lights will get shutoff.  If you
would like the ability to change this value from the menus, uncomment the next line.  Otherwise you will have
to hardcode the value in the ShowInterface Function

Approximately 156 bytes to have this feature
*/
//#define OverheatSetup

/*
The ability to set the Date & Time on the controller is controlled by this next line.  This line will add
in a Date / Time Setup menu entry which will allow you to set the date & time on the controller easily.
Comment the next line to remove this ability.

Approximately 1984 bytes to have this feature
*/
#define DateTimeSetup

/*
If you do not want to have a Version menu entry to see what version of the software is on the controller,
then you will want to comment out the next line

Approximately 144 bytes to have this feature
*/
#define VersionMenu

/*
If you do not use any of the ATO features in your setup, you can comment out this next line to remove
the ATO set and clear menu items.

Approximately 900 bytes to have this feature (and without SetupExtras)

When this or SetupExtras are defined, the Timeouts menu is included.
Timeouts menu requires approximately 710 bytes
This feature requires approximately 190 bytes if SetupExtras is defined
*/
//#define ATOSetup

/*
This item will remove all lighting functionality from the controller.  It is the equivalent to
commenting out MetalHalideSetup, StandardLightSetup, DisplayLEDPWM
This will OVERRIDE any of the other defines.  So use caution when enabling this feature.

Approximately 2796 bytes to have this feature
*/
//#define RemoveAllLights

/*
If you do not use metal halides and do not wish to have any of the setup screens on your controller,
you can comment out the next line to remove the Metal Halide Setup and Metal Halide Delay

Approximately 258 bytes to have this feature
*/
//#define MetalHalideSetup

/*
If you do not use standard lights and do not wish to have the setup screens on your controller,
you can comment out the next line to remove the Standard Lights Setup

Approximately 90 bytes to have this feature
*/
//#define StandardLightSetup

/*
If you want to use the old way of reading the temp sensor which is always reading the value in
and not performing any sanity check, then you will want to uncomment this next line.

Otherwise, you will use the new way to handle the temperatures.  The value is read in and then
compared to the existing value.  If the difference between the 2 values is less than MAX_TEMP_SWING
or the temperature is 0 then the temperature is allowed to be updated, otherwise it is not updated.
MAX_TEMP_SWING is currently set to 50, which is 5.0 F.  This prevents any temporary large fluctations
in temperatures.  Also, there should not be more than a 5.0 F degree fluctation in 1 second.
*/
//#define DirectTempSensor

/*
Do we save the relay state before we enter Feeding Mode or Water Change Mode?

Comment out the next line to not save the state and always force specific ports to be turned off and then
back on again after we exit the mode.  This can turn on some ports that were not already on.  This
is also how the controller originally works.

Currently untested.
*/
//#define SaveRelayState

/*
If you have the wifi module for your controller and wish to use it, you must uncomment this next line
to utilize the built-in webserver for the controller.

If enabled, you may want to consider enabling SIMPLE_MENU and disabling DateTimeSetup to save space.
This is advisable since all settings can be updated via the wifi interface.

Approximately 5000+ bytes to have this feature. This size can vary.
*/
#define wifi

/*
This next line will control the displaying of all LED PWM related items.  The items it controls are:

DP & AP displaying on main screen
LED PWM Setup screen

So, if you do not use LED PWM's at all and do not wish to display anything related to it, comment out
the next line and all that stuff will be removed.

Approximately 720 bytes to have this feature
*/
#define DisplayLEDPWM

/*
PWM Expansion Device

This next line will allow the enabling of the PWM Expansion Device.  It will add a menu entry that displays
"PWM ->".  It will give the preset defaults for the expansion device.
The menu entries will be:

Slow Cloud
Fast Cloud
T-storm 1
T-storm 2
0%
50%
100%
Custom

Approximately 630 bytes to have this feature
*/
//#define PWMEXPANSION

/*
This next line will allow you to use the ATO switches independently from each other.  You can specify
separate ports to control, separate timeouts and separate hourly intervals.
If you have this defined, you cannot use both switches together like originally intended.
The setup screens will show configurations for both switches.

Approximately 454 bytes to have this feature
*/
//#define SingleATOSetup

/*
If this next line is uncommented, you must include the following lines in
the PDE file at the top above all other include statements:
#include <ReefAngel_Colors.h>
#include <ReefAngel_CustomColors.h>
*/
//#define COLORS_PDE

/*
This will enable code for multiple expansion modules.  If you have expasion modules this must
be enabled to make use of them.

If you have more than 1 expansion module, you will need to uncomment and adjust the number of
expansion modules.  If it's left commented out, it is assumed to have 1 expansion module.  This
is only necessary when 2 or more modules are enabled so the web banner data gets sent
appropriately and possibly other enhancments in the future (in an attempt to keep code size
down and make the controller more customized for the user)

Approximately 530 bytes to have RelayExp
Approximately 94, 176 or 270 additional bytes needed when increasing InstalledRelayExpansionModules
*/
//#define RelayExp
//#define InstalledRelayExpansionModules	1

/*
This will enable the ability for people to create a custom main screen with the complete menu system
and without having to modify the libraries.
Once this is defined/enabled, you MUST create the following functions inside your PDE file.  If you do
not, then you will receive errors about missing functions.  If you create them and leave them blank,
you will have a blank main screen.  :)

void DrawCustomMain()
{
}
void DrawCustomGraph()
{
}

Just copy and paste the framework of the functions above into your PDE file.

If you do not want a graph to be displayed, you can leave it blank/empty.
*/
//#define CUSTOM_MAIN


/*
This is for the simplified menu.  All the additional / extra menus have been stripped down.
The bare basics are only left for operating on the controller.  This is useful for those who want
all the extra memory they can get on the controller.  Also for those who hardcode their values or
use the Client Suite (or other app or SetInternalMemory PDE) to update their memory values.

The menu system only contains:
	- Feeding Mode
	- Water Change Mode
	- ATO Clear
	- Overheat Clear
	- PH Calibration
	- Date / Time Setup (ability to be removed)
	- Version Menu (ability to be removed)

When this is enabled, the following other features are ignored, you can still use the functions,
you just won't have a setup menu for them:
	- StandardLightsSetup
	- MetalHalideSetup
	- ATOSetup
	- DosingPumpSetup
	- DosingPumpIntervalSetup
	- WavemakerSetup
	- SingleATOSetup

The following features are available for use with this feature:
	- DisplayLEDPWM / RemoveAllLights - shows or hides the LED PWM values on the main screen, no setup menu
	- wifi
	- SaveRelayState
	- DirectTempSensor
	- VersionMenu
	- DateTimeSetup
	- DisplayImages
	- CUSTOM_MAIN
	- COLORS_PDE
	- RelayExp
	- InstalledRelayExpansionModules

The following features partially work.  There is no setup menu for them, BUT if you want to use
the Internal Memory values for them you must enable the features:
	- SetupExtras (Feeding Timer and LCD Timeout Timer)
	- OverheatSetup (Change the overheat temperature)

Approximately 4566 bytes removed when using the Simplified Menu
*/
#define SIMPLE_MENU

/*
This option allows for the user to handle the menu in their PDE file

This option OVERRIDES SIMPLE_MENU

To use, you must enable CUSTOM_MENU AND define how many entries you want in your menu.
To define how many entries, you must change the number after CUSTOM_MENU_ENTRIES below.

When you enable this, you have to add several items to your PDE file.  You will be creating your menu
at the top of the file just like in the Standard Libraries.  You will also need to create the menu entry
functions associated with all of your menu entries.

To create the menu entries, use this code:

#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Item 1";
prog_char menu1_label[] PROGMEM = "Item 2";
prog_char menu2_label[] PROGMEM = "Item 3";
prog_char menu3_label[] PROGMEM = "Item 4";
prog_char menu4_label[] PROGMEM = "Item 5";
prog_char menu5_label[] PROGMEM = "Item 6";
prog_char menu6_label[] PROGMEM = "Item 7";
prog_char menu7_label[] PROGMEM = "Item 8";
prog_char menu8_label[] PROGMEM = "Item 9";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label,
menu3_label, menu4_label, menu5_label,
menu6_label, menu7_label, menu8_label
};

Only include the number of menu items that you are going to use.  If you add more than needed, it can cause problems.
So just copy and paste, remove the labels (starting from 8 and going down) until you get the total number you need.
Then change the string to be something you want.  There is a max of 20 characters per item.

Next, we must create the menu entry functions for use.  Use this code:

void MenuEntry1()
{
  ReefAngel.DisplayMenuEntry("Item 1");
}
void MenuEntry2()
{
  ReefAngel.DisplayMenuEntry("Item 2");
}
void MenuEntry3()
{
  ReefAngel.DisplayMenuEntry("Item 3");
}
void MenuEntry4()
{
  ReefAngel.DisplayMenuEntry("Item 4");
}
void MenuEntry5()
{
  ReefAngel.DisplayMenuEntry("Item 5");
}
void MenuEntry6()
{
  ReefAngel.DisplayMenuEntry("Item 6");
}
void MenuEntry7()
{
  ReefAngel.DisplayMenuEntry("Item 7");
}
void MenuEntry8()
{
  ReefAngel.DisplayMenuEntry("Item 8");
}
void MenuEntry9()
{
  ReefAngel.DisplayMenuEntry("Item 9");
}

Remove the functions that you do not need.  The above code just displays the text in the string on the display.
You can remove that line and put whatever you want in the function.
*/
//#define CUSTOM_MENU
// max of 9 entries
//#define CUSTOM_MENU_ENTRIES		6


/*
Alternate Fonts

To use the alternate fonts, you must uncomment the appropriate define statement to make the font available.
Once the font is available, it is not automatically used everywhere.  It's not used with the default main screen
and default menus.  You must enable the CUSTOM_MAIN so you can make use of the font when drawing your own main
screen.

There are full fonts for the sizes:  5x8 (built in), 8x8, 8x16, 12x16
There are numbers only for sizes:  8x8, 8x16, 12x16, 16x16

How to use:

Font 8x8:
ReefAngel.NokiaLCD.DrawLargeText(..., Font8x8);

Numbers 8x8:
ReefAngel.NokiaLCD.DrawLargeText(..., Num8x8);

Font 8x16:
ReefAngel.NokiaLCD.DrawLargeText(..., Font8x16);

Numbers 8x16:
ReefAngel.NokiaLCD.DrawLargeText(..., Num8x16);

Font 12x16:
ReefAngel.NokiaLCD.DrawHugeText(..., Font12x16);

Numbers 12x16:
ReefAngel.NokiaLCD.DrawHugeText(..., Num12x16);

Numbers 16x16:
ReefAngel.NokiaLCD.DrawHugeNumbers(...);

The ... means that the default parameters for the functions should be used.  It is just a place holder.
The DrawHugeNumbers needs to have the numbers drawn in a string, so it cannot take numeric values,
they must be converted prior to calling the function.

Enabling fonts requires more memory usage.  The more fonts you enable, the more memory is used.  It is advisable
to only enable the fonts that you plan on using.  Try to not use several at once to keep memory usage down.

ENABLE AT YOUR OWN RISK
*/
//#define FONT_8x8
//#define FONT_8x16
//#define FONT_12x16
//#define NUMBERS_8x8
//#define NUMBERS_8x16
//#define NUMBERS_12x16
//#define NUMBERS_16x16

/*
Watchdog Timers

With the optiboot bootloader, enabling the watchdog timer is possible.  You must have version 4 of the
optiboot booloader installed on the controller for this to work.  Once enabled, the watchdog timer must
be reset/tickled/touched periodically or else the controller will reboot.

If enabled, there is a check on controller initialization that verifies the proper bootloader is installed
before enabling the watchdog timer.
This option is called WDT.  This option also overrides WDT_FORCE (mentioned below).

There is also another option for people who have the optiboot bootloader prior to version 4.  There is only
a couple people who fall into this category.  This option should not be enabled unless instructed to do so.
Enabling this option otherwise could potentially cause problems with your controller.
This option is called WDT_FORCE.

Approximately 82 bytes to have Watchdog Enabled (WDT).
*/
// Watchdog Timer
//#define WDT
// Force Watchdog Timer - DO NOT ENABLE UNLESS TOLD TO DO SO
//#define WDT_FORCE

/*
Enable Exceeded flags

The red LED on the controller gets turned on when either the Overheat temp is reached OR if the ATO timeout is exceeded.
You do not know which event is the the one that caused the LED to turn on.  When you clear either event the LED is turned
off and you do not the other event was triggered.

Enabling this feature will keep track of which event caused the LED to be turned on.  The event gets stored in the internal
memory.  To know what event triggered the LED, you have to add in a display on your CUSTOM_MAIN screen to perform a check
or query the controller in the specified memory spaces to check.  When you clear the event (either ATO or Overheat), the event
is cleared from memory.  The time the event occurs is not logged only that the event did occur.

The memory locations are as follows:

ATO_Exceed_Flag
ATO_Single_Exceed_Flag
Overheat_Exceed_Flag

The ATO Clear will clear both the Standard ATO and Single ATO events.  Currently, there is no distinction between ATO High and
Low events.  This may be added in the future though.

This should only be enabled if you are running a custom main screen because you have to code it manually to display.

Approximately 68 bytes to enable the storing of the exceeded flags (not counting displaying them on the screen)
*/
//#define ENABLE_EXCEED_FLAGS

/*
ATO Event Logging

Enabling will log the ATO events to the internal memory for later querying from another application
such as Client Suite.  This will help catch the ATO events that occur between the logging intervals.
Only useful to enable if you have WIFI enabled as well.

Request ato events with /sa
Events logged with a max of 4 events (4 low / 4 high)
	Standard ATO events are logged with the atolow
	SingleATO events are logged either high or low
Logs are cleared when request for log information is sent

Structure of XML data being sent to requestor is:
	<AL#ON>VALUE</AL#ON>
	<AL#OFF>VALUE</AL#OFF>
	<AH#ON>VALUE</AH#ON>
    <AH#OFF>VALUE</AH#OFF>
Where # is the event number from 0 - 3
VALUE is the number of seconds since the epoc (jan 1, 1970)
*/
//#define ENABLE_ATO_LOGGING

/*
Special prototype PLUS board with built-in WIFI module.  Only 1 exists and Curt Binder has it.
Do NOT enable.  Code will not compile with this enabled.
*/
//#define __PLUS_SPECIAL_WIFI__

/*
Salinity Module

Uncomment this next line if you have a Salinity Module that you would like to use.  You will want to
use a custom main screen as well to display the Salinity values for you.  You must also put this line
in your PDE file above the ReefAngel.h include line:

#include <ReefAngel_Salinity.h>  // <-- Add this line
#include <ReefAngel.h>  // <-- Add above this line

If you do not, you will get an error compiling.

Approximately 208 bytes to enable this feature
*/
//#define SALINITYEXPANSION

/*
RF Module

This module is used to control Vortech pumps.  Enable this feature if you want that control.
You will have to add in this line above the ReefAngel.h include:

#include <ReefAngel_RF.h>  // <-- add this line
#include <ReefAngel.h>  // add above this line

Approximately 346 bytes to enable this feature
*/
//#define RFEXPANSION

/*
AI LED

This features the ability to control the AI LED's.
You will have to add in this line above the ReefAngel.h include:

#include <ReefAngel_AI.h>  // <-- add this line
#include <ReefAngel.h>  // add above this line

Approximately 382 bytes to enable this feature
*/
//#define AI_LED

#endif  // __REEFANGEL_FEATURES_H__
Current PDE file

Code: Select all

 // Autogenerated file by RAGen (v1.1.0.126), (11/28/2011 13:34)
// RA_112811_1334.pde
// gold_build.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define WavemakerSetup
#define DateTimeSetup
#define VersionMenu
#define ATOSetup
#define MetalHalideSetup
#define DirectTempSensor
#define wifi
#define SingleATOSetup
#define StandardLightSetup
#define WDT
#define CUSTOM_MAIN
#define ENABLE_ATO_LOGGING
*/


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

#include <avr/pgmspace.h>
// Labels for the web banner
prog_char id_label[] PROGMEM = "sebyte";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "Not%20Used";
prog_char relay1_label[] PROGMEM = "Skimmer";
prog_char relay2_label[] PROGMEM = "ATO";
prog_char relay3_label[] PROGMEM = "Heater";
prog_char relay4_label[] PROGMEM = "Chiller";
prog_char relay5_label[] PROGMEM = "Wave%20Maker";
prog_char relay6_label[] PROGMEM = "Pumps";
prog_char relay7_label[] PROGMEM = "Actinics";
prog_char relay8_label[] PROGMEM = "Daylight";
PROGMEM const char *webbanner_items[] = {
    id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
	relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};

void DrawCustomMain()
{
	// the graph is drawn/updated when we exit the main menu &
	// when the parameters are saved
	ReefAngel.LCD.DrawDate(6, 112);
	pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
	ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
		ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
	ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
	pingSerial();
	byte TempRelay = ReefAngel.Relay.RelayData;
	TempRelay &= ReefAngel.Relay.RelayMaskOff;
	TempRelay |= ReefAngel.Relay.RelayMaskOn;
	ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}

void DrawCustomGraph()
{
	ReefAngel.LCD.DrawGraph(5, 5);
}


void setup()
{
    ReefAngel.Init();  //Initialize controller
    // Initialize and start the web banner timer
    ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
    ReefAngel.Timer[4].SetInterval(180);  // set interval to 180 seconds
    ReefAngel.Timer[4].Start();

    ReefAngel.FeedingModePorts = B00110001;
    ReefAngel.WaterChangePorts = B00111111;
    ReefAngel.OverheatShutoffPorts = B11000001;
    ReefAngel.LightsOnPorts = B11000000;

    // Ports that are always on
    ReefAngel.Relay.On(Port1);
    ReefAngel.Relay.On(Port6);
    
     // ***************** commented out at request of Roberto 28/11/11  *******************
     // Change Overheat Temperature Probe from (default Temp2) to Temp1
 // ReefAngel.OverheatTempProbe = &ReefAngel.Params.Temp1; 
  
}

void loop()
{
    // Specific functions
   // ReefAngel.SingleATOLow(Port2);  // commented out 28-11-11 - rimai saying not needed
    ReefAngel.StandardHeater(Port3);
    ReefAngel.StandardFan(Port4);
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.StandardLights(Port7);
    ReefAngel.MHLights(Port8);
    
// ATO available 6 times per day - 00:00 to 01:00, 04:00 to 05:00, 08:00 to 09:00, 12:00 to 13:00, 16:00 to 17:00, 20:00 to 21:00,


  if (hour() % 4 == 0 && ReefAngel.LowATO.IsActive()) //Rev made 19/11/11
  {

    ReefAngel.Relay.On(Port2);
  }
  else
  { 
    ReefAngel.Relay.Off(Port2);
  }


  // Kalk Reactor available 6 times per day - 01:30 to 2:00, 05:30 to 06:00, 09:30 to 10:00, 
  // 13:30 to 14:00, 17:30 to 18:00, 21:30 to 2:00.

  if (hour() % 4 == 1 && minute()>30) 
  {
    pinMode(highATOPin,OUTPUT);
    digitalWrite(highATOPin,HIGH); // Turn on Solid State Relay
  }
  else
  {
    pinMode(highATOPin,OUTPUT);
    digitalWrite(highATOPin,LOW); // Turn off Solid State Relay
  } 


  // Wavemaker not available 9 pm to 10 am

  if ( (hour() >= 20) || (hour() <= 9) ) 
  {

    ReefAngel.Relay.Off(Port5);

   }

     // Web Banner stuff
    if(ReefAngel.Timer[4].IsTriggered())
    {
        ReefAngel.Timer[4].Start();
        ReefAngel.WebBanner();
    }

	ReefAngel.ShowInterface();
}
Hope you find something :?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

What is your overheat temperature?
Have you checked to see if it does indeed shut the ports at the specified temperature?
Roberto.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

The overheat setting in memory is 85*f. My intention was to have an overheat shut-down if the water temperature measured by Temp1 should go above that point. When I had the line of code-

Code: Select all

ReefAngel.OverheatTempProbe = &ReefAngel.Params.Temp1;
in my PDE, I had tested and found that if the probe went over 85 it did shut-down the lights and skimmer (ports 1,7&8)

The PDE now has that line of code commented out as you can see, I have just heated the Temp 1 probe in a fresh cup of Coffey and the temperature peaked at 158*f, and nothing tripped.

Based on that I cannot see how I am reaching an overheat state.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

With that line commented out, the default probe for overheat is Temp2.
Can you dip Temp2 probe in the coffee?
Does it trip the overheat?
Roberto.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

As soon as I put the probe in the Coffey RA went into an overheat. I cooled the probe and did a reset. Then to take things more slowly I griped the probe in my hand and watched the temperature change on my iPAD. At 85 we has an overheat trip.

I have looked at the temperatures for the past week in the client suit (see attached graph) and the temperature for both probes has never reached 85*f When you hover the mouse pointer over the displayed temperatures in the client they display as follows.

Water (Temp1) Min-00 Max-81.1 Ave-78.9

Room (Temp2) Min 00 Max 80.7 Ave 76.6
Attachments
Temperatures last week.JPG
Temperatures last week.JPG (41.46 KiB) Viewed 6700 times
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

Ok, let's try using the standard main screen.
If it still gives you problems, PM me to arrange replacement.
Roberto.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

I have run RAgen and built a PDE with standard menu, but retaining my custom code. Lets see how that works!

If this proves to be the issue, does that mean that I will not be able in the future to have custom screens? My next project is to build a custom LED lighting system and then implement the RA control and I thought that I might need to have custom screens to free up memory. That project is at least a month away.

Thanks for your help on this and I will PM you with update.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

Absolutelly not.
If this turns out to be the case, we know for sure that the bug is in the Custom Main part of the code.
What I'm trying to do here is to identify where the problem lies.
Once the bug is found, we can fix it. The problem is that we don't know where it is at this point. :(
Roberto.
Sebyte

Re: ATO alarm putting RA into overheat mode

Post by Sebyte »

I have sent you a couple of PMs, not sure if they have been sent as they are still showing in my out box.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO alarm putting RA into overheat mode

Post by rimai »

I'd like you to load this code. It will display the max temp registered for each T1 and T2 probes.
I modified from the previous one you posted.

ReefAngel_Features.h file:

Code: Select all

/*
* Copyright 2010 Curt Binder
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef __REEFANGEL_FEATURES_H__
#define __REEFANGEL_FEATURES_H__


#define DateTimeSetup
#define VersionMenu
#define wifi
#define CUSTOM_MAIN
#define WDT

#endif  // __REEFANGEL_FEATURES_H__
PDE file:

Code: Select all

// Autogenerated file by RAGen (v1.1.0.126), (11/28/2011 13:34)
// RA_112811_1334.pde
// gold_build.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define WavemakerSetup
#define DateTimeSetup
#define VersionMenu
#define ATOSetup
#define MetalHalideSetup
#define DirectTempSensor
#define wifi
#define SingleATOSetup
#define StandardLightSetup
#define WDT
#define CUSTOM_MAIN
#define ENABLE_ATO_LOGGING
*/


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

#include <avr/pgmspace.h>
// Labels for the web banner
prog_char id_label[] PROGMEM = "sebyte";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "Not%20Used";
prog_char relay1_label[] PROGMEM = "Skimmer";
prog_char relay2_label[] PROGMEM = "ATO";
prog_char relay3_label[] PROGMEM = "Heater";
prog_char relay4_label[] PROGMEM = "Chiller";
prog_char relay5_label[] PROGMEM = "Wave%20Maker";
prog_char relay6_label[] PROGMEM = "Pumps";
prog_char relay7_label[] PROGMEM = "Actinics";
prog_char relay8_label[] PROGMEM = "Daylight";
PROGMEM const char *webbanner_items[] = {
    id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
   relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label};
   
int t1max=0;
int t2max=0;

void DrawCustomMain()
{
   // the graph is drawn/updated when we exit the main menu &
   // when the parameters are saved
   ReefAngel.LCD.DrawDate(6, 112);
   pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
   ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
      ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
   ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
   pingSerial();
   byte TempRelay = ReefAngel.Relay.RelayData;
   TempRelay &= ReefAngel.Relay.RelayMaskOff;
   TempRelay |= ReefAngel.Relay.RelayMaskOn;
   ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
   if (t1max<ReefAngel.Params.Temp1) t1max=ReefAngel.Params.Temp1;
   if (t2max<ReefAngel.Params.Temp2) t2max=ReefAngel.Params.Temp2;
  char text[10];
  ConvertNumToString(text, t1max, 10);
  strcat(text,"  ");
  ReefAngel.LCD.DrawText(T1TempColor, DefaultBGColor, 10, 10, "T1 Max:");
  ReefAngel.LCD.DrawText(T1TempColor, DefaultBGColor, 55, 10, text);
  ConvertNumToString(text, t2max, 10);
  strcat(text,"  ");
  ReefAngel.LCD.DrawText(T2TempColor, DefaultBGColor, 10, 20, "T2 Max:");
  ReefAngel.LCD.DrawText(T2TempColor, DefaultBGColor, 55, 20, text);

  pingSerial();

}

void DrawCustomGraph()
{
}


void setup()
{
    ReefAngel.Init();  //Initialize controller
    // Initialize and start the web banner timer
    ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
    ReefAngel.Timer[4].SetInterval(180);  // set interval to 180 seconds
    ReefAngel.Timer[4].Start();

    ReefAngel.FeedingModePorts = B00110001;
    ReefAngel.WaterChangePorts = B00111111;
    ReefAngel.OverheatShutoffPorts = B11000001;
    ReefAngel.LightsOnPorts = B11000000;

    // Ports that are always on
    ReefAngel.Relay.On(Port1);
    ReefAngel.Relay.On(Port6);
    
     // ***************** commented out at request of Roberto 28/11/11  *******************
     // Change Overheat Temperature Probe from (default Temp2) to Temp1
// ReefAngel.OverheatTempProbe = &ReefAngel.Params.Temp1; 
  
}

void loop()
{
    // Specific functions
   // ReefAngel.SingleATOLow(Port2);  // commented out 28-11-11 - rimai saying not needed
    ReefAngel.StandardHeater(Port3);
    ReefAngel.StandardFan(Port4);
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.StandardLights(Port7);
    ReefAngel.MHLights(Port8);
    
// ATO available 6 times per day - 00:00 to 01:00, 04:00 to 05:00, 08:00 to 09:00, 12:00 to 13:00, 16:00 to 17:00, 20:00 to 21:00,


  if (hour() % 4 == 0 && ReefAngel.LowATO.IsActive()) //Rev made 19/11/11
  {

    ReefAngel.Relay.On(Port2);
  }
  else
  { 
    ReefAngel.Relay.Off(Port2);
  }


  // Kalk Reactor available 6 times per day - 01:30 to 2:00, 05:30 to 06:00, 09:30 to 10:00, 
  // 13:30 to 14:00, 17:30 to 18:00, 21:30 to 2:00.

  if (hour() % 4 == 1 && minute()>30) 
  {
    pinMode(highATOPin,OUTPUT);
    digitalWrite(highATOPin,HIGH); // Turn on Solid State Relay
  }
  else
  {
    pinMode(highATOPin,OUTPUT);
    digitalWrite(highATOPin,LOW); // Turn off Solid State Relay
  } 


  // Wavemaker not available 9 pm to 10 am

  if ( (hour() >= 20) || (hour() <= 9) ) 
  {

    ReefAngel.Relay.Off(Port5);

   }

     // Web Banner stuff
    if(ReefAngel.Timer[4].IsTriggered())
    {
        ReefAngel.Timer[4].Start();
        ReefAngel.WebBanner();
    }

   ReefAngel.ShowInterface();
}
Roberto.
Post Reply