Page 5 of 6

Re: Custom Main Screens

Posted: Tue Apr 02, 2013 1:56 pm
by rimai
You will need to copy/paste your custom screen everytime.

Re: Custom Main Screens

Posted: Thu Apr 11, 2013 4:23 pm
by cosmith71
My take on the custom screen. The temperature text changes color depending on the state of the heater and fan.

Green = Heater and fan off, temp good.
Red = Temp too high, fan on.
Blue = Temp too low, heater on.

Edit: This assumes the fan is on relay 1 and the heater is on relay 2.

Image
Code:

Code: Select all

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(Port1);    // Get the status of the fan relay
  boolean HeatOn = ReefAngel.Relay.Status(Port2);   // 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
  }
  // ***********************************************************************************
  
  ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 30, 2, "Colin's Reef");       // 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, 11, 132, 11);                                    // Draw a black line under the banner
  x = 12;
  y += MENU_START_ROW+1;                                                               // MENU_START_ROW is 10, according to globals.h, so y=2+10+1=13
  ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Tank Temp     pH");
  ConvertNumToString(text, ReefAngel.Params.PH, 100);                                  // Get pH reading and convert
  ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text, Font8x16);    // Put pH on the screen
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);                       // Get T1 temp and convert
  y += MENU_START_ROW*2;
  x = 10;
  ReefAngel.LCD.DrawHugeNumbers(COLOR_WHITE, TempColor, x, y, text);                   // Draw the temperature, white numbers on a colored background
  x += (16*4) + 8;
  ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,8,y+25,"White %");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, 24, y+35, 1);    // Draw the white light %
  ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+8,y+25,"Blue %");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+24, y+35, 1);   // Draw the blue light %

  // Code for drawing the relay box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);
}
--Colin

Custom Main Screens

Posted: Thu Apr 11, 2013 6:01 pm
by lnevo
Awesome idea!!!! Getting copied!

Re: Custom Main Screens

Posted: Thu Apr 11, 2013 6:36 pm
by binder
I had NO IDEA that all these awesome designs and ideas would come from me creating these template functions to allow people to customize their displays.

Great idea for your display. Simple and clean. Looks great!

Re: Custom Main Screens

Posted: Thu Apr 11, 2013 7:56 pm
by cosmith71
binder wrote:I had NO IDEA that all these awesome designs and ideas would come from me creating these template functions to allow people to customize their displays.

Great idea for your display. Simple and clean. Looks great!
Thanks! And thanks for the templates. I'm having a blast with my Reef Angel. I doubt this is the final version of my main screen. :mrgreen:

--Colin

Re: Custom Main Screens

Posted: Mon Apr 15, 2013 9:08 am
by cosmith71
Ok, so I'm getting ready to add the WiFi module. I noticed in the sample code there are pingserial() commands scattered about that have something to do with the WiFi module. How often do these need to be put in?

--Colin

Re: Custom Main Screens

Posted: Mon Apr 15, 2013 9:28 am
by rimai
The libraries should take care of that for you.
If you are designing a custom main screen, just make sure to call it if you have lots of drawing on the screen.

Re: Custom Main Screens

Posted: Mon Apr 15, 2013 10:24 am
by cosmith71
Is that because of the length of time the drawing takes?

Re: Custom Main Screens

Posted: Mon Apr 15, 2013 10:30 am
by rimai
Yes.

Re: Custom Main Screens

Posted: Sat Apr 20, 2013 1:01 pm
by cosmith71
Latest version:

Image

Code: Select all

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(Port1);    // Get the status of the fan relay
  boolean HeatOn = ReefAngel.Relay.Status(Port2);   // 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
  }
  // ***********************************************************************************
  
  ReefAngel.LCD.DrawText(COLOR_WHITE, COLOR_BLACK, 0, 1, "     Colin's Reef     ");    // Put a banner at the top
  ReefAngel.LCD.DrawDate(6, 119);                                                      // Put the date and time at the bottom
  pingSerial();                                                                        // Hit the Wifi Attachment
  x = 12;
  y += MENU_START_ROW+1;                                                               // MENU_START_ROW is 10, according to globals.h, so y=2+10+1=13
  ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Tank Temp     pH");
  ConvertNumToString(text, ReefAngel.Params.PH, 100);                                  // Get pH reading and convert
  ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text, Font8x16);    // Put pH on the screen
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);                       // Get T1 temp and convert
  pingSerial();
  y += MENU_START_ROW*2;
  x = 10;
  ReefAngel.LCD.Clear(TempColor, x, y-1, x+63, y-1);                                   // Draw a line above and below the temp
  ReefAngel.LCD.Clear(TempColor, x, y+16, x+63, y+16);                                 // To make it look nicer and easier to read  
  ReefAngel.LCD.DrawHugeNumbers(COLOR_WHITE, TempColor, x, y, text);                   // Draw the temperature, white numbers on a colored background
  x += (16*4) + 8;
  pingSerial();
  ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,8,y+25,"White %");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, 24, y+35, 1);    // Draw the white light %
  ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+8,y+25,"Blue %");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+24, y+35, 1);   // Draw the blue light %
  ReefAngel.LCD.Clear(COLOR_BLACK,5,y+22,127,y+22);                                    // Draw a box around the light area
  ReefAngel.LCD.Clear(COLOR_BLACK,5,y+22,5,y+46);                                      //
  ReefAngel.LCD.Clear(COLOR_BLACK,127,y+22,127,y+46);                                  //
  ReefAngel.LCD.Clear(COLOR_BLACK,5,y+46,127,y+46);                                    //
  pingSerial();
  // Code for drawing the relay box      
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(14, 92, TempRelay);
}

Re: Custom Main Screens

Posted: Mon Apr 22, 2013 11:01 am
by Bo0sted_Rafi
im trying to use the custom screen that showed here but when I upload the code, still showing the graph of the standard screen. Where in the code i remove that graph?

Re: Custom Main Screens

Posted: Mon Apr 22, 2013 1:14 pm
by cosmith71
Bo0sted_Rafi wrote:im trying to use the custom screen that showed here but when I upload the code, still showing the graph of the standard screen. Where in the code i remove that graph?
Add this to the very end of the code posted above:

Code: Select all

void DrawCustomGraph()
{
}
Did that fix it?

--Colin

Re: Custom Main Screens

Posted: Mon Apr 22, 2013 4:28 pm
by Bo0sted_Rafi
I wrote that but give me an error when i tried to compile

Code: Select all

