Just getting started, need help with lights first

Do you have a question on how to do something.
Ask in here.
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

Okay, pH control is done and I'm back to the RF module again. It's doing almost everything I want, in and out of night mode and feeding modes but the Nutrient Transport mode isn't working as expected.

The Nutrient Tranpsort mode has two phases with a wave motion phase and surge phase. It's doing the wave motion phase okay but it's not going into the surge phase. Can you take a look at my code and see what I might be missing?

I did try using the wizard for this but I couldn't get the feeding mode didn't work correctly. The vortech pumps would only stay in feeding mode a few seconds before reverting back to nutrient transport. I copied most of this from someone elses code and just removed their automatic feeding cycles. I also noticed the wizard called the mode as NutrientTransport and the user I copied code from called it as Smart_NTM, not sure if there is a difference?
// Autogenerated file by RAGen (v1.2.2.171), (07/19/2012 20:00)
// RA_071912_2000.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define DisplayImages
#define DateTimeSetup
#define DosingPumpSetup
#define VersionMenu
#define DirectTempSensor
#define DisplayLEDPWM
#define wifi
#define StandardLightSetup
#define SaveRelayState
#define RelayExp
#define InstalledRelayExpansionModules 1
#define WDT
#define PWMEXPANSION
#define IOEXPANSION
#define CUSTOM_MAIN
#define RFEXPANSION
#define FONT_8x16
#define NUMBERS_8x16
*/


#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 <RF.h>
#include <IO.h>
#include <ReefAngel.h>
#include <avr/wdt.h>

////// Place global variable code below here
// Globals Needed for Params on Custom Main
byte x,y;
char text[10];
int v;

// Globals Needed for RF Mode on Custom Main
       byte vtechmode;
       boolean bFeeding=false;

//------------------------------------------------------ End of Global Variables --------------------------------------------------
//*********************************************************************************************************************************

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

//---------------------------------------------Custom Main for PWM Expansion Module------------------------------------------------


void DrawCustomMain()
{
        //Top Banner
        ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_SKYBLUE, 9, 2, "Sean's 58G Money Pit");
        
        // Display T2 Header Text
        ReefAngel.LCD.DrawText(COLOR_ROYALBLUE,255,8,14,"Tank");
  
        // Display the T2 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_ROYALBLUE, 255, 4, 24, text, Num8x16);
        pingSerial();

        // Display the T1 Header Text
        ReefAngel.LCD.DrawText(COLOR_CRIMSON,255,52,14,"Room");
  
        // Display the T1 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 Vortech MP10wES Mode Header Text
        ReefAngel.LCD.Clear(DefaultFGColor,5,39,127,39);
        ReefAngel.LCD.DrawText(0,255,18,42,"EcoSmart Vortech");

        // Display EcoSmart Mode Value
        ReefAngel.LCD.Clear(255, 1, 49, 128, 64);
        if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,35,50,"Constant");
        else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,42,50,"Lagoon");
        else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,25,50,"Reef Crest");
        else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,22,50,"Short Pulse");
        else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,25,50,"Long Pulse");
        else if (vtechmode == 5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,8,50,"Nutrient Trnsp.");
        else if (vtechmode == 6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,23,50,"Tidal Swell");
        else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,0,45,50,"Night");

        // Display PMW Expansion Channel Headers and % Values
        ReefAngel.LCD.Clear(DefaultFGColor,5,65,127,65);
        ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,31,68,"LED Dimming");
        x=15;
        y=78;
        for (int a=0;a<4;a++)
        {
          if (a>1) x=75;
          if (a==2) y=78;
          ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :");
          ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a);
          ConvertNumToString(text, ReefAngel.PWM.GetChannelValue(a), 1);
          strcat(text," ");
          ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,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, 97, TempRelay);
        pingSerial();

        // Display Expansion Relay Box 1
        TempRelay = ReefAngel.Relay.RelayDataE[0];
        TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
        TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
        ReefAngel.LCD.DrawOutletBox(13,109, TempRelay);
        pingSerial();
        
        //Draw Date & Time
        ReefAngel.LCD.DrawDate(6, 123);
        pingSerial();
}

void DrawCustomGraph() // Not Used
{
}

