Things I am needing help with

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Things I am needing help with

Post by cosmith71 »

What would be the check value in the portal, ATO Timeout Flag >=1 ? In my mind, this was not to be flagged by the ato, but by port8, in case the port fails and gets stuck "on", as well as other possible reasons. I suppose I could also set an alert in portal for Relay port 8, but what check value could be used for "if on longer than 3 minutes"
You would want to set the ATO timeout for 180 seconds (3 minutes). You can then set an alert in the portal for the timeout flag (as above). It will send out an e-mail alert and then repeat it every hour. The initial alert is not sent instantly, but fairly quickly IIRC.

There's no good way to detect a failed relay. RA can only read what the status is supposed to be, not what it actually is.

--Colin
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Things I am needing help with

Post by lnevo »

+1. The timeout is fairly reliable and will shut off the port. You'll have to manually clear the alert from one of the apps or from the screen.
DmnYnkee
Posts: 83
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida

Re: Things I am needing help with

Post by DmnYnkee »

I will cross #1 & #2 off my list.

I had to just add the extra code and not replace, otherwise, pump ran 180 seconds and then went into ATO alert status.

I did have to reverse my float for this to work. Based on my testing and results, True = "LowATO" and False = "HighATO" for anyone that might find this useful.

Here is the final code for that portion.

Code: Select all

    if(ReefAngel.HighATO.IsActive())          //  Float switch in Sump
 {
    ReefAngel.Relay.On(Port8);                //  Run ATO pump.
 }
    else
 {
    ReefAngel.Relay.Off(Port8);               //  Sump level acceptable.  
 }
   
    ReefAngel.SingleATO(false,Port8,180,0);    //  Sump switch.  If ATO runs for 180 seconds, then shut off and send alert.
 
Now, is there any way to reverse the red and green indicator for HighATO in the portal? I would like HighATO inactive to show green.

Chris
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Things I am needing help with

Post by cosmith71 »

I don't think I understand what you're trying to do here.

SingleATO will monitor the switch and turn the pump on and off. If it runs more than 3 minutes then it will trip the ATO flag and stop the pump until it is reset.

In fact, it appears that the SingleATO will override your if/then/else statement.

--Colin
DmnYnkee
Posts: 83
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida

Re: Things I am needing help with

Post by DmnYnkee »

Using

Code: Select all

ReefAngel.SingleATO(false,Port8,180,0);


buy itself, once the pump turned on, it would continue running for 3 minutes and then trip the ATO flag, no matter what position the float was in.

If pump runs over 180 seconds, I want the if/else statement to be over ridden. My ATO typically only runs 20-30 seconds every couple of hours. From bottom of float to top of float takes 150 seconds, so it should never run 180 seconds unless something needs attention.

Side note, I believe I am very close to having #4 working. Currently testing for the next couple of days.

What is the built in offset between the daylights and actinics? 90 minutes?

Code: Select all

    ReefAngel.DayLights( Port2 );     // ATI DayLights (White+Purple)
    ReefAngel.ActinicLights( Port3 ); // ATI Actinic+ Lights (Blues)
    
Thanks much.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Things I am needing help with

Post by lnevo »

You can reverse the indicator light for high ato, but you'll also have to reverse the behavior of your if/else to match.

I believe the function is ReefAngel.ReverseHighATO(); to activate that feature. Keep in mind this can't be commented out and it can be anywhere in the code. It does not matter where.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Things I am needing help with

Post by lnevo »

I believe you have the wifi module. You can go to internal memory in the portal and under the first tab for standard lights it should show you the actinic offset and the timing based on what's set in memory.
DmnYnkee
Posts: 83
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida

Re: Things I am needing help with

Post by DmnYnkee »

ReefAngel.ReverseHighATO(); This did not work. Received the following error.

L1:174: error: 'class ReefAngelClass' has no member named 'ReverseHighATO'