#define SIMPLE_MENU
    #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 <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
    int avgph[10];
    unsigned long totalavgph=0;
    byte avgindex=0;

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


    void setup()
    {
      // This must be the first line
      ReefAngel.Init(); //Initialize controller
      // Ports toggled in Feeding Mode
      ReefAngel.UseFlexiblePhCalibration();
      ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port5Bit | Port3Bit | Port3Bit;
      // Ports toggled in Water Change Mode
      ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port5Bit | Port3Bit | Port6Bit;
      // Ports toggled when Lights On / Off menu entry selected
      ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
      // Ports turned off when Overheat temperature exceeded
      ReefAngel.OverheatShutoffPorts = 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 );

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

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

      for (int a=0;a<10;a++) avgph[a]=analogRead(PHPin);

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

    void loop()
    {
      totalavgph=0;
      avgph[avgindex]=analogRead(PHPin);
      avgindex++;
      if (avgindex==10) avgindex=0;
      for (int a=0;a<10;a++)
        totalavgph+=avgph[a];
      totalavgph/=10;

      totalavgph=map(totalavgph, ReefAngel.PHMin, ReefAngel.PHMax, 700, 1000); // apply the calibration to the sensor reading
      totalavgph=constrain(totalavgph,100,1400);

      if (totalavgph <= 645) ReefAngel.Relay.Off(Port3); 
      if (totalavgph >= 660) ReefAngel.Relay.On(Port3); 

      ReefAngel.Relay.DelayedOn( Port2 );
      //    ReefAngel.CO2Control( Port3,645,660 );
      ReefAngel.StandardFan( Port4,780,788 );
      ReefAngel.WavemakerRandom( Port6,600,180 );
      ReefAngel.StandardLights( Port7,0,30,12,30 );
      ReefAngel.StandardLights( Port8,12,0,2,30 );
      ////// Place your custom code below here
      ////// Place your custom code above here

      // This should always be the last line
      ReefAngel.Portal( "Bo0sted_Rafi" );
      ReefAngel.ShowInterface();
       }
     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(Port4);    // Get the status of the fan relay
      boolean HeatOn = ReefAngel.Relay.Status(Port7);   // 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
      }
      // ***********************************************************************************
     
      ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 30, 2, "Rafi's Reef");       // 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, 11, 132, 11);                                    // Draw a black line under the banner
      x = 12;
      y += MENU_START_ROW+1;                                                               // MENU_START_ROW is 10, according to globals.h, so y=2+10+1=13
      ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Tank Temp    CA pH");
      ConvertNumToString(text, ReefAngel.Params.PH, 100);                                  // Get pH reading and convert
      ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text, Font8x16);    // Put pH on the screen
      ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);                       // Get T1 temp and convert
      y += MENU_START_ROW*2;
      x = 10;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_WHITE, TempColor, x, y, text);                   // Draw the temperature, white numbers on a colored background
      x += (16*4) + 8;
      
      // Code for drawing the relay box
      byte TempRelay = ReefAngel.Relay.RelayData;
      TempRelay &= ReefAngel.Relay.RelayMaskOff;
      TempRelay |= ReefAngel.Relay.RelayMaskOn;
      ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);

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


Dont let me erase the last code

Re: Custom Main Screens

Posted: Mon Apr 22, 2013 5:19 pm
by cosmith71
Take that code out of loop() and put it under your #includes (after "Place global variable code below here").

Try this:

Code: Select all

#define SIMPLE_MENU
    #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 <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
    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(Port4);    // Get the status of the fan relay
      boolean HeatOn = ReefAngel.Relay.Status(Port7);   // 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
      }
      // ***********************************************************************************
     
      ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 30, 2, "Rafi's Reef");       // 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, 11, 132, 11);                                    // Draw a black line under the banner
      x = 12;
      y += MENU_START_ROW+1;                                                               // MENU_START_ROW is 10, according to globals.h, so y=2+10+1=13
      ReefAngel.LCD.DrawText(COLOR_BLUE, COLOR_WHITE, x, y+6, "Tank Temp    CA pH");
      ConvertNumToString(text, ReefAngel.Params.PH, 100);                                  // Get pH reading and convert
      ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, x+75, y+18, text, Font8x16);    // Put pH on the screen
      ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);                       // Get T1 temp and convert
      y += MENU_START_ROW*2;
      x = 10;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_WHITE, TempColor, x, y, text);                   // Draw the temperature, white numbers on a colored background
      x += (16*4) + 8;
      
      // Code for drawing the relay box
      byte TempRelay = ReefAngel.Relay.RelayData;
      TempRelay &= ReefAngel.Relay.RelayMaskOff;
      TempRelay |= ReefAngel.Relay.RelayMaskOn;
      ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);

   }
