Currently I am using the new Reef Angel controller with the extra memory upgrade along with an relay expansion. Prior to installing the relay expansion, the WDT would any prevent crashes on the main unit. Now with the relay expansion installed the controller is crashing quite often. I am not sure if its just the LCD screen not waking when I toggle the joystick or if it the unit has locked altogether. Is there a way to log whether the time relays are still turning on/off or is there a way to just have the unit reset every so often as to prevent it from locking up? Thanks in advance for the help and suggestions!
Tim
Code: Select all
// Autogenerated file by RAGen (v1.2.2.171), (06/07/2012 22:08)
// RA_060712_2208.ino
//
// This version designed for v0.9.0 or later
/* The following features are enabled for this File:
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define SaveRelayState
#define RelayExp
#define InstalledRelayExpansionModules 0
#define WDT
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 7
#define CUSTOM_MAIN
#define COLORS_PDE
*/
#include <ReefAngel_Features.h>
#include <RA_Colors.h>
#include <RA_CustomColors.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 <ReefAngel.h>
////// Place global variable code below here
////// Place global variable code above here
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Feeding";
prog_char menu1_label[] PROGMEM = "Water Change";
prog_char menu2_label[] PROGMEM = "On/Off Day Light";
prog_char menu3_label[] PROGMEM = "On/Off Sump Light";
prog_char menu4_label[] PROGMEM = "Reset WDT";
prog_char menu5_label[] PROGMEM = "Date / Time";
prog_char menu6_label[] PROGMEM = "PH Calibration";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label };
void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ReefAngel.Relay.Toggle(Port1);
ReefAngel.Relay.Toggle(Port2);
ReefAngel.Relay.Write();
ReefAngel.DisplayMenuEntry("On/Off Kessil");
}
void MenuEntry4()
{
ReefAngel.Relay.Toggle(Port8);
ReefAngel.Relay.Write();
ReefAngel.DisplayMenuEntry("On/Off Sump Light");
}
void MenuEntry5()
{
wdt_reset();
ReefAngel.DisplayMenuEntry("Reset Watch Dog Timer");
}
void MenuEntry6()
{
ReefAngel.SetupDateTime();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry7()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 116);
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, 90, TempRelay);
pingSerial();
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox(12, 101, TempRelay);
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph(5, 5);
}
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Initialize the custom menu
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.FeedingModePortsE[0] = B00000100;
// Ports toggled in Water Change Mode
//ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.WaterChangePortsE[0] = B00110100;
// Ports that are always on
ReefAngel.Relay.On(Box1_Port1);
ReefAngel.Relay.On(Box1_Port2);
////// Place additional initialization code below here
//wavemaker timer
ReefAngel.Timer[1].SetInterval(random(35,50));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.On(Box1_Port5);
//2nd wavemaker timer
ReefAngel.Timer[2].SetInterval(random(20,35));
ReefAngel.Timer[2].Start();
ReefAngel.Relay.On(Port6);
ReefAngel.Relay.On(Box1_Port6);
////// Place additional initialization code above here
}
void loop()
{
// Specific functions that use Internal Memory values
ReefAngel.StandardLights(Port1);
ReefAngel.StandardLights(Port2);
ReefAngel.MHLights(Port8);
////// Place your custom code below here
//Wavemaker Timer 1
if(ReefAngel.Timer[1].IsTriggered())
{
ReefAngel.Timer[1].SetInterval(random(35,50));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port5);
ReefAngel.Relay.Toggle(Box1_Port5);
ReefAngel.Relay.Toggle(Port7);
ReefAngel.Relay.Toggle(Port6);
}
//Wavemaker Timer 2
if(ReefAngel.Timer[2].IsTriggered())
{
ReefAngel.Timer[2].SetInterval(random(25,35));
ReefAngel.Timer[2].Start();
ReefAngel.Relay.Toggle(Port6);
ReefAngel.Relay.Toggle(Box1_Port6);
ReefAngel.Relay.Toggle(Box1_Port4);
ReefAngel.Relay.Toggle(Box1_Port5);
}
if(ReefAngel.Params.Temp[T3_PROBE]>=770)
{
ReefAngel.Relay.On(Box1_Port3);
}
if(ReefAngel.Params.Temp[T3_PROBE]<=740)
{
ReefAngel.Relay.Off(Box1_Port3);
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}