//------------------------------------------------------ End Custom Main ----------------------------------------------------------
//*********************************************************************************************************************************
//-------------------------------------------------------- Begin Setup ------------------------------------------------------------

void setup()
{
    // This must be the first line
    ReefAngel.Init(); //Initialize controller
    //Ports that are always on
    ReefAngel.Relay.On(Box0_Port4);
    ReefAngel.Relay.On(Box0_Port5);
    ReefAngel.Relay.On(Box1_Port2);
    ReefAngel.Relay.On(Box1_Port4);
    ReefAngel.Relay.On(Box1_Port5);
    ReefAngel.Relay.On(Box1_Port6);
    ReefAngel.Relay.On(Box1_Port7);
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port5Bit | Port7Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = Port2Bit | Port4Bit;
    // Ports toggled in Water Change Mode
     ReefAngel.WaterChangePorts = Port5Bit | Port7Bit | Port8Bit;
     ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit | Port4Bit;
     // define T2 probe as temp probe
     ReefAngel.TempProbe = T2_PROBE;

    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit ;
    
   //--------------------------------------------------------- RF Module Setup -------------------------------------------------------
    ReefAngel.RF.SetMode(Slave_Start,0,0);
    /*
    If you get a compile error similar to this:
    'class ReefAngelClass' has no member named 'RF'
    Please make sure that you enabled RF Expansion on your features file.
  
    Open RAGen and make sure you have RF Expansion checked under the Features tab.

    Or, you can manually edit the file.
    The file is located at "Documents\Arduino\libraries\ReefAngel_Features.h" file and has to include this line in it:
    #define RFEXPANSION  
    */
    InternalMemory.RFMode_write(5);
    InternalMemory.RFSpeed_write(170);
    InternalMemory.RFDuration_write(11);

//------------------------------------------------------ End RF Module Setup ------------------------------------------------------  
}
//---------------------------------------------------------- End Setup ------------------------------------------------------------
//*********************************************************************************************************************************
//--------------------------------------------------------- Begin Loop ------------------------------------------------------------


void loop()
{
    // Specific functions that use Internal Memory values
    ReefAngel.StandardLights(Box0_Port1,11,0,22,0);
    ReefAngel.StandardLights(Box0_Port2,23,0,10,0);
    ReefAngel.StandardLights(Box0_Port3,10,0,23,0);
    ReefAngel.StandardLights(Box1_Port8,10,0,23,30);
    ReefAngel.StandardFan(Box0_Port6, 773,777);
    ReefAngel.StandardFan(Box0_Port7, 775,790);
    ReefAngel.StandardHeater(Box0_Port8,768,770);
    ReefAngel.DosingPumpRepeat(Box1_Port3,0,360,600);
    ReefAngel.PHControl(Box1_Port1,824,828 );
   
    ////// Place your custom code below here
    ReefAngel.PWM.SetChannel(0,PWMSlope(11,0,22,0,12,40,60,10));
    ReefAngel.PWM.SetChannel(1,PWMSlope(10,0,23,0,12,100,60,10));
    ReefAngel.PWM.SetChannel(2,PWMSlope(10,0,23,0,12,100,60,10));
    ReefAngel.PWM.SetChannel(3,PWMSlope(10,0,23,0,12,100,60,10));

    ////// Place your custom code above here
    // This sends all the data to the portal
    // Do not add any custom code that changes any relay status after this line
    // The only code after this line should be the ShowInterface function
    ReefAngel.Portal("", "");

    // This should always be the last line
    ReefAngel.ShowInterface();
    //------------------------------------------------- End PWM Expansion Code for Slope ----------------------------------------------

//------------------------------------------------ Start Time-of-Day Based Functions ----------------------------------------------
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These are the mode numbers for the RF Expansion Module for reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //#define Constant 0
    //#define Random1 1 // Lagoonal
    //#define Random2 2 // Reef Crest
    //#define ShortWave 3
    //#define LongWave 4
    //#define Smart_NTM 5 // Nutrient Transport Mode
    //#define Smart_TSM 6 // Tidal Swell Mode
    //#define Feeding_Start 7
    //#define Feeding_Stop 8
    //#define Night 9
    //#define Slave_Start 97
    //#define Slave_Stop 98
    //#define None 99
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//-------------------------------------------------------- Start RF Daytime Control -----------------------------------------------
  if (hour() >=10 && hour() <= 23)
  {  
    if (ReefAngel.DisplayedMenu==FEEDING_MODE) bFeeding=true;
    if (ReefAngel.DisplayedMenu==DEFAULT_MENU && bFeeding )
    {
      bFeeding=false;
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(Smart_NTM,170,11);
      vtechmode = 5;
    }
    if (ReefAngel.DisplayedMenu==DEFAULT_MENU && ReefAngel.Timer[4].IsTriggered())
    {
      ReefAngel.RF.UseMemory=true;
      vtechmode = InternalMemory.RFMode_read();
    }  
  }
//---------------------------------------------------------- End RF Daytime Control -----------------------------------------------   



//-------------------------------------------------------- Start RF Nightmode Control ---------------------------------------------    

  if (hour()>=23 || hour()<10) // Defining "Nightmode" hours for VorTech = between 11 PM and 10 AM
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(Night,15,0);
      vtechmode = 9;
    }
  else
    {
      ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
      ReefAngel.RF.UseMemory=true;
      vtechmode = InternalMemory.RFMode_read();
    } 
