Relay Port 7 not turning off
Posted: Mon Jan 28, 2013 2:40 pm
I have recently revamped my code to begin adding a new tank, separately plumbed from my main tank, adding back my second relay, ph expansion, second heaters, etc., heading towards the code discussion on here of having the second box turn off during outages.
The problem I am having right now is that Port 7 will not turn off when told to. It used to be a heater port and is now an always-on port running the pump on the second tank. I believe I have it correctly programmed in my feeding, water change, etc., code statements but it will not go off.
I experimented today, turning off the port from the client, from the portal, etc. and although those devices say off, the pump is still running. I thought it had to do with my "always-on" statements but port 8, also set that way, operates normally. Please take a look at my code and see if you see something I don't. Thx
The problem I am having right now is that Port 7 will not turn off when told to. It used to be a heater port and is now an always-on port running the pump on the second tank. I believe I have it correctly programmed in my feeding, water change, etc., code statements but it will not go off.
I experimented today, turning off the port from the client, from the portal, etc. and although those devices say off, the pump is still running. I thought it had to do with my "always-on" statements but port 8, also set that way, operates normally. Please take a look at my code and see if you see something I don't. Thx
Code: Select all
// Autogenerated file by RAGen (v1.2.1.158), (02/17/2012 22:55)
#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 <IO.h>
#include <Salinity.h>
#include <PH.h>
#include <ReefAngel.h>
void setup() {
ReefAngel.Init(); //Initialize controller
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit | Port7Bit | Port8Bit; // Turn off DT-LWM, GT-LWM, GT-Pump, and DT-Pump when feeding mode is activated is activated on Box1
ReefAngel.FeedingModePortsE[0] = Port5Bit | Port6Bit | Port7Bit; // Turn off DT-RWM, GT-RWM, and Skimmer when feeding mode is activated is activated on Box2
ReefAngel.WaterChangePorts = Port3Bit | Port5Bit | Port6Bit | Port8Bit; // Turn off DT-Heat, DT-LWM, and DT-Pump when water change mode is activated
ReefAngel.TempProbe = T1_PROBE; // Set the 1st plug to be DT Main temp
ReefAngel.OverheatProbe = T1_PROBE; // to monitor the overheat and temperatures
ReefAngel.OverheatShutoffPorts = Port1Bit | Port3Bit; // DT-Lights and DT-Heat turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPortsE[0] = Port7Bit; //Skimmer turned off if overheat
InternalMemory.OverheatTemp_write( 829 ); // Set the DT Overheat temperature setting
ReefAngel.Relay.On(Port8); // Turn on Pump
ReefAngel.Relay.On(Port7); // Turn on GT Pump
ReefAngel.Relay.On(Box1_Port8); // power the PH expansion hub
}
void loop()
{
// Specific functions
ReefAngel.StandardLights( Port1,12,00,22,00 ); // Regular Lights on at 12:00pm and off at 10:00pm
ReefAngel.StandardLights( Box1_Port3,12,00,21,45 ); //GT Lights Main 12:00pm - 9:45pm
ReefAngel.StandardLights( Box1_Port4,13,00,22,30 ); //GT Lights Actinic 1:00pm - 10:30pm
ReefAngel.WavemakerRandom( Port5,60,100 );
ReefAngel.Relay.Set( Box1_Port5, !ReefAngel.Relay.Status( Port5 ) ); //Randomize DT powerheads
ReefAngel.WavemakerRandom( Port6,60,100 );
ReefAngel.Relay.Set( Box1_Port6, !ReefAngel.Relay.Status( Port6 ) ); //Randomize GT powerheads
ReefAngel.StandardHeater(Port3,779,791);
StandardHeater2( Port4,779,791 ); //GT-Heat
// if the hour is 2p or 8p, minute is 55 and seconds is 0
// start the feeding mode
if ( ((hour() == 14) || (hour() == 20)) &&
(minute() == 55) &&
(second() == 0) )
{
ReefAngel.FeedingModeStart();
}
//turn off port 8 - main pump when switch is tripped and sound buzzer
ReefAngel.Relay.Set(Port8,ReefAngel.IO.GetChannel(0));
ReefAngel.PWM.SetDaylight(100-(ReefAngel.IO.GetChannel(0)*100));
//tell the portal we have a overflow problem
ReefAngel.CustomVar[0]=ReefAngel.IO.GetChannel(0);
ReefAngel.CustomVar[7]=1;
//set up dosing pump one to run twice a week for 4 minutes
//ReefAngel.Relay.Set(Box1_Port2,((weekday()==1||weekday()==4) && hour()==14 && minute()<6));
//ReefAngel.Relay.Set (Box1_Port3,(hour()%2==0)); //stir chemicals in water top off unit
ReefAngel.Portal("rossbryant1956");
ReefAngel.ShowInterface();
}
void StandardHeater2(byte HeaterRelay, int LowTemp, int HighTemp) //Heater for Grow Tank
{
if (ReefAngel.Params.Temp[T3_PROBE] == 0) return; // Don't turn the heater on if the temp is reading 0
if (ReefAngel.Params.Temp[T3_PROBE] <= LowTemp && ReefAngel.Params.Temp[T3_PROBE] > 0) ReefAngel.Relay.On(HeaterRelay); // If sensor temperature <= LowTemp - turn on heater
if (ReefAngel.Params.Temp[T3_PROBE] >= HighTemp) ReefAngel.Relay.Off(HeaterRelay); // If sensor temperature >= HighTemp - turn off heater
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
pingSerial();
// pH Expansion
ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,15,66, "PHE:" );
ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,39,66, ReefAngel.Params.PHExp );
pingSerial();
// Relay Expansion
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox( 12, 107, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph( 5, 5 );
}