Custom display help

Do you have a question on how to do something.
Ask in here.
Post Reply
garryljf
Posts: 11
Joined: Mon Aug 27, 2012 8:10 am

Custom display help

Post by garryljf »

Hi, this is the first time I'm trying to meddle around with the coding. I saw this code in the forum and tried updating it into my controller. However the following errors start to occur; params.temp1, params.temp2, params temp 3 error. Can I know what is the problem? how can i rectify this? thks.

Code i copied:

Code: Select all

void DrawCustomMain()
    {
    byte x = 6;
    byte y = 2;
    byte t;
    ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 6, 2, "Senses Nano Reef");
    ReefAngel.LCD.DrawDate(6, 118);
    ReefAngel.LCD.Clear(COLOR_BLACK, 1, 17, 132, 17);
    pingSerial();
    x = 12;
    y += MENU_START_ROW+1;
    ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Display       PH");
    char text[7];
    ConvertNumToString(text, ReefAngel.Params.PH, 100);
    ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16);
    ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text);
    pingSerial();

    ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
    y += MENU_START_ROW*2;
    x = 10;
    ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
    pingSerial();
    ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
    pingSerial();
    x += (16*4) + 8;
    ReefAngel.LCD.DrawText(T2TempColor,DefaultBGColor,8,y+25,"ROOM:");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp2, T2TempColor,
    9, y+35, 10);
    ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x+8,y+25,"FRAG:");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp3, T3TempColor,
    x+9, y+35, 10);


    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);



    }

    void DrawCustomGraph()
    {
    }

My code:

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
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port4Bit | Port5Bit | Port6Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 280 );


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

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

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

void loop()
{
    ReefAngel.DosingPumpRepeat( Port1,0,360,2 );
    ReefAngel.DosingPumpRepeat( Port2,60,360,2 );
    ReefAngel.StandardFan( Port3,260,269 );
    ReefAngel.StandardLights( Port5,12,0,19,0 );
    ReefAngel.StandardLights( Port7,15,0,23,55 );
    ReefAngel.StandardLights( Port8,17,0,22,0 );
    ////// Place your custom code below here
    

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

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

void DrawCustomMain()
    {
    byte x = 6;
    byte y = 2;
    byte t;
    ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 6, 2, "Senses Nano Reef");
    ReefAngel.LCD.DrawDate(6, 118);
    ReefAngel.LCD.Clear(COLOR_BLACK, 1, 17, 132, 17);
    pingSerial();
    x = 12;
    y += MENU_START_ROW+1;
    ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Display       PH");
    char text[7];
    ConvertNumToString(text, ReefAngel.Params.PH, 100);
    ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16);
    ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text);
    pingSerial();

    ConvertNumToString(text, ReefAngel.Params.Temp1, 10);
    y += MENU_START_ROW*2;
    x = 10;
    ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
    pingSerial();
    ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
    pingSerial();
    x += (16*4) + 8;
    ReefAngel.LCD.DrawText(T2TempColor,DefaultBGColor,8,y+25,"ROOM:");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp2, T2TempColor,
    9, y+35, 10);
    ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x+8,y+25,"FRAG:");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp3, T3TempColor,
    x+9, y+35, 10);


    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);



    }

void DrawCustomGraph()
{
  ReefAngel.LCD.DrawGraph(5, 15);
}



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

Re: Custom display help

Post by rimai »

Temp1, Temp2 and Temp3 were changed to Temp[T1_PROBE], Temp[T2_PROBE], Temp[T3_PROBE].
So, your code would be like this:

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
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port4Bit | Port5Bit | Port6Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 280 );


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

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

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

void loop()
{
    ReefAngel.DosingPumpRepeat( Port1,0,360,2 );
    ReefAngel.DosingPumpRepeat( Port2,60,360,2 );
    ReefAngel.StandardFan( Port3,260,269 );
    ReefAngel.StandardLights( Port5,12,0,19,0 );
    ReefAngel.StandardLights( Port7,15,0,23,55 );
    ReefAngel.StandardLights( Port8,17,0,22,0 );
    ////// Place your custom code below here
    

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

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

void DrawCustomMain()
    {
    byte x = 6;
    byte y = 2;
    byte t;
    ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 6, 2, "Senses Nano Reef");
    ReefAngel.LCD.DrawDate(6, 118);
    ReefAngel.LCD.Clear(COLOR_BLACK, 1, 17, 132, 17);
    pingSerial();
    x = 12;
    y += MENU_START_ROW+1;
    ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Display       PH");
    char text[7];
    ConvertNumToString(text, ReefAngel.Params.PH, 100);
    ReefAngel.LCD.Clear(DefaultBGColor, x+16, y+65, x+65, y+16);
    ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text);
    pingSerial();

    ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
    y += MENU_START_ROW*2;
    x = 10;
    ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+(16*4),y+16);
    pingSerial();
    ReefAngel.LCD.DrawHugeNumbers(T1TempColor, DefaultBGColor, x, y, text);
    pingSerial();
    x += (16*4) + 8;
    ReefAngel.LCD.DrawText(T2TempColor,DefaultBGColor,8,y+25,"ROOM:");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], T2TempColor,
    9, y+35, 10);
    ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x+8,y+25,"FRAG:");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], T3TempColor,
    x+9, y+35, 10);


    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);



    }

void DrawCustomGraph()
{
  ReefAngel.LCD.DrawGraph(5, 15);
}
Roberto.
garryljf
Posts: 11
Joined: Mon Aug 27, 2012 8:10 am

Re: Custom display help

Post by garryljf »

Thks Roberto! Got it!
Image
Post Reply