//---------------------------------------------------------- End RF Nightmode Control ---------------------------------------------
//------------------------------------------------------ End Time-of-Day Based Functions ------------------------------------------
}
//--------------------------------------------------------------- End Loop --------------------------------------------------------
//*********************************************************************************************************************************
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Just getting started, need help with lights first

Post by rimai »

Can you explain what you are trying to do?
Roberto.
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

I'd like to be in Nutrient Transport during the day from 1000 to 2300 and night mode from 2300 to 1000. Feeding mode when I send the command from the android app, that's pretty much it.

I thought it was doing all that but I'm noticing the Nutrient Transport isn't doing the same 2 phase cycle that it did when I used the Ecosmart drivers. When I put in in Nutrient Transport using the stock wireless drivers it goes through wave motion phase and then a surge phase. It's doing the wave motion phase okay but I've yet to see it go through the surge phase. I use two MP-10's in that are set in anti-sync mode. One driver is glowing orange saying it's on the same side as the master pump and the other white saying it's on the opposite side. The RF module is a solid purple.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Just getting started, need help with lights first

Post by rimai »

Try this:

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (07/19/2012 20:00)
// RA_071912_2000.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define DisplayImages
#define DateTimeSetup
#define DosingPumpSetup
#define VersionMenu
#define DirectTempSensor
#define DisplayLEDPWM
#define wifi
#define StandardLightSetup
#define SaveRelayState
#define RelayExp
#define InstalledRelayExpansionModules 1
#define WDT
#define PWMEXPANSION
#define IOEXPANSION
#define CUSTOM_MAIN
#define RFEXPANSION
#define FONT_8x16
#define NUMBERS_8x16
*/


#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 <RF.h>
#include <IO.h>
#include <ReefAngel.h>
#include <avr/wdt.h>

////// Place global variable code below here
// Globals Needed for Params on Custom Main
byte x,y;
char text[10];
int v;

// Globals Needed for RF Mode on Custom Main
       byte vtechmode;
       boolean bFeeding=false;

//------------------------------------------------------ End of Global Variables --------------------------------------------------
//*********************************************************************************************************************************

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

//---------------------------------------------Custom Main for PWM Expansion Module------------------------------------------------


