How do I code delayed start from feed mode, i.e. for skimmer
Re: How do I code delayed start from feed mode, i.e. for ski
thanks guys, I know you're working hard, I'll wait patiently
Re: How do I code delayed start from feed mode, i.e. for ski
Curt, mine rises about 4-6" as well in my skimmer compartment when the return is shut off. The change in water level will cause more skimmate and eventually start wet skimming. I'm surprised you hadn't run into this issue. I actually use mine now for water changes. I'll let it wet skim out what I want to change out, then unplug my ATO and plug in a pump to pump in new saltwater. I'd like to automate the process, but it's much easier than it used to be before anyhow.
Re: How do I code delayed start from feed mode, i.e. for ski
I just finished coding in a DelayedOn function.
I've tested it and it appears to be working the way it should but will need some further testing to be certain. It currently has a minute delay and is in my latest code on my github account (https://github.com/curtbinder/ReefAngel).
I also have a PDE file created that shows how to use the function. It is attached to this post.
Here is how the function is designed to work:
// Always on ports that have a delay
// These ports will delay turning on for the specified MINUTE_DELAY during the following modes:
// Controller Power Up
// Feeding Mode (if toggled during mode)
// Water Change Mode (if toggled during mode)
//
// This function needs to be placed inside loop() and not inside setup()
//
// Usage is DelayedOn(PORT, MINUTE DELAY)
So that means that at controller startup, any port that is specified as a DelayedOn port will delay starting up for the given minute delay. The Feeding and Water Change modes will only do the delay if the port was actually turned off during those modes.
Here is an example scenario:
If you don't turn off your skimmer during feeding mode but do during water change mode, the skimmer will only be delayed in turning on when the controller powers up and after leaving water change mode. Nothing happens during feeding mode because it was never turned off for feeding mode.
curt
I've tested it and it appears to be working the way it should but will need some further testing to be certain. It currently has a minute delay and is in my latest code on my github account (https://github.com/curtbinder/ReefAngel).
I also have a PDE file created that shows how to use the function. It is attached to this post.
Here is how the function is designed to work:
// Always on ports that have a delay
// These ports will delay turning on for the specified MINUTE_DELAY during the following modes:
// Controller Power Up
// Feeding Mode (if toggled during mode)
// Water Change Mode (if toggled during mode)
//
// This function needs to be placed inside loop() and not inside setup()
//
// Usage is DelayedOn(PORT, MINUTE DELAY)
So that means that at controller startup, any port that is specified as a DelayedOn port will delay starting up for the given minute delay. The Feeding and Water Change modes will only do the delay if the port was actually turned off during those modes.
Here is an example scenario:
If you don't turn off your skimmer during feeding mode but do during water change mode, the skimmer will only be delayed in turning on when the controller powers up and after leaving water change mode. Nothing happens during feeding mode because it was never turned off for feeding mode.
curt
- Attachments
-
- DelayedOn.pde
- DelayedOn function example
- (1.58 KiB) Downloaded 456 times
Re: How do I code delayed start from feed mode, i.e. for ski
Curt, your delay on function seems to work great... however, it doesn't seem to work for power losses just as the halide does. I have a float switch on my collection bucket so that if it's full, the skimmer turns off. If the float switch is triggered, then cleared, the skimer will turn off for one minute. But, I also want it to delay start if the power goes out just as the halide function does. Any suggestions?
my PDE
my PDE
Code: Select all
// Autogenerated file by RAGen (v1.0.4.92), (05/08/2011 17:03)
// RA_050811_1703.pde
//
// This version designed for v0.8.5 Beta 12 or later
/* The following features are enabled for this PDE File:
#define DisplayImages - ok
#define WavemakerSetup - ok
#define DateTimeSetup - ok
#define ATOSetup - ok, but probably not needed since the ato timeouts are not used
#define MetalHalideSetup - ok
#define DirectTempSensor - ok
#define RelayExp - ok
#define SingleATOSetup - ok, but probably not needed since the single ato function isn't used
#define StandardLightSetup -ok
#define CUSTOM_MAIN - ok
#define COLORS_PDE - ok
*/
//Custom colors
#include <ReefAngel_Colors.h>
#include <ReefAngel_CustomColors.h>
#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>
/*
#define Box1_Port1 11 Fuge LED
#define Box1_Port2 12 Carbon Reactor
#define Box1_Port3 13
#define Box1_Port4 14 Vortech
#define Box1_Port5 15 WC Heater
#define Box1_Port6 16 WC Pump
#define Box1_Port7 17 Actinic LED
#define Box1_Port8 18
*/
/*
//#include <avr/pgmspace.h>
prog_char id_label[] PROGMEM = "wolfpack1206";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "Not%20Used";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "Moonlight";
prog_char relay3_label[] PROGMEM = "Actinic";
prog_char relay4_label[] PROGMEM = "Halide";
prog_char relay5_label[] PROGMEM = "Sump%20Light";
prog_char relay6_label[] PROGMEM = "Powerhead";
prog_char relay7_label[] PROGMEM = "Heater";
prog_char relay8_label[] PROGMEM = "Return";
#ifdef RelayExp
prog_char relay11_label[] PROGMEM = "Fuge%20LED";
prog_char relay12_label[] PROGMEM = "Carbon%20Reactor";
prog_char relay13_label[] PROGMEM = "Not%20Used";
prog_char relay14_label[] PROGMEM = "Vortech";
prog_char relay15_label[] PROGMEM = "WC%20Heater";
prog_char relay16_label[] PROGMEM = "WC%20Pump";
prog_char relay17_label[] PROGMEM = "Actinic%20LED";
prog_char relay18_label[] PROGMEM = "Not%20Used";
#endif // RelayExp
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,
#ifdef RelayExp
relay11_label, relay12_label, relay13_label, relay14_label,
relay15_label, relay16_label, relay17_label, relay18_label,
#endif // RelayExp
};
*/
void DrawCustomMain()
{
// Change the 30 to adjust the horizontal position of the text on the screen, max 20-21 chars
ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 35, 2, "Alex's Cube");
ReefAngel.LCD.DrawDate(6, 119);
pingSerial();
ReefAngel.LCD.DrawMonitor(15, 63, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(),
ReefAngel.PWM.GetActinicValue());
pingSerial();
// draw main relay
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
#ifdef RelayExp
// draw 1st expansion relay
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox(12, 105, TempRelay);
#endif // RelayExp
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph(5, 10);
}
void setup()
{
ReefAngel.Init(); //Initialize controller
//ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
// Initialize and start the timer
//ReefAngel.Timer[4].SetInterval(120); // set interval to 180 seconds
//ReefAngel.Timer[4].Start();
ReefAngel.FeedingModePorts = B10101000;
//ReefAngel.WaterChangePorts = B10000010;
ReefAngel.WaterChangePorts = B00000001;
ReefAngel.OverheatShutoffPorts = B00000110;
// Ports that are always on
ReefAngel.Relay.On(Port6);
ReefAngel.Relay.On(Port8);
ReefAngel.Relay.On(Box1_Port1);
ReefAngel.Relay.On(Box1_Port2);
ReefAngel.Relay.On(Box1_Port4);
}
void loop()
{
ReefAngel.ShowInterface();
// Specific functions
// ReefAngel.SingleATOHigh(Port1);
if(ReefAngel.HighATO.IsActive())
{
ReefAngel.Relay.On(Port1);
ReefAngel.Relay.On(Box1_Port6);
}
if(ReefAngel.HighATO.IsActive()==false)
{
ReefAngel.Relay.Off(Port1);
ReefAngel.Relay.Off(Box1_Port6);
}
if(ReefAngel.LowATO.IsActive())
ReefAngel.DelayedOn(Port6, 1);
if(ReefAngel.LowATO.IsActive()==false)
ReefAngel.Relay.Off(Port6);
ReefAngel.StandardLights(Port2);
ReefAngel.MHLights(Port3);
//ReefAngel.Wavemaker1(Port4);
ReefAngel.StandardFan(Port5);
ReefAngel.StandardHeater(Port7);
ReefAngel.StandardLights(Box1_Port7,12,15,21,45);
}
Re: How do I code delayed start from feed mode, i.e. for ski
The code is exactly the same for both of the delays. DelayedOn uses a variable called LastStart and the Halides use a variable called RAStart. When the controller initializes, LastStart gets set with the value from RAStart.alexwbush wrote:Curt, your delay on function seems to work great... however, it doesn't seem to work for power losses just as the halide does.
From your code, it looks like your skimmer is on Port6. If it is, your problem is how you turn it on. If you want a DelayedOn, you cannot turn it ON in the setup. You have the ReefAngel.Relay.On(Port6) inside setup(), which turns it on every time the controller powers up.
You already have your conditional statement that checks whether or not to turn on the port. So just stop turning it on when the controller starts up and you should be fine.
curt
Re: How do I code delayed start from feed mode, i.e. for ski
great catch! I can't believe I overlooked that, thanks!