I am using sunrise & sunset programming to run the lighting schedule, so would that still show in the internal memory in the portal? I have concluded there is an hour offset, but it does not appear to be inline with portal. Right now, actinics are coming on with sunrise, and off at sunset. If I change the offset in portal, it uses daylights as the fixed value and only adjusts the time for actinics. I'd like to have the actinics stay as they are (fixed by sunrise and sunset), and use a 90-120 minute offset for the daylights, if possible (come on later, and turn off earlier).

Here is my updated complete code.

Code: Select all

nclude <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 <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>
#include <SunLocation.h>
#include <Tide.h>
#include <Moon.h>
#include <WiFiAlert.h>


////// Place global variable code below here
  
  SunLocation sl;
  
  int avgph[10];
    unsigned long totalavgph=0;
    byte avgindex=0;

void DrawCustomMain()
    {
      byte x;
      byte y = 2;
      char text[7];

      // *********** CHANGE TEMP READOUT COLOR DEPENDENT ON FAN AND HEATER STATUS ***********
      int TempColor;                                    // Color for drawing temperature
      boolean FanOn = ReefAngel.Relay.Status(Port5);    // Get the status of the fan relay
      boolean HeatOn = ReefAngel.Relay.Status(Port6);   // Get the status of the heater relay
      if (HeatOn) 
      {
        TempColor = COLOR_NAVY;                         // Blue text, too cold, heater is on
      }
      if (FanOn)   
      {
          TempColor = COLOR_RED;                        // Red text, too warm, fan is on
      }
      if (!HeatOn && !FanOn) 
      {
          TempColor = COLOR_GREEN;                      // Green text, no fan or heater on
      }
      // ***********************************************************************************
           int pHColor;                                 // Color for drawing pH
      boolean LowpH = (ReefAngel.Params.PH < 780) ;     // Check for Low pH Value
      boolean HighpH = (ReefAngel.Params.PH > 850);     // Check for High pH Value
      if (LowpH) 
      {
        pHColor = COLOR_NAVY;                          // Blue text, Low pH value
      }
      if (HighpH)   
      {
        pHColor = COLOR_RED;                           // Red text, High pH value
      }
      if (!LowpH && !HighpH) 
      {
        pHColor = COLOR_GREEN;                         // Green text, pH acceptable
      }
      // ***********************************************************************************
      ReefAngel.LCD.DrawLargeText(COLOR_DARKSLATEBLUE,DefaultBGColor, 6, 3, " Thunder Reef",Font8x8);   // Put a banner at the top
      ReefAngel.LCD.DrawDate(6, 119);                                                                   // Put the date and time at the bottom
      ReefAngel.LCD.Clear(COLOR_BLACK, 1, 12, 132, 12);                                                 // Draw a cyan line under the banner
      x = 6;
      y += MENU_START_ROW*1.4;                                                                          // MENU_START_ROW is 10, according to globals.h, so y=2+10+1=13
      ReefAngel.LCD.DrawLargeText(COLOR_BLUE, COLOR_WHITE, x, y+1, " Temp      pH");

      ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);                                    // Get T1 temp and convert
      x = 2;
      y += MENU_START_ROW*1.6;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_BLACK, TempColor, x, y, text);                                // Draw the temperature, white numbers on a colored background
      ConvertNumToString(text, ReefAngel.Params.PH, 100);                                               // Get pH reading and convert
      x = 2;
      y = MENU_START_ROW*2.6;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_YELLOW, pHColor, x+65, y+6, text);                            // Put pH on the screen
     
      x += 6;
      y += MENU_START_ROW*3.3;
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,25,y,"Sump Level",Font8x8);      // Draw the Sump Float switch status
  if (ReefAngel.HighATO.IsActive()) {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_RED);
  } else {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_GREEN);
  }
  x += 6;
  y += MENU_START_ROW*2.0;
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,25,y,"Skimmer Cup",Font8x8);     // Draw the Skimmer Cup Float switch status
  if (ReefAngel.LowATO.IsActive()) {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_RED);
  }
      
      
      byte TempRelay = ReefAngel.Relay.RelayData;                                          // Code for drawing the relay box
      TempRelay &= ReefAngel.Relay.RelayMaskOff;
      TempRelay |= ReefAngel.Relay.RelayMaskOn;
      ReefAngel.LCD.DrawOutletBox(12, 100, TempRelay);
   }
