Delay Port restart after feeding/water change

Do you have a question on how to do something.
Ask in here.
Post Reply
d0lph1n
Posts: 121
Joined: Tue Dec 06, 2011 10:16 am

Delay Port restart after feeding/water change

Post by d0lph1n »

Please let me know how to delay a port restart (if it was ON) after entering feeding/ water change mode.

This is my code, if port 5 was on before feeding/water change, I'd like to delay it for 1 min, until the water level in the sump gets back to normal high. Right now, this command does nothing, no effect: ReefAngel.Relay.DelayedOn( Port5,1 );

Also, I'd like to know how to prevent the lcd from entering a weird blinking loop mode after the wifi module is connected.

#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>q
#include <RF.h>
#include <IO.h>
#include <AI.h>
#include <DCPump.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
InternalMemory.LCDID_write(255);
InternalMemory.FeedingTimer_write(900);
InternalMemory.LCDTimer_write(600);
InternalMemory.HeaterTempOn_write(760);
InternalMemory.HeaterTempOff_write(780);
InternalMemory.OverheatTemp_write(815);
InternalMemory.IMCheck_write(0xCF06A31E);
ReefAngel.Init(); //Initialize controller
ReefAngel.Use2014Screen();
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port3Bit | Port4Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port5Bit |Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting


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

////// Place additional initialization code below here


////// Place additional initialization code above here
}

void loop()
{
ReefAngel.Relay.DelayedOn( Port5,1 );
ReefAngel.StandardLights( Port2,11,0,18,0 ); // wavemaker
ReefAngel.StandardLights( Port3,18,0,22,0 ); //algae farm blue leds
ReefAngel.StandardLights( Port4,20,0,11,0 ); //algae farm red leds
ReefAngel.StandardLights( Port5,11,0,20,0 ); // skimmer
ReefAngel.StandardHeater( Port7,760,780 ); // heater
ReefAngel.StandardLights( Port8,11,0,20,0 ); // circulation pump

////// Place your custom code above here

// This should always be the last line
ReefAngel.Portal( "d0lph1n","****" );
ReefAngel.ShowInterface();
}
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Delay Port restart after feeding/water change

Post by lnevo »

The issue is because you have this line after overriding the DelayedOn.

Code: Select all

ReefAngel.StandardLights( Port5,11,0,20,0 ); // skimmer
I would remove that and wrap the delayed on with a time check

Code: Select all

if (hour() >= 11 && hour()<20) ReefAngel.Relay.DelayedOn(Port5,1);
d0lph1n
Posts: 121
Joined: Tue Dec 06, 2011 10:16 am

Re: Delay Port restart after feeding/water change

Post by d0lph1n »

Thanks, it worked.
Any idea about my 2nd question, when the lcd reboots itself, it goes from normal, blank, blank & line... etc when the wifi module is connected?
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Delay Port restart after feeding/water change

Post by lnevo »

I'm not sure on that one. Sounds like maybe a loose signal somewhere with the LCD or the connectors to the TTY
d0lph1n
Posts: 121
Joined: Tue Dec 06, 2011 10:16 am

Re: Delay Port restart after feeding/water change

Post by d0lph1n »

It's not doing it when i connect the usb cable. I have the feeling it has to do with wifi module; it is preventing the lcd from going in standby, some incompatibity between my old RA+ and the newer firmware.
Image
d0lph1n
Posts: 121
Joined: Tue Dec 06, 2011 10:16 am

Re: Delay Port restart after feeding/water change

Post by d0lph1n »

lnevo wrote:I'm not sure on that one. Sounds like maybe a loose signal somewhere with the LCD or the connectors to the TTY
One important detail, it's doesn't do it if the screen is already in standby and the wifi module is connected, only when the screen is on, it triggers the rebooting chaos
Image
d0lph1n
Posts: 121
Joined: Tue Dec 06, 2011 10:16 am

Re: Delay Port restart after feeding/water change

Post by d0lph1n »

lnevo wrote:The issue is because you have this line after overriding the DelayedOn.

Code: Select all

ReefAngel.StandardLights( Port5,11,0,20,0 ); // skimmer
I would remove that and wrap the delayed on with a time check

Code: Select all

if (hour() >= 11 && hour()<20) ReefAngel.Relay.DelayedOn(Port5,1);
As i mentioned, the command works, i mean, the port is delayed but the skimmer is not turned off after 20:00. Please advise. Thanks.
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Delay Port restart after feeding/water change

Post by lnevo »

Yeah sounds like a loose connection being rocked. I always have temp sensor issues when jiggling things. If the monitor is off it won't cut out and initialize badly
d0lph1n
Posts: 121
Joined: Tue Dec 06, 2011 10:16 am

Re: Delay Port restart after feeding/water change

Post by d0lph1n »

lnevo wrote:Yeah sounds like a loose connection being rocked. I always have temp sensor issues when jiggling things. If the monitor is off it won't cut out and initialize badly
Few years ago, I started with RA..I added a 2nd relay unit, later, I upgraded the board to a RA+. Now, the 2nd relay unit is not connected anymore, and I don't remember if I moved any jumper(s) or not. Is it possible that an incorrect jumper setting on the RA+ board might affect the way the LCD behaves when the WIFI module is connected?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Delay Port restart after feeding/water change

Post by rimai »

I don't think so.
Roberto.
Post Reply