Limmit which screen text is displayed on

Basic / Standard Reef Angel hardware
Post Reply
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Limmit which screen text is displayed on

Post by paulvisco »

Ok next question, Im using the new screen layout and wanted to put a large text of the temp1 in the extra space provided the below code does that for me but the problem is it is drwn over the splash screen and any sub menus.

Is there a way to get it to display on just the home screen..

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 <ReefAngel_Colors.h>
#include <ReefAngel_CustomColors.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.AddStandardMenu();
  ReefAngel.Use2014Screen();
  ReefAngel.AddDateTimeMenu(); 
  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port7Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port4Bit | Port5Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port2Bit | Port4Bit | Port5Bit | Port6Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;


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

  ////// Place additional initialization code below here
  ReefAngel.CustomLabels[0]="ATO";  
  ReefAngel.CustomLabels[1]="Heater";  
  ReefAngel.CustomLabels[2]="FAN";  
  ReefAngel.CustomLabels[3]="Kessil";  
  ReefAngel.CustomLabels[4]="LED";  
  ReefAngel.CustomLabels[5]="Refugium";  
  ReefAngel.CustomLabels[6]="F Pump";  
  ReefAngel.CustomLabels[7]="C Pump";  

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

void loop()
{
  ReefAngel.StandardATO( Port1 );
  ReefAngel.StandardHeater( Port2 );
  ReefAngel.StandardFan( Port3 );
  ReefAngel.DayLights( Port4 );
  ReefAngel.ActinicLights( Port5 );
  ReefAngel.MoonLights( Port6 );
  ////// Place your custom code below here
  ReefAngel.Relay.Set(Port5, !ReefAngel.Relay.Status(Port4));

  ////// Place your custom code above here
  char text[7];
  byte TempColor = COLOR_GREEN;
  int TempLow = InternalMemory.HeaterTempOn_read();//789
  int TempHigh = InternalMemory.HeaterTempOff_read();//797
  ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
  if(ReefAngel.Params.Temp[T1_PROBE] < TempLow){TempColor = COLOR_BLUE;}
  if((ReefAngel.Params.Temp[T1_PROBE] >= TempLow)&&(ReefAngel.Params.Temp[T1_PROBE] <= TempHigh)){TempColor = COLOR_GREEN;}
  if(ReefAngel.Params.Temp[T1_PROBE] > TempHigh){TempColor = COLOR_RED;}
  ReefAngel.LCD.DrawHugeNumbers(TempColor, COLOR_WHITE, 30, 70, text);


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




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

Re: Limmit which screen text is displayed on

Post by rimai »

Try this:

Code: Select all

if (MenuItem_2014==PARAMS_2014)
{
//Draw what you want here
}
Roberto.
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Re: Limmit which screen text is displayed on

Post by paulvisco »

PaulRA.cpp: In function 'void loop()':
PaulRA:91: error: 'MenuItem_2014' was not declared in this scope
PaulRA:91: error: 'PARAMS_2014' was not declared in this scope
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Limmit which screen text is displayed on

Post by rimai »

Humm... the declaration is not global....
I don't know if this will work...
Try this:

Code: Select all

  if (ReefAngel.MenuItem_2014==0)
Roberto.
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Re: Limmit which screen text is displayed on

Post by paulvisco »

Seems to not have an effect.. it still diplays on the reefangle splash screen and on the main screen and on the sub menu screen when you push the joystick down.. Humm...

but it does not error
Image
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Re: Limmit which screen text is displayed on

Post by paulvisco »

I had it display the Value and it always stays zero..
Image
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Re: Limmit which screen text is displayed on

Post by paulvisco »

Ok I get that test now it is referencing the screen number. so the code does keep it to just screen 0 but the next problem is that the splash screen is screen zero and the sub menu is still the screen number of the parent screen.

so when I press the joystick the temp is still displayed on the submenu text.

do the sub menus have a reference as well


so I would need to know if the splash screen has a way to tell if it is current (before the main display page is drawn)
and the sub menu text is on the screen.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Limmit which screen text is displayed on

Post by rimai »

Let's try another one

Code: Select all

if (ReefAngel.DisplayedMenu==DEFAULT_MENU && ReefAngel.MenuItem_2014==0)
Roberto.
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Re: Limmit which screen text is displayed on

Post by paulvisco »

Bingo!.. That did the trick...

Thanks much
Image
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Re: Limmit which screen text is displayed on

Post by paulvisco »

Crude. any way to tell is the RA splash screen is being displayed just before the main display page is shown..
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Limmit which screen text is displayed on

Post by rimai »

Try this:

Code: Select all

if (ReefAngel.Splash)
{
// Do something
}
Roberto.
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Re: Limmit which screen text is displayed on

Post by paulvisco »

So this is what I came up with as a finalized snipit.

this will display temp1 on the home display screen in blue if under temp low green if between temp low and temp high and red if over temp high


Im happy might be a way to compact the sode a bit but this is working now

Code: Select all

if (!ReefAngel.Splash)
{
  if (ReefAngel.DisplayedMenu==DEFAULT_MENU && ReefAngel.MenuItem_2014==0)
  {
    char text[7];
    byte TempColor;
    
    int TempON = InternalMemory.HeaterTempOn_read();//780
    int TempOFF = InternalMemory.HeaterTempOff_read();// 797
    ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
    if(ReefAngel.Params.Temp[T1_PROBE] < TempON){
      TempColor = COLOR_BLUE;
    }
    if((ReefAngel.Params.Temp[T1_PROBE] >= TempON)&&(ReefAngel.Params.Temp[T1_PROBE] <= TempOFF)){
      TempColor = COLOR_GREEN;
    }
    if(ReefAngel.Params.Temp[T1_PROBE] > TempOFF){
      TempColor = COLOR_RED;
    }
    ReefAngel.LCD.DrawHugeNumbers(TempColor, COLOR_WHITE, 30, 70, text);
  }
}
Image
paulvisco
Posts: 53
Joined: Fri May 17, 2013 2:27 am

Re: Limmit which screen text is displayed on

Post by paulvisco »

Also the PH display is still leaving screen droppings. if the PH displays XX.XX and then displays X.XX after the last printed number it leaves a bit of the 5 chr displayed..
Image
Post Reply