void DrawCustomGraph()
{
}

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port7Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 830 );

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port7 );

  

    ////// Place additional initialization code below here
   
    sl.Init(35.5022, 97.7492); // In decimal numbers (i.e. -18.285833, 147.699722)
    sl.SetOffset(7,0,7,0); // rise_hour, rise_seconds, set_hour, set_seconds 

    
    ReefAngel.CustomLabels[0]="Return";  
    ReefAngel.CustomLabels[1]="Daylights";  
    ReefAngel.CustomLabels[2]="Actinics";  
    ReefAngel.CustomLabels[3]="Fuge Light";  
    ReefAngel.CustomLabels[4]="Sump Fan";  
    ReefAngel.CustomLabels[5]="Heater";  
    ReefAngel.CustomLabels[6]="Skimmer";  
    ReefAngel.CustomLabels[7]="ATO";  
    

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

void loop()
{

    ReefAngel.StandardFan( Port5,785,787 );
    ReefAngel.StandardHeater( Port6,783,785 );
    ReefAngel.DayLights( Port2 );             // ATI DayLights (White+Purple)  On 1 hr after sunrise, off 1 hr before sunset.
    ReefAngel.ActinicLights( Port3 );         // ATI Actinic+ Lights (Blues).   On at sunrise, off at sunset.
    ReefAngel.MoonLights( Port4 );            // Refugium light.  On 1 hr before sunset, off 1 hr after sunrise.
  
    
    ////// Place your custom code below here
    
if (hour()>=9 && hour()<11)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,55,10,true) ); // Long pulse at 55% with 10s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,55,10,false) ); // Long pulse at 55% with 10s pulse on Anti-sync mode
}
else if (hour()>=11 && hour()<12)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,60,5,true) ); // Long pulse at 60% with 5s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,60,5,false) ); // Long pulse at 60% with 5s pulse on Anti-sync mode
}
else if (hour()>=12 && hour()<13)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,65,2,true) ); // Long pulse at 65% with 2s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,65,2,false) ); // Long pulse at 65% with 2s pulse on Anti-sync mode
}
else if (hour()>=13 && hour()<14)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,69,680,true) ); // Short pulse at 71% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,69,680,false) ); // Short pulse at 71% with 680ms pulse on Anti-sync mode
}
else if (hour()>=14 && hour()<15)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,73,680,true) ); // Short pulse at 78% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,73,680,false) ); // Short pulse at 78% with 680ms pulse on Anti-sync mode
}
else if (hour()>=15 && hour()<16)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,78,690,true) ); // Short pulse at 87% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,78,690,false) ); // Short pulse at 87% with 680ms pulse on Anti-sync mode
}
else if (hour()>=16 && hour()<17)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,73,680,true) ); // Short pulse at 78% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,73,680,false) ); // Short pulse at 78% with 680ms pulse on Anti-sync mode
}
else if (hour()>=17 && hour()<18)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,69,680,true) ); // Short pulse at 71% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,69,680,false) ); // Short pulse at 71% with 680ms pulse on Anti-sync mode
}
else if (hour()>=18 && hour()<19)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,65,2,true) ); // Long pulse at 65% with 2s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,65,2,false) ); // Long pulse at 65% with 2s pulse on Anti-sync mode
}
else if (hour()>=19 && hour()<20)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,60,5,true) ); // Long pulse at 60% with 5s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,60,5,false) ); // Long pulse at 60% with 5s pulse on Anti-sync mode
}
else if (hour()>=20 && hour()<21)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,55,10,true) ); // Long pulse at 55% with 10s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,55,10,false) ); // Long pulse at 55% with 10s pulse on Anti-sync mode
}
else
{
 ReefAngel.PWM.SetDaylight( ReefCrestMode(40,10,true) ); // reefcrest at 40% +/- 10% on sync mode  (night Mode)
 ReefAngel.PWM.SetActinic( ReefCrestMode(40,10,true) ); // reefcrest at 40% +/- 10% on sync mode  (night mode)
}
 