void DrawCustomGraph()
{
}
    ////// Place global variable code above here


    void setup()
    {
      // This must be the first line
      ReefAngel.Init(); //Initialize controller
      // Ports toggled in Feeding Mode
      ReefAngel.UseFlexiblePhCalibration();
      ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port5Bit | Port3Bit | Port3Bit;
      // Ports toggled in Water Change Mode
      ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port5Bit | Port3Bit | Port6Bit;
      // Ports toggled when Lights On / Off menu entry selected
      ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
      // Ports turned off when Overheat temperature exceeded
      ReefAngel.OverheatShutoffPorts = 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 );

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

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

      for (int a=0;a<10;a++) avgph[a]=analogRead(PHPin);

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

    void loop()
    {
      totalavgph=0;
      avgph[avgindex]=analogRead(PHPin);
      avgindex++;
      if (avgindex==10) avgindex=0;
      for (int a=0;a<10;a++)
        totalavgph+=avgph[a];
      totalavgph/=10;

      totalavgph=map(totalavgph, ReefAngel.PHMin, ReefAngel.PHMax, 700, 1000); // apply the calibration to the sensor reading
      totalavgph=constrain(totalavgph,100,1400);

      if (totalavgph <= 645) ReefAngel.Relay.Off(Port3); 
      if (totalavgph >= 660) ReefAngel.Relay.On(Port3); 

      ReefAngel.Relay.DelayedOn( Port2 );
      //    ReefAngel.CO2Control( Port3,645,660 );
      ReefAngel.StandardFan( Port4,780,788 );
      ReefAngel.WavemakerRandom( Port6,600,180 );
      ReefAngel.StandardLights( Port7,0,30,12,30 );
      ReefAngel.StandardLights( Port8,12,0,2,30 );
      ////// Place your custom code below here
      ////// Place your custom code above here

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


Re: Custom Main Screens

Posted: Mon Apr 29, 2013 1:12 pm
by Poiromaniax
Heres my custom main.
IMG_2170.jpg
IMG_2170.jpg (36.99 KiB) Viewed 10597 times

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (05/14/2012 18:11)
// RA_051412_1811.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define SIMPLE_MENU
#define CUSTOM_MAIN
#define RFEXPANSION
#define FONT_8x8
*/


#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 <ReefAngel.h>

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


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

void DrawCustomMain()
{
    // the graph is drawn/updated when we exit the main menu &
    // when the parameters are saved
    ReefAngel.LCD.DrawDate(6, 122);
    pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();
  ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,DefaultBGColor,15,5,"Ariel's Reef");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,1,30,"Vortech:");
    byte vtechmode = InternalMemory.RFMode_read();
  if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,DefaultBGColor,50,30,"Constant");
  else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_PURPLE,DefaultBGColor,50,30,"Lagoon");
  else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,DefaultBGColor,50,30,"Reef Crest");
  else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,DefaultBGColor,50,30,"Short Pulse");
  else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,DefaultBGColor,50,30,"Long Pulse");
  else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,DefaultBGColor,50,30,"Night");
    pingSerial();
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox(12, 97, TempRelay);
}

void DrawCustomGraph()
{
}



void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit(1);  // set to Celsius Temperature

    // Ports that are always on
    ReefAngel.Relay.On(Port5);
    ReefAngel.Relay.On(Port6);
    ReefAngel.Relay.On(Port7);
    ReefAngel.Relay.On(Port8);
    ////// Place additional initialization code below here
    

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

void loop()
{
    // Specific functions that use Internal Memory values
    ReefAngel.MHLights(Port1);
    ReefAngel.MHLights(Port2);
    ReefAngel.StandardHeater(Port3);
    ReefAngel.StandardHeater(Port4);
    ////// Place your custom code below here
    

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

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

Im not the best at coding so i have chopped quite a bit from other people

Ideally i would love to take out the bottom two rows and have:

Tank Name
Vortech
2 LED Channels (got a vertex illumilux)
Temp
PH
Relays
ATO - Plan on getting one of the new ones - so if theres a way to see how full the reservoir is

if anyone is willing to help me, you would be awesome in my eyes :geek:

Oh, and no peripherals are connected right now as im in the process of switching tanks - incase youre wondering ;)

Re: Custom Main Screens

Posted: Mon Apr 29, 2013 6:34 pm
by binder
One thing I noticed is that you will want to make all these strings the same length:

