temp adjustments

Basic / Standard Reef Angel hardware
Post Reply
jjdezek
Posts: 327
Joined: Fri May 17, 2013 1:35 pm

temp adjustments

Post by jjdezek »

I want to increase my temp setting so i went to the portal and changed the settings from 76 to 77 and checked on my iphone to see if it changed on there, which it did. the only problem is ive been watching the relays and the heater hasnt kicked on. i have the heater plugged into #7 im woundering if its been turning on at all. I initially set it up through the wizard but never watched to see if the heater kicked on. i know the temp would fluxuate but never got out of control. i dont see anything in my code for heater on off settings but i do see the over temp setting.

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>

////// Place global variable code below here
#define NUMBERS_8x16
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
ReefAngel.LCD.DrawText(COLOR_INDIGO, COLOR_WHITE,25,5, "Jeremy's Reef");
pingSerial();

DrawStatus (20,80);
DrawParams (5,40);
DrawParamsa (0,10);
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}

////// 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 = Port5Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit | 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( 800 );

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


    // Ports that are always on
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port8 );

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

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

void loop()
{
    ReefAngel.StandardATO( Port1,60 );
    ReefAngel.StandardLights( Port3,18,0,10,0 );
    ReefAngel.Wavemaker( Port5,60 );
    ReefAngel.Wavemaker( Port6,60 );
    ReefAngel.StandardHeater( Port7,751,761 );
    ReefAngel.DCPump.DaylightChannel = AntiSync;
    ReefAngel.DCPump.ActinicChannel = Sync;
    ReefAngel.DCPump.ExpansionChannel[0] = None;
    ReefAngel.DCPump.ExpansionChannel[1] = None;
    ReefAngel.DCPump.ExpansionChannel[2] = None;
    ReefAngel.DCPump.ExpansionChannel[3] = None;
    ReefAngel.DCPump.ExpansionChannel[4] = None;
    ReefAngel.DCPump.ExpansionChannel[5] = None;
    ////// Place your custom code below here
      if (ReefAngel.DCPump.Mode==Custom)
  {
  ReefAngel.PWM.SetDaylight( ElseMode(70,30,true ));                     // ElseMode on sync mode, 70 +/- 30%
  ReefAngel.PWM.SetActinic( ElseMode(70,30,false ));                     // ElseMode on anti-sync mode, 70 +/- 30%
  }


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

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

void DrawParamsa(int x, int y){
char buf[16];
  ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x+40,y+10,"WP40L:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1);
ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+40,y+20,"WP40R:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),APColor, x+78, y+20,1);

}

void DrawParams(int x, int y) {
  char buf[16];

  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+5,y,"Temp:");
  ReefAngel.LCD.DrawText(COLOR_BLACK,DefaultBGColor,x+80, y, "PH:");
  // Temp and PH
  y+=10;

  ConvertNumToString(buf, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(T1TempColor, DefaultBGColor, x+5, y, buf, Num8x16);
  ConvertNumToString(buf, ReefAngel.Params.PH, 100);
  ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+80, y, buf, Num8x16);
  y+=5;

}

void DrawStatus(int x, int y) {
  int t=x;
  
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,15,y,"High",Font8x16);
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,85,y,"Low",Font8x16);
  
  if (ReefAngel.HighATO.IsActive()) {
    ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(55,y+3,5,COLOR_RED);
  }
  
  if (ReefAngel.LowATO.IsActive()) {
    ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(70,y+3,5,COLOR_RED);
  }
}

void DrawCustomGraph()
{
}

byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
  // Static's only initialize the first time they are called
  static unsigned long LastChange=millis();        // Set the inital time that the last change occurred
  static int Delay = random( 500, 3000);           // Set the initial delay
  static int NewSpeed = MidPoint;                  // Set the initial speed
  static int AntiSpeed = MidPoint;                 // Set the initial anti sync speed
  if ((millis()-LastChange) > Delay)               // Check if the delay has elapsed
  {
    Delay=random(500,5000);                        // If so, come up with a new delay
    int ChangeUp = random(Offset);                 // Amount to go up or down
    if (random(100)<50)                            // 50/50 chance of speed going up or going down
    {
      NewSpeed = MidPoint - ChangeUp;
      AntiSpeed = MidPoint + ChangeUp;
    }
    else
    {
      NewSpeed = MidPoint + ChangeUp;
      AntiSpeed = MidPoint - ChangeUp;
    }
    LastChange=millis();                           // Reset the time of the last change
  }
  if (WaveSync)
  {
    return NewSpeed;
  }
  else
  {
    return AntiSpeed;
  }
}
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: temp adjustments

Post by lnevo »

Add ReefAngel.StandardHeater(Port7);

You dont' have it in there..
jjdezek
Posts: 327
Joined: Fri May 17, 2013 1:35 pm

Re: temp adjustments

Post by jjdezek »

this is under the void loop
ReefAngel.StandardHeater( Port7,751,761 );
Image
jjdezek
Posts: 327
Joined: Fri May 17, 2013 1:35 pm

Re: temp adjustments

Post by jjdezek »

well i changed the numbers from 751,761 to 770,773 and the heater kicked on. why didnt it change it from the portal?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: temp adjustments

Post by rimai »

You are using hard coded settings.
If you want to change settings through the portal, you must use internal memory settings.
Roberto.
jjdezek
Posts: 327
Joined: Fri May 17, 2013 1:35 pm

Re: temp adjustments

Post by jjdezek »

how would i do that coding?
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: temp adjustments

Post by lnevo »

Sorry I didn't see it when first scanning...

Either way, you want it to look like this to use Internal Memory.
lnevo wrote:ReefAngel.StandardHeater(Port7);
jjdezek
Posts: 327
Joined: Fri May 17, 2013 1:35 pm

Re: temp adjustments

Post by jjdezek »

so would i just remove the ,751,761 from the code? do i add anything else to my code to make it work?
ReefAngel.StandardHeater( Port7,751,761 );
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: temp adjustments

Post by lnevo »

When you remove the values, it defaults to the memory settings... so that's all you gotta do.
jjdezek
Posts: 327
Joined: Fri May 17, 2013 1:35 pm

Re: temp adjustments

Post by jjdezek »

ok thanks
Image
Post Reply