if( ReefAngel.DisplayedMenu==FEEDING_MODE )
{
 ReefAngel.PWM.SetActinic(0);
 ReefAngel.PWM.SetDaylight(0);
}
   
    if(ReefAngel.LowATO.IsActive())          //  Float switch in Skimmer Cup
 {
    ReefAngel.Relay.On(Port7);
 }
    else
 {
    ReefAngel.Relay.Off(Port7);              //  Turn off Skimmer when Cup full.
 }
      
    if(ReefAngel.HighATO.IsActive())          //  Float switch in Sump
 {
    ReefAngel.Relay.On(Port8);                //  Run ATO pump.
 }
    else
 {
    ReefAngel.Relay.Off(Port8);                //  Sump level acceptable.
 }
   
    ReefAngel.SingleATO(false,Port8,180,0);   //  Sump switch.  If ATO runs for 180 seconds, then shut off and send alert.
 
  {
   
    // handle updating sunrise and sunset values
    sl.CheckAndUpdate();
  }
 
    ////// Place your custom code above here

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

Re: Things I am needing help with

Post by lnevo »

Sorry, the reverse code should be ReefAngel.ReverseATOHigh();

As far as the actinics you are using internal memory based on the code you provided.

sl.CheckAndUpdate(); should be updating internal memory with the times for sunrise and sunset, but it also takes into account the actinic offset that is currently set. The problem is that if you change the offset, it doesn't take into account until the next time it updates at midnight or if you reboot.
DmnYnkee
Posts: 83
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida

Re: Things I am needing help with

Post by DmnYnkee »

So if I change offset in portal to 90, or 120, once it updates, it should be what I am looking for? Still keeping actinics as the constant (based on sunrise/sunset), and pushing back the daylights?

I am using local lat/long for testing, and the offset in the code is 7, which I believe is GMT +6 (for us central time zone) then +1 daylight saving time. Am I correct on this?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Things I am needing help with

Post by lnevo »

I'm not sure the timezone offset thing is wierd because of the way the arduino works. If you change the actinic offset and reset the controller you should see the daylight time shift to accommodate the changed actinic offset.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Things I am needing help with

Post by lnevo »

I think i can add a patch so if the offset changes, the time change can reflect immediately.
DmnYnkee
Posts: 83
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida

Re: Things I am needing help with

Post by DmnYnkee »

No patch necessary. It updated over night, and worked as expected.

Will try the revised code to reverse ATO float later today. Thanks much for all you help.

I think all I am wanting to do now is add the automatic temp changes according to month. This chunk of code code is borrowed from hedricksms. I will tinker with it some more and see if I can figure it out.

Code: Select all

 void SeasonalTemps ()
 {
  ReefAngel.CustomVar[0]=month();
  static int heatArray[][2] = { {792,796},// default in case of error in month=0 (June)
                    {770,774},//January (winter)
                    {774,778},//February (winter)
                    {775,779},//March (early spring)
                    {779,783},//April (spring)
                    {785,789},//May (spring)
                    {792,796},//June (early summer)
                    {799,803},//July (summer)
                    {806,810},//August (summer)
                    {796,801},//September (early fall)
                    {787,791},//October (fall)
                    {780,784},//November (fall)
                    {775,779} };//December (early winter)
               
  static int coolArray[][2] = { {794,799},// default in case of error in month=0 (June)
                    {772,776},//January (winter)
                    {776,780},//February (winter)
                    {777,781},//March (early spring)
                    {781,785},//April (spring)
                    {787,791},//May (spring)
                    {794,798},//June (early summer)
                    {801,805},//July (summer)
                    {808,812},//August (summer)
                    {798,803},//September (early fall)
                    {789,793},//October (fall)
                    {782,786},//November (fall)
                    {777,781} };//December (early winter)
               
  ReefAngel.StandardHeater( Heater,heatArray[month()][0],heatArray[month()][1]);
  ReefAngel.StandardFan(Cooling,coolArray[month()][0],coolArray[month()][1]);
 }//end seasonalTemps
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Things I am needing help with