Code: Select all

  if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,DefaultBGColor,50,30,"Constant");
  else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_PURPLE,DefaultBGColor,50,30,"Lagoon");
  else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,DefaultBGColor,50,30,"Reef Crest");
  else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,DefaultBGColor,50,30,"Short Pulse");
  else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,DefaultBGColor,50,30,"Long Pulse");
  else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,DefaultBGColor,50,30,"Night");
The "Constant", "Lagoon", etc. should be the same length and if they are not, then you should pad them. Looks like "Short Pulse" is the longest at 11 chars.

Code: Select all

So "Constant" should be "Constant   " and "Lagoon" should be "Lagoon     ".
The reason for this is when you change the modes and go from a larger text string to a smaller text string, there will be "ghosting" occurring from the extra characters not being overwritten.

Secondly, you say you want to change the layout of what is displayed? Do you not like having the 3 rows of 2 columns in the middle? Does that need to be changed for you?

Did you still want the date to be at the bottom of the screen? If not, you just need to remove this line:

Code: Select all

ReefAngel.LCD.DrawDate(6, 122);
from the DrawCustomMain() function and the date will no longer be displayed.

Re: Custom Main Screens

Posted: Tue Apr 30, 2013 1:26 am
by Poiromaniax
binder wrote:One thing I noticed is that you will want to make all these strings the same length:

Code: Select all

  if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,DefaultBGColor,50,30,"Constant");
  else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_PURPLE,DefaultBGColor,50,30,"Lagoon");
  else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,DefaultBGColor,50,30,"Reef Crest");
  else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,DefaultBGColor,50,30,"Short Pulse");
  else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,DefaultBGColor,50,30,"Long Pulse");
  else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,DefaultBGColor,50,30,"Night");
The "Constant", "Lagoon", etc. should be the same length and if they are not, then you should pad them. Looks like "Short Pulse" is the longest at 11 chars.

Code: Select all

So "Constant" should be "Constant   " and "Lagoon" should be "Lagoon     ".
The reason for this is when you change the modes and go from a larger text string to a smaller text string, there will be "ghosting" occurring from the extra characters not being overwritten.

Thanks for pointing that out! So let me just make sure i understand, I should rather have all the vortech modes lined up in the code? (im not so savvy when it comes to coding and terms used, what is padding? the gap between the end of the word and the quotations? )

E.G:
"Lagoon "
"Constant "
"Reef Crest "


Secondly, you say you want to change the layout of what is displayed? Do you not like having the 3 rows of 2 columns in the middle? Does that need to be changed for you?

I like the 3x2 layout, just would like to be able to change the paramaters viewed to something like this:
Ariel's Reef
Vortech : Reef Crest
Temp 1: 26 PH: 8.3
White : 70% Blue: 20%
ATO level : 65% etc

(ATO level will get its data from the pressure sensor)


Did you still want the date to be at the bottom of the screen? If not, you just need to remove this line:

Code: Select all

ReefAngel.LCD.DrawDate(6, 122);
from the DrawCustomMain() function and the date will no longer be displayed.
Yeah i like the date and time at the bottom :) thanks though

Replies in red :)

EDIT - well my beautiful formatting has been destroyed by vBulletin/PHPBB

click edit the post and it will all look correct :P

Custom Main Screens

Posted: Tue Apr 30, 2013 9:50 am
by binder
Thanks for pointing that out! So let me just make sure i understand, I should rather have all the vortech modes lined up in the code? (im not so savvy when it comes to coding and terms used, what is padding? the gap between the end of the word and the quotations? )

E.G:
"Lagoon "
"Constant "
"Reef Crest "
yes, the gap between the end of the word and quotation mark. the padding is simply just spaces. so count the letters and use spaces to fill in the extras like i mentioned.
I like the 3x2 layout, just would like to be able to change the paramaters viewed to something like this:
Ariel's Reef
Vortech : Reef Crest
Temp 1: 26 PH: 8.3
White : 70% Blue: 20%
ATO level : 65% etc

