ATO timeout
Posted: Tue Apr 03, 2012 6:42 pm
Encountered a new problem, but one i expected. My code is working the way i want it to, the bottom float is activating the pump when needed and the top float is shutting it down and activating the buzzer (we manually trigger the backup to test the buzzer). The problem is the auto-timeout for the bottom float is too short. It doesn't give the pump enough time to fill. Is there a way I can disable the auto-timeout so that the pump will only shut off if one of the floats is triggered?
Here's my code:
Here's my code:
Code: Select all
/*
#define FONT_8X16
#define NUMBERS_8x16
#define DisplayImages
#define DateTimeSetup
#define DirectTempSensor
#define DisplayLEDPWM
#define wifi
#define StandardLightSetup
#define SaveRelayState
#define RelayExp
#define InstalledRelayExpansionModules 1
#define WDT
#define PWMEXPANSION
#define CUSTOM_MAIN
#define RFEXPANSION
#define FONT_8x16
#define NUMBERS_8x16
*/
#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <ReefAngel.h>
#include <avr/wdt.h>
byte x,y;
char text[10];
byte hightemp=0;
byte highfloat=0;
byte buzzer=0;
#define LEDPWM0 0
#define LEDPWM1 1
#define LEDPWM2 2
#define LEDPWM3 3
byte PWMChannel[]={
0,0,0,0,0,0};
int v;
void DrawCustomGraph()
{
}
void DrawCustomMain()
{
//Top Banner
ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_SKYBLUE, 23, 2, " Civiello Reef ");
// Display T1 Header Text
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,8,14,"Tank");
// Display the T1 Temp Value
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T2_PROBE], 10);
ReefAngel.LCD.Clear(255, 4, 21, 37, 37);
ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE, 255, 4, 24, text, Num8x16);
pingSerial();
// Display the T2 Header Text
ReefAngel.LCD.DrawText(COLOR_CRIMSON,255,52,14,"Lights");
// Display the T2 Temp Value
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.Clear(255, 52, 21, 75, 37);
ReefAngel.LCD.DrawLargeText(COLOR_CRIMSON, 255, 52, 24, text, Num8x16);
pingSerial();
// Display pH Header Text
ReefAngel.LCD.DrawText(COLOR_INDIGO,255,108,14,"pH");
// Display pH Value
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.Clear(255, 94, 21, 106, 37);
ReefAngel.LCD.DrawLargeText(COLOR_INDIGO, 255, 94, 24, text, Num8x16);
pingSerial();
// Display PMW Expansion Channel Headers and % Values
ReefAngel.LCD.Clear(DefaultFGColor,5,43,127,43); // Draw divider
ReefAngel.LCD.DrawText(COLOR_MAGENTA,DefaultBGColor,31,48,"LED Dimming");
x=15;
y=58;
ReefAngel.LCD.DrawText(COLOR_LIMEGREEN,DefaultBGColor,x,y,"Day:");
ConvertNumToString(text, ReefAngel.PWM.GetDaylightValue(), 1);
strcat(text," ");
ReefAngel.LCD.DrawText(COLOR_LIMEGREEN,DefaultBGColor,x+24,y,text);
x=75;
y=58;
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,DefaultBGColor,x,y,"Act:");
ConvertNumToString(text, ReefAngel.PWM.GetActinicValue(), 1);
strcat(text," ");
ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,DefaultBGColor,x+24,y,text);
x=15;
y=68;
for (int a=1;a<5;a++)
{
if (a>2) x=75;
if (a==3) y=68;
ReefAngel.LCD.DrawText(COLOR_MAGENTA,DefaultBGColor,x,y,"Ch :");
ReefAngel.LCD.DrawText(COLOR_MAGENTA,DefaultBGColor,x+12,y,a);
ConvertNumToString(text, ReefAngel.PWM.GetChannelValue(a), 1);
strcat(text," ");
ReefAngel.LCD.DrawText(COLOR_MAGENTA,DefaultBGColor,x+24,y,text);
y+=10;
}
pingSerial();
// Display Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(13, 100, TempRelay);
pingSerial();
//Draw Date & Time
ReefAngel.LCD.DrawDate(6, 123);
pingSerial();
}
void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.Relay.On(Port8);
}
void loop()
{
ReefAngel.SingleATOLow(Port6); //Setup Port1 as Auto Top-Off function with on/off
if (ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port6); //upper float set as shut off fail safe
//Temp
ReefAngel.StandardHeater(Port5,780,785); // Setup Heater to turn on at 78.0F and off at 78.5F
ReefAngel.StandardHeater(Port4,780,785); // Setup Heater to turn on at 78.0F and off at 78.5F
ReefAngel.StandardFan(Port2,790,785); // Setup Chiller to turn on at 79.0F and off at 78.5F
//Lights
ReefAngel.StandardLights(Port3,21,30,10,30); //Refugium schedule 8:30pm - 10:30am
//Actinics
ReefAngel.PWM.SetActinic(PWMSlope(13,00,19,00,15,25,120,0)); //lights on at 1:00pm off at 7:00pm from 15% to 25% over 120 min
//Day
ReefAngel.PWM.SetDaylight(PWMSlope(13,30,19,30,15,25,120,0)); //lights on at 1:30am off at 7:30pm from 15% to 25% over 120 min
if (ReefAngel.Params.Temp[T1_PROBE]>1500)
{
ReefAngel.Relay.Off(Port1); //day
ReefAngel.Relay.Off(Port7); //act
hightemp=1;
}
if (ReefAngel.Params.Temp[T1_PROBE]<1400)
{
ReefAngel.StandardLights(Port7,12,30,19,30); //Actinic port on at 12:30am of att 7:30pm
ReefAngel.StandardLights(Port1,13,00,20,00); //Daylight port on at 1:00am off at 8:00pm
hightemp=0;
}
if (ReefAngel.HighATO.IsActive()) highfloat=1; else highfloat=0;
//Buzzer
buzzer=highfloat + hightemp;
if (buzzer>1) buzzer=1;
ReefAngel.PWM.SetChannel(5,buzzer*100);
//Moon
ReefAngel.PWM.SetChannel(1,MoonPhase());
ReefAngel.PWM.SetChannel(2,MoonPhase());
ReefAngel.PWM.SetChannel(3,MoonPhase());
ReefAngel.PWM.SetChannel(4,MoonPhase());
ReefAngel.ShowInterface(); // Draws the standard graphical user interface
}