Post by lnevo »

You could post the error you're getting when you compile that will help immensely.

I'll still do the patch at some point because it annoys me :)
DmnYnkee
Posts: 83
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida

Re: Things I am needing help with

Post by DmnYnkee »

Trying with this code.

Getting the error:

L1.cpp: In function 'void SeasonalTemps()':
L1:325: error: 'Heater' was not declared in this scope
L1:326: error: 'Cooling' was not declared in this scope

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 <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>
#include <SunLocation.h>
#include <Tide.h>
#include <Moon.h>
#include <WiFiAlert.h>


////// Place global variable code below here
  
  SunLocation sl;
  
  int avgph[10];
    unsigned long totalavgph=0;
    byte avgindex=0;

void DrawCustomMain()
    {
      byte x;
      byte y = 2;
      char text[7];

      // *********** CHANGE TEMP READOUT COLOR DEPENDENT ON FAN AND HEATER STATUS ***********
      int TempColor;                                    // Color for drawing temperature
      boolean FanOn = ReefAngel.Relay.Status(Port5);    // Get the status of the fan relay
      boolean HeatOn = ReefAngel.Relay.Status(Port6);   // Get the status of the heater relay
      if (HeatOn) 
      {
        TempColor = COLOR_NAVY;                         // Blue text, too cold, heater is on
      }
      if (FanOn)   
      {
          TempColor = COLOR_RED;                        // Red text, too warm, fan is on
      }
      if (!HeatOn && !FanOn) 
      {
          TempColor = COLOR_GREEN;                      // Green text, no fan or heater on
      }
      // ***********************************************************************************
           int pHColor;                                 // Color for drawing pH
      boolean LowpH = (ReefAngel.Params.PH < 780) ;     // Check for Low pH Value
      boolean HighpH = (ReefAngel.Params.PH > 850);     // Check for High pH Value
      if (LowpH) 
      {
        pHColor = COLOR_NAVY;                          // Blue text, Low pH value
      }
      if (HighpH)   
      {
        pHColor = COLOR_RED;                           // Red text, High pH value
      }
      if (!LowpH && !HighpH) 
      {
        pHColor = COLOR_GREEN;                         // Green text, pH acceptable
      }
      // ***********************************************************************************
      ReefAngel.LCD.DrawLargeText(COLOR_DARKSLATEBLUE,DefaultBGColor, 6, 3, " Thunder Reef",Font8x8);   // Put a banner at the top
      ReefAngel.LCD.DrawDate(6, 119);                                                                   // Put the date and time at the bottom
      ReefAngel.LCD.Clear(COLOR_BLACK, 1, 12, 132, 12);                                                 // Draw a cyan line under the banner
      x = 6;
      y += MENU_START_ROW*1.4;                                                                          // MENU_START_ROW is 10, according to globals.h, so y=2+10+1=13
      ReefAngel.LCD.DrawLargeText(COLOR_BLUE, COLOR_WHITE, x, y+1, " Temp      pH");

      ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);                                    // Get T1 temp and convert
      x = 2;
      y += MENU_START_ROW*1.6;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_BLACK, TempColor, x, y, text);                                // Draw the temperature, white numbers on a colored background
      ConvertNumToString(text, ReefAngel.Params.PH, 100);                                               // Get pH reading and convert
      x = 2;
      y = MENU_START_ROW*2.6;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_YELLOW, pHColor, x+65, y+6, text);                            // Put pH on the screen
     
      x += 6;
      y += MENU_START_ROW*3.3;
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,25,y,"Sump Level",Font8x8);      // Draw the Sump Float switch status
  if (ReefAngel.HighATO.IsActive()) {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_RED);
  } else {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_GREEN);
  }
  x += 6;
  y += MENU_START_ROW*2.0;
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,25,y,"Skimmer Cup",Font8x8);     // Draw the Skimmer Cup Float switch status
  if (ReefAngel.LowATO.IsActive()) {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_RED);
  }
      
      
      byte TempRelay = ReefAngel.Relay.RelayData;                                          // Code for drawing the relay box
      TempRelay &= ReefAngel.Relay.RelayMaskOff;
      TempRelay |= ReefAngel.Relay.RelayMaskOn;
      ReefAngel.LCD.DrawOutletBox(12, 100, TempRelay);
   }