(ATO level will get its data from the pressure sensor)
the 3x2 layout you like will have to be created manually with copying and updating the function that displays it. i can help with it later tonight or tomorrow when i get home and can have access to a keyboard and look things up better with formatting. you can look at the DrawMonitor function inside the nokialcd.cpp file to get an idea.

Posted: Tue Apr 30, 2013 1:17 pm
by binder
Ok, here's some code for you based on what you were wanting. I added comments to it and cleaned up things as well (I fixed the spacing issue). Here's the DrawCustomMain function as well as a helper function for drawing your custom monitor box. So just copy and paste these 2 functions into your INO file and replace the existing DrawCustomMain().

Code: Select all

void DrawCustomMain()
{
    // the graph is drawn/updated when we exit the main menu &
    // when the parameters are saved
    ReefAngel.LCD.DrawDate(6, 122);

    // Draw the custom monitor, function listed below
    DrawCustomMonitor(15, 60);

    ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,DefaultBGColor,15,5,"Ariel's Reef");
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,1,30,"Vortech:");

    byte vtechmode = InternalMemory.RFMode_read();
    if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,DefaultBGColor,50,30,"Constant   ");
    else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_PURPLE,DefaultBGColor,50,30,"Lagoon     ");
    else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,DefaultBGColor,50,30,"Reef Crest ");
    else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,DefaultBGColor,50,30,"Short Pulse");
    else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,DefaultBGColor,50,30,"Long Pulse ");
    else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,DefaultBGColor,50,30,"Night      ");

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

void DrawCustomMonitor(byte x, byte y) {

    // To change the column (move it right or left), you will need to adjust the value for X
    // The Labels start at X and the values for them start at X+18. 
    // If you have to move them farther right (making 18 a larger number), you will need to adjust the values for X below for the second column. 
    // The 2nd column labels start at X+60 and the values start at X+78
    // left column - top item
    ReefAngel.LCD.DrawText(T1TempColor,DefaultBGColor,x,y,"T1:");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T1_PROBE], T1TempColor, x+18, y,10);
    // left column - middle item, White LED is on DP Channel
    ReefAngel.LCD.DrawText(DPColor,DefaultBGColor,x,y+10,"White:");
    // you may have to move the value farther to the right
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+18, y+10,1);
    // left column - bottom item
    ReefAngel.LCD.DrawText(T3TempColor,DefaultBGColor,x,y+20,"ATO Level:");
    // you may have to move the value farther to the right
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.WaterLevel.GetLevel(), T3TempColor, x+18, y+20,0);

    // right column - top item
    ReefAngel.LCD.DrawText(PHColor,DefaultBGColor,x+60,y,"PH:");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x+78, y,100);
    // right column - middle item, Blue LED is on AP Channel
    ReefAngel.LCD.DrawText(APColor,DefaultBGColor,x+60,y+10,"Blue:");
    // you may have to move the value farther to the right
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+78, y+10,1);
    // right column - bottom item (not used)
    //DrawText(APColor,DefaultBGColor,x+60,y+20,"AP:");
    //DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+78, y+20,1);
}
The colors may need to be adjusted for you, but that's really easy to change. Also, I assumed that your Blue LED were on the AP channel and the White LED were on the DP channel. They can be flipped if needed. We may also need to adjust the spacing of the column based on the size of the text labels. You will just have to adjust it accordingly and experiment with it.

EDIT: Fixed my typo errors with the code

Re:

Posted: Wed May 01, 2013 10:02 am
by Poiromaniax
binder wrote:Ok, here's some code for you based on what you were wanting. I added comments to it and cleaned up things as well (I fixed the spacing issue). Here's the DrawCustomMain function as well as a helper function for drawing your custom monitor box. So just copy and paste these 2 functions into your INO file and replace the existing .