void DrawCustomMain()
{
        //Top Banner
        ReefAngel.LCD.DrawText(COLOR_BLACK, COLOR_SKYBLUE, 9, 2, "Sean's 58G Money Pit"); 
        
        // Display T2 Header Text
        ReefAngel.LCD.DrawText(COLOR_ROYALBLUE,255,8,14,"Tank");
  
        // Display the T2 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_ROYALBLUE, 255, 4, 24, text, Num8x16);
        pingSerial();

        // Display the T1 Header Text
        ReefAngel.LCD.DrawText(COLOR_CRIMSON,255,52,14,"Room");
  
        // Display the T1 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 Vortech MP10wES Mode Header Text
        ReefAngel.LCD.Clear(DefaultFGColor,5,39,127,39);
        ReefAngel.LCD.DrawText(0,255,18,42,"EcoSmart Vortech");

        // Display EcoSmart Mode Value 
        ReefAngel.LCD.Clear(255, 1, 49, 128, 64);
        if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,35,50,"Constant");
        else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,42,50,"Lagoon");
        else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,25,50,"Reef Crest");
        else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,22,50,"Short Pulse");
        else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,25,50,"Long Pulse");
        else if (vtechmode == 5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,8,50,"Nutrient Trnsp.");
        else if (vtechmode == 6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,23,50,"Tidal Swell");
        else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,0,45,50,"Night");

        // Display PMW Expansion Channel Headers and % Values
        ReefAngel.LCD.Clear(DefaultFGColor,5,65,127,65);
        ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,31,68,"LED Dimming");
        x=15;
        y=78;
        for (int a=0;a<4;a++)
        {
          if (a>1) x=75;
          if (a==2) y=78;
          ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :");
          ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a);
          ConvertNumToString(text, ReefAngel.PWM.GetChannelValue(a), 1);
          strcat(text," ");
          ReefAngel.LCD.DrawText(COLOR_DARKGOLDENROD,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, 97, TempRelay);
        pingSerial();

        // Display Expansion Relay Box 1
        TempRelay = ReefAngel.Relay.RelayDataE[0];
        TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
        TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
        ReefAngel.LCD.DrawOutletBox(13,109, TempRelay);
        pingSerial();
        
        //Draw Date & Time
        ReefAngel.LCD.DrawDate(6, 123);
        pingSerial();
}

void DrawCustomGraph() // Not Used
{
}

//------------------------------------------------------ End Custom Main ----------------------------------------------------------
//*********************************************************************************************************************************
//-------------------------------------------------------- Begin Setup ------------------------------------------------------------

void setup()
{
    // This must be the first line
    ReefAngel.Init(); //Initialize controller
    //Ports that are always on
    ReefAngel.Relay.On(Box0_Port4);
    ReefAngel.Relay.On(Box0_Port5);
    ReefAngel.Relay.On(Box1_Port2);
    ReefAngel.Relay.On(Box1_Port4);
    ReefAngel.Relay.On(Box1_Port5);
    ReefAngel.Relay.On(Box1_Port6);
    ReefAngel.Relay.On(Box1_Port7);
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port5Bit | Port7Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = Port2Bit | Port4Bit;
    // Ports toggled in Water Change Mode
     ReefAngel.WaterChangePorts = Port5Bit | Port7Bit | Port8Bit;
     ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit | Port4Bit;
     // define T2 probe as temp probe
     ReefAngel.TempProbe = T2_PROBE;

    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit ;
}
//---------------------------------------------------------- End Setup ------------------------------------------------------------
//*********************************************************************************************************************************
//--------------------------------------------------------- Begin Loop ------------------------------------------------------------


void loop()
{
    // Specific functions that use Internal Memory values
    ReefAngel.StandardLights(Box0_Port1,11,0,22,0);
    ReefAngel.StandardLights(Box0_Port2,23,0,10,0);
    ReefAngel.StandardLights(Box0_Port3,10,0,23,0);
    ReefAngel.StandardLights(Box1_Port8,10,0,23,30);
    ReefAngel.StandardFan(Box0_Port6, 773,777);
    ReefAngel.StandardFan(Box0_Port7, 775,790);
    ReefAngel.StandardHeater(Box0_Port8,768,770);
    ReefAngel.DosingPumpRepeat(Box1_Port3,0,360,600);
    ReefAngel.PHControl(Box1_Port1,824,828 );
   
    ////// Place your custom code below here
    ReefAngel.PWM.SetChannel(0,PWMSlope(11,0,22,0,12,40,60,10));
    ReefAngel.PWM.SetChannel(1,PWMSlope(10,0,23,0,12,100,60,10));
    ReefAngel.PWM.SetChannel(2,PWMSlope(10,0,23,0,12,100,60,10));
    ReefAngel.PWM.SetChannel(3,PWMSlope(10,0,23,0,12,100,60,10));

    ////// Place your custom code above here
    // This sends all the data to the portal
    // Do not add any custom code that changes any relay status after this line
    // The only code after this line should be the ShowInterface function
    ReefAngel.Portal("", "");

    // This should always be the last line
    ReefAngel.ShowInterface();
    //------------------------------------------------- End PWM Expansion Code for Slope ----------------------------------------------

//------------------------------------------------ Start Time-of-Day Based Functions ----------------------------------------------
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These are the mode numbers for the RF Expansion Module for reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //#define Constant 0
    //#define Random1 1 // Lagoonal
    //#define Random2 2 // Reef Crest
    //#define ShortWave 3
    //#define LongWave 4
    //#define Smart_NTM 5 // Nutrient Transport Mode
    //#define Smart_TSM 6 // Tidal Swell Mode
    //#define Feeding_Start 7
    //#define Feeding_Stop 8
    //#define Night 9
    //#define Slave_Start 97
    //#define Slave_Stop 98
    //#define None 99
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

//-------------------------------------------------------- Start RF Nightmode Control ---------------------------------------------    

  if (hour()>=23 || hour()<10) // Defining "Nightmode" hours for VorTech = between 11 PM and 10 AM
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(Night,15,0);
      vtechmode = 9;
    }
  else
    {
      ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
      ReefAngel.RF.UseMemory=true;
      vtechmode = InternalMemory.RFMode_read();
    } 