void DrawCustomGraph()
{
}

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port7Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 830 );

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port7 );

  

    ////// Place additional initialization code below here
   
    sl.Init(35.5022, 97.7492); // In decimal numbers (i.e. -18.285833, 147.699722)
    sl.SetOffset(7,0,7,0); // rise_hour, rise_seconds, set_hour, set_seconds 

    randomSeed(now()%SECS_PER_DAY);
      
      //Custom Variable [0] =  Month/Season
    
    ReefAngel.CustomLabels[0]="Return";  
    ReefAngel.CustomLabels[1]="Daylights";  
    ReefAngel.CustomLabels[2]="Actinics";  
    ReefAngel.CustomLabels[3]="Fuge Light";  
    ReefAngel.CustomLabels[4]="Sump Fan";  
    ReefAngel.CustomLabels[5]="Heater";  
    ReefAngel.CustomLabels[6]="Skimmer";  
    ReefAngel.CustomLabels[7]="ATO";  
    

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

void loop()
{
  

    // seasonal temperatures
    SeasonalTemps();

    ReefAngel.DayLights( Port2 );             // ATI DayLights (White+Purple)  On 1 hr after sunrise, off 1 hr before sunset.
    ReefAngel.ActinicLights( Port3 );         // ATI Actinic+ Lights (Blues).   On at sunrise, off at sunset.
    ReefAngel.MoonLights( Port4 );            // Refugium light.  On 1 hr before sunset, off 1 hr after sunrise.
  
    
    ////// Place your custom code below here
    
if (hour()>=9 && hour()<11)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,55,10,true) ); // Long pulse at 55% with 10s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,55,10,false) ); // Long pulse at 55% with 10s pulse on Anti-sync mode
}
else if (hour()>=11 && hour()<12)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,60,5,true) ); // Long pulse at 60% with 5s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,60,5,false) ); // Long pulse at 60% with 5s pulse on Anti-sync mode
}
else if (hour()>=12 && hour()<13)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,65,2,true) ); // Long pulse at 65% with 2s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,65,2,false) ); // Long pulse at 65% with 2s pulse on Anti-sync mode
}
else if (hour()>=13 && hour()<14)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,69,680,true) ); // Short pulse at 71% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,69,680,false) ); // Short pulse at 71% with 680ms pulse on Anti-sync mode
}
else if (hour()>=14 && hour()<15)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,73,680,true) ); // Short pulse at 78% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,73,680,false) ); // Short pulse at 78% with 680ms pulse on Anti-sync mode
}
else if (hour()>=15 && hour()<16)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,78,690,true) ); // Short pulse at 87% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,78,690,false) ); // Short pulse at 87% with 680ms pulse on Anti-sync mode
}
else if (hour()>=16 && hour()<17)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,73,680,true) ); // Short pulse at 78% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,73,680,false) ); // Short pulse at 78% with 680ms pulse on Anti-sync mode
}
else if (hour()>=17 && hour()<18)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,69,680,true) ); // Short pulse at 71% with 680ms pulse on sync mode
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,69,680,false) ); // Short pulse at 71% with 680ms pulse on Anti-sync mode
}
else if (hour()>=18 && hour()<19)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,65,2,true) ); // Long pulse at 65% with 2s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,65,2,false) ); // Long pulse at 65% with 2s pulse on Anti-sync mode
}
else if (hour()>=19 && hour()<20)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,60,5,true) ); // Long pulse at 60% with 5s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,60,5,false) ); // Long pulse at 60% with 5s pulse on Anti-sync mode
}
else if (hour()>=20 && hour()<21)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,55,10,true) ); // Long pulse at 55% with 10s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,55,10,false) ); // Long pulse at 55% with 10s pulse on Anti-sync mode
}
else
{
 ReefAngel.PWM.SetDaylight( ReefCrestMode(40,10,true) ); // reefcrest at 40% +/- 10% on sync mode  (night Mode)
 ReefAngel.PWM.SetActinic( ReefCrestMode(40,10,true) ); // reefcrest at 40% +/- 10% on sync mode  (night mode)
}
 