Wow, thanks dude - You have saved me days of work :D

Il fiddle around with it a bit and post a screenshot when its working nicely :)

Edit - its throwing up this error
Screen Shot 2013-05-01 at 7.08.51 PM.png
Screen Shot 2013-05-01 at 7.08.51 PM.png (55.84 KiB) Viewed 10525 times

Re: Custom Main Screens

Posted: Wed May 01, 2013 3:35 pm
by binder
I just fixed up my code in the previous post. I know the WHITE and Params errors should be gone now. I'm not sure why it is giving you the error about the WaterLevel member. It should be available because it found the Water Level Expansion Module.
Make sure you are running the latest libraries. Perhaps Roberto can shed some more light on this error.

Re: Custom Main Screens

Posted: Wed May 01, 2013 3:42 pm
by rimai
Make sure you add this in your includes up top:

Code: Select all

#include <WaterLevel.h>

Custom Main Screens

Posted: Wed May 01, 2013 10:59 pm
by Poiromaniax
Thanks guys, will give a shot in a bit later :)

Re: Custom Main Screens

Posted: Wed May 15, 2013 10:45 pm
by ReeferBee

Code: Select all


//*********************************************************************************************************************************
//Custom Main, Graph & Menu
void DrawCustomMain()
{
  byte x = 6;
  byte y = 2;
  byte t;
  char text[7];
  static byte vtechmode=0;

  ReefAngel.LCD.DrawDate(6, 2);
  ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
  pingSerial();

  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 6, 90, "--------------------");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 6, 126, "--------------------");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 2, 93, "|");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 2, 103, "|");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 2, 113, "|");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 2, 123, "|");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 126, 93, "|");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 126, 103, "|");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 126, 113, "|");
  ReefAngel.LCD.DrawText(COLOR_TOMATO,255, 126, 123, "|");


  ReefAngel.LCD.DrawText(0,255,18,12,"EcoSmart Vortech");
  if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,35,22,"Constant");
  else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,42,21,"Lagoon");
  else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,25,21,"Reef Crest");
  else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,22,21,"Short Pulse");
  else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,25,21,"Long Pulse");
  else if (vtechmode == 5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,8,21,"Nutrient Trnsp.");
  else if (vtechmode == 6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,23,21,"Tidal Swell");
  else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,0,45,21,"Night");

  ReefAngel.LCD.DrawText(0,255,10,30,"Display");
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawLargeText(COLOR_INDIANRED, 255, 10, 40, text, Num8x8);
  pingSerial();

  ReefAngel.LCD.DrawText(0,255,100,30,"pH");
  ConvertNumToString(text, ReefAngel.Params. PH, 100);
  ReefAngel.LCD.DrawLargeText(COLOR_PLUM, 255, 85, 40, text, Num8x8);
  pingSerial();

  ReefAngel.LCD.DrawText(0,255,43,48,"Salinity");
  ConvertNumToString(text, ReefAngel.Params.Salinity, 100);
  ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN, 255, 49, 58, text, Num8x8);
  pingSerial();

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

  ReefAngel.LCD.DrawText(0,255,8,68,"Sump");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], COLOR_CORNFLOWERBLUE, 40, 68, 10);

  ReefAngel.LCD.DrawText(0,255,70,68,"Room");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], COLOR_CORNFLOWERBLUE, 99, 68, 10);

}
void DrawCustomGraph()
{
}
Is it possible to mod this code to display the mode that my WP40 is running?

Re: Custom Main Screens

Posted: Thu May 16, 2013 7:39 am
by DrewPalmer04
That will display the mode your mp40 is running? Only if you're controlling it via the RF module? The RA sets the mode and then that code displays it on your custom main. I hope you have the RA+ or you'll run out of space quickly.

Re: Custom Main Screens