//---------------------------------------------------------- End RF Nightmode Control ---------------------------------------------
//------------------------------------------------------ End Time-of-Day Based Functions ------------------------------------------
}
//--------------------------------------------------------------- End Loop --------------------------------------------------------
//*********************************************************************************************************************************

Roberto.
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

Many thanks again for the quick responses :D

Code is uploaded and I'll watch it for awhile to see how the nutrient transport mode behaves. It went into feeding mode okay and stayed there.

I was about to ask where I change the speed and duration values but found that's using internal memory which I could control from the andriod app, very cool 8-)
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

Okay, I've been watching the vortech pumps for awhile now and haven't seen them go through the surge phase of the nutrient transport mode. Everything works as it did before using the longer version of code I posted but yours was shorter so thats a good thing.

The surge I'm referring to is the big swell shown in the graph below, it usually lasts several minutes when it starts. It seems unlikely to be an issue with the RF module since it goes in/out of feeding, night modes okay.
Anything else I can try? I'm assuming the modes are behave the same as the Ecosmart drivers.

Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Just getting started, need help with lights first

Post by rimai »

It should do... Not sure why you are not getting it.
I know that the entire cycle lasts for 2.5 hours. The entire cycle is represented in the graph you posted.
I just changed mine right now. In 45 minutes, it will go into the next phase (surge phase).
I'll let you know what happens.
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Just getting started, need help with lights first

Post by rimai »

The pumps changed to surge after 45min
Roberto.
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

Okay, many thanks again for testing that. I just rebooted the controller and moved the RF units around a bit again. They are all within 6 inches of each other with no obstructions. I'll check back in 45 minutes.
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

Unfortunately no surge after 45 minutes. Anything else we can try?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Just getting started, need help with lights first

Post by rimai »

Are you sure you have the RF mode set to 5?
Roberto.
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

I checked the internal memory using the andoid app to read the value at location 855 and it says 5. The Vortech page on the android app also says Nutrient.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Just getting started, need help with lights first

Post by rimai »

Ok, assuming you are running latest libraries, which is v1.0.1 at the moment, you need to change one setting on the app.
Go to Settings->Settings and uncheck Pre v.10 Locations.
This should change the locations to the 200s.
The location should be 255 and not 855 anymore.
On v1.0, we had to relocate the table due to several issues.
What do you have on 255??
Roberto.
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

Checked the version and it's on v1.0.1. I unchecked the Pre v.10 locations box which changed the memory location from 855 to 255 for the RF Mode, it still reads the value as 5.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Just getting started, need help with lights first

Post by rimai »

Oh, I know why you are having problems now :)
Your code is resetting the NTM mode all the time when you send Feeding Stop command.
Replace this:

Code: Select all

      ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
With this:

Code: Select all

      if (vtechmode==9) ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
Roberto.
reefer gladness
Posts: 29
Joined: Sat Jun 09, 2012 11:18 pm

Re: Just getting started, need help with lights first

Post by reefer gladness »

Appears to be working okay now, it just went into the surge phase. Awesome support again, thanks for all the help. :D
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Just getting started, need help with lights first

Post by rimai »

Sorry I missed that one earlier :(
Roberto.
Post Reply