code check

Share you PDE file with our community
Post Reply
reefcycle
Posts: 118
Joined: Wed Apr 04, 2012 6:49 pm
Location: Philadelphia

code check

Post by reefcycle »

My goal is to have this work 100% for everything water level rf expansion relay on my RA+.
robereto has been helping me non stop over and over so I am posting here before loading.
My whole hang up is light schedule. I have found my heaters and fans and stuff all work. My lights are where I lose it. I think I figured out my problem. I am use to old libraries where port 1 was standard and port 2 was mh. I think with this config I will need to switch them and maybe that has been my whole problem from to start. well check me out and tell me what u think. Thank you guys

Code: Select all

#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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

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


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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port1Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


    // Ports that are always on

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

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

void loop()
{
    ReefAngel.DayLights( Port1 );
    ReefAngel.DayLights( Port2 );
    ReefAngel.StandardFan( Port4 );
    ReefAngel.StandardHeater( Box1_Port1 );
    ReefAngel.Relay.DelayedOn( Box1_Port2 );
    ReefAngel.DosingPumpRepeat1( Box1_Port3 );
    ReefAngel.DosingPumpRepeat2( Box1_Port4 );
    ReefAngel.StandardFan( Box1_Port5 );
    ReefAngel.RF.UseMemory = true;
    ////// Place your custom code below here
    

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

    // This should always be the last line
    ReefAngel.Portal( "reefcycle" );
    ReefAngel.ShowInterface();
}

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 14, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 14, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // Water Level
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,54, "WL:" );
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,54, ReefAngel.WaterLevel.GetLevel() );
    pingSerial();

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 74, TempRelay );
    pingSerial();

    // Relay Expansion
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 12, 97, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
    ReefAngel.LCD.DrawGraph( 5, 5 );
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: code check

Post by rimai »

That will make your port 1 & 2, turn on and off at the same time
Roberto.
reefcycle
Posts: 118
Joined: Wed Apr 04, 2012 6:49 pm
Location: Philadelphia

Re: code check

Post by reefcycle »

D'oh.
reefcycle
Posts: 118
Joined: Wed Apr 04, 2012 6:49 pm
Location: Philadelphia

Re: code check

Post by reefcycle »

When I selected it I selected daylights with 180 actnic offset like you suggested. but I got the relay so when and where ur ready let me know
reefcycle
Posts: 118
Joined: Wed Apr 04, 2012 6:49 pm
Location: Philadelphia

Re: code check

Post by reefcycle »

so roberto the second expansion box is installed and I have everything rewired for the new settings. actnics are on but metal halides arent. I unplugged ra+ and started replugged it in. its been 10 minutes skimmer came back on but still no halides. is this something I should now fix in portal or redo from wizard. what u suggest. here was the code I made while you monitored.

Code: Select all

#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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

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


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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port1Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


    // Ports that are always on

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

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

void loop()
{
    ReefAngel.ActinicLights( Port1 );
    ReefAngel.DayLights( Port2 );
    ReefAngel.StandardFan( Port4 );
    ReefAngel.StandardHeater( Box1_Port1 );
    ReefAngel.Relay.DelayedOn( Box1_Port2 );
    ReefAngel.DosingPumpRepeat1( Box1_Port3 );
    ReefAngel.DosingPumpRepeat2( Box1_Port4 );
    ReefAngel.StandardFan( Box1_Port5 );
    ReefAngel.RF.UseMemory = true;
    ////// Place your custom code below here
    

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

    // This should always be the last line
    ReefAngel.Portal( "reefcycle" );
    ReefAngel.ShowInterface();
}

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 14, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 14, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // Water Level
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,54, "WL:" );
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,54, ReefAngel.WaterLevel.GetLevel() );
    pingSerial();

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 74, TempRelay );
    pingSerial();

    // Relay Expansion
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 12, 97, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
    ReefAngel.LCD.DrawGraph( 5, 5 );
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: code check

Post by rimai »

PM me your ip address
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: code check

Post by rimai »

Can you check the time on your controller?
Roberto.
reefcycle
Posts: 118
Joined: Wed Apr 04, 2012 6:49 pm
Location: Philadelphia

Re: code check

Post by reefcycle »

sure.
reefcycle
Posts: 118
Joined: Wed Apr 04, 2012 6:49 pm
Location: Philadelphia

Re: code check

Post by reefcycle »

its on now. not sure internal time was off
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: code check

Post by rimai »

I think you've never set the time since you got your RA+ board and that's why it has never worked :(
I set the controllers to PST when I test the boards.
So, let me know if with the correct time, it works now.
Roberto.
reefcycle
Posts: 118
Joined: Wed Apr 04, 2012 6:49 pm
Location: Philadelphia

Re: code check

Post by reefcycle »

thats true. I did upgrade board. DUH so I probably did have the settings done and thats why it hasnt worked. ARGH it sucks to fail for such stupid reasons. ty again
Post Reply