Posted: Thu May 16, 2013 8:43 am
by ReeferBee
DrewPalmer04 wrote:That will display the mode your mp40 is running? Only if you're controlling it via the RF module? The RA sets the mode and then that code displays it on your custom main. I hope you have the RA+ or you'll run out of space quickly.
Yes, using this part of the coding.

Code: Select all

 ReefAngel.LCD.DrawText(0,255,18,12,"EcoSmart Vortech");
  if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,35,22,"Constant");
  else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,42,21,"Lagoon");
  else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,25,21,"Reef Crest");
  else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,22,21,"Short Pulse");
  else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,25,21,"Long Pulse");
  else if (vtechmode == 5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,8,21,"Nutrient Trnsp.");
  else if (vtechmode == 6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,23,21,"Tidal Swell");
  else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,0,45,21,"Night");
I believe this only works with the RF module though. I want it to display the mode my WP40 are in, through the use of the wp40 harness and dimming ports. Yep, the plus was a must!

Re: Custom Main Screens

Posted: Thu May 16, 2013 9:26 am
by rimai
You can do that.... Can you open a new thread and post your code?

Re: Custom Main Screens

Posted: Thu May 16, 2013 1:02 pm
by ReeferBee
It's not my code. Anther member posted it in this thread. I just wanted to change it up a litte bit. Should I still open another thread with it? Thanks

Re: Custom Main Screens

Posted: Thu May 16, 2013 1:27 pm
by lnevo
Yes, but post your code and that code seperately so we can see how it needs to be integrated.

Re: Custom Main Screens

Posted: Tue May 21, 2013 8:32 pm
by ReeferBee
After a day of tweaking the code I think i finally have it the way I like it.

Image

Code: Select all

//Custom Main, Graph & Menu
void DrawCustomMain()
{
  byte x = 6;
  byte y = 2;
  byte t;
  char text[7];

  ReefAngel.LCD.DrawDate(6, 4);
  ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
  pingSerial();

  ReefAngel.LCD.DrawLargeText(0,255,10,16,"  WP40 Mode:");
  if (vtechmode == 0) ReefAngel.LCD.DrawLargeText(COLOR_LIMEGREEN,255,35,27,"Constant");
  else if(vtechmode == 1) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,42,26,"Lagoon");
  else if (vtechmode == 2) ReefAngel.LCD.DrawLargeText(COLOR_GOLD,255,25,26,"Reef Crest");
  else if (vtechmode == 3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,22,26,"Short Pulse");
  else if (vtechmode == 4) ReefAngel.LCD.DrawLargeText(COLOR_PINK,255,25,26,"Long Pulse");
  else if (vtechmode == 5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,8,26,"Nutrient Trnsp.");
  else if (vtechmode == 6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,23,26,"Tidal Swell");
  else if (vtechmode == 9) ReefAngel.LCD.DrawLargeText(COLOR_WHITE,255,45,26,"Night");

  ReefAngel.LCD.DrawLargeText(0,255,17,49,"Sump");
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
  ReefAngel.LCD.DrawHugeText(COLOR_RED, 255, 12, 65, text, Num12x16);
  pingSerial();

  ReefAngel.LCD.DrawLargeText(0,255,100,40,"pH");
  ConvertNumToString(text, ReefAngel.Params.PH, 100);
  ReefAngel.LCD.DrawLargeText(COLOR_BLUE, 255, 89, 55, text, Num8x8);
  pingSerial();
  
  ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,15,89, "WP40L"); 
  ReefAngel.LCD.DrawText(COLOR_BLACK,255,20,100, ReefAngel.PWM.GetDaylightValue());
  ReefAngel.LCD.DrawText(COLOR_CORNFLOWERBLUE,255,88,89, "WP40R"); 
  ReefAngel.LCD.DrawText(COLOR_BLACK,255,95,100, ReefAngel.PWM.GetActinicValue());

  pingSerial();
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 113, TempRelay);
  
  
}
void DrawCustomGraph()
{
}
I cant take credit, I mostly copied and pasted others codes from this thread.

Thanks!