if( ReefAngel.DisplayedMenu==FEEDING_MODE )
{
 ReefAngel.PWM.SetActinic(0);
 ReefAngel.PWM.SetDaylight(0);
}
   
    if(ReefAngel.LowATO.IsActive())          //  Float switch in Skimmer Cup
 {
    ReefAngel.Relay.On(Port7);
 }
    else
 {
    ReefAngel.Relay.Off(Port7);              //  Turn off Skimmer when Cup full.
 }
      
    if(ReefAngel.HighATO.IsActive())          //  Float switch in Sump
 {
    ReefAngel.Relay.On(Port8);                //  Run ATO pump.
 }
    else
 {
    ReefAngel.Relay.Off(Port8);                //  Sump level acceptable.
 }
   
    ReefAngel.SingleATO(false,Port8,180,0);   //  Sump switch.  If ATO runs for 180 seconds, then shut off and send alert.
 
  {
   
    // handle updating sunrise and sunset values
    sl.CheckAndUpdate();
  }
 
    ////// Place your custom code above here

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

 void SeasonalTemps ()
 {
  static int heatArray[][2] = { {792,796},// default in case of error in month=0 (June)
                    {770,774},//January (winter)
                    {774,778},//February (winter)
                    {775,779},//March (early spring)
                    {779,783},//April (spring)
                    {785,789},//May (spring)
                    {792,796},//June (early summer)
                    {799,803},//July (summer)
                    {806,810},//August (summer)
                    {796,801},//September (early fall)
                    {787,791},//October (fall)
                    {780,784},//November (fall)
                    {775,779} };//December (early winter)
               
  static int coolArray[][2] = { {794,797},// default in case of error in month=0 (June)
                    {772,775},//January (winter)
                    {776,779},//February (winter)
                    {777,780},//March (early spring)
                    {781,784},//April (spring)
                    {787,790},//May (spring)
                    {794,797},//June (early summer)
                    {801,804},//July (summer)
                    {808,811},//August (summer)
                    {798,802},//September (early fall)
                    {789,792},//October (fall)
                    {782,785},//November (fall)
                    {777,780} };//December (early winter)   
               
  ReefAngel.StandardHeater( Heater,heatArray[month()][0],heatArray[month()][1]);
  ReefAngel.StandardFan(Cooling,coolArray[month()][0],coolArray[month()][1]);
 }//end seasonalTemps

Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Things I am needing help with

Post by lnevo »

See easy peazy... Heater and and Cooling were defined by the previous author as his ports for his heater and fan. Simply change those to be the ports you want to use or you can define them like this

#define Heater Port7
DmnYnkee
Posts: 83
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida

Re: Things I am needing help with

Post by DmnYnkee »

That was too easy, lol. I should have been able to figure that out. Thanks again!
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Things I am needing help with

Post by lnevo »

No problem, sometimes the easy things are hardest to figure out. You've out together quite a few things so far! Quite impressive
Post Reply