Custom Main Screens

Would you like to help?
Share your walkthrough tutorial with others

Posts: 12226
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Tue Apr 02, 2013 1:56 pm
You will need to copy/paste your custom screen everytime.
Roberto.
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Thu Apr 11, 2013 4:23 pm
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
Last edited by cosmith71 on Thu Apr 11, 2013 7:41 pm, edited 1 time in total.
User avatar
Posts: 5348
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Thu Apr 11, 2013 6:01 pm
Awesome idea!!!! Getting copied!
User avatar
Posts: 2737
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Thu Apr 11, 2013 6:36 pm
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!
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Thu Apr 11, 2013 7:56 pm
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
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Mon Apr 15, 2013 9:08 am
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

Posts: 12226
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Mon Apr 15, 2013 9:28 am
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.
Roberto.
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Mon Apr 15, 2013 10:24 am
Is that because of the length of time the drawing takes?

Posts: 12226
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Mon Apr 15, 2013 10:30 am
Yes.
Roberto.
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Sat Apr 20, 2013 1:01 pm
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);
}
PreviousNext

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron