Main Menu features

Do you have a question on how to do something.
Ask in here.
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Main Menu features

Post by bigHUN »

Can somebody help me out with these?
I would like to change some colors on main screen but don't know what are the default abbreviation/names for each...
1. - The first 3+3 channels are some orange color and I want some brighter as dark blue .or can be bolded...
2. - I have 6 I/O channels there I want only 4...
3. - The Temp colors are red, can I go green (same as the ph) or blue , unless the Temp is out of tolerance of 24 to 26 C
4. - what are those DP and AP means? I don't remember I ever use those...

I have the I/O expansion and the dimming expansion modules, two power cables on CH 3-4 running four ELN 60-48D's.
Attachments
_20141207.ino
(5.22 KiB) Downloaded 467 times
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

I have found the colors in libraries, did some changes.
I have also deleted two rings but how can I center the remaining four rings in the width?
Also, how can I change the T1-T3 colors?
_20141207.ino
(5.22 KiB) Downloaded 505 times
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Main Menu features

Post by Sacohen »

Here is a custom Menu generator that was created a while back.
It may help you.

http://forum.reefangel.com/viewtopic.ph ... enu#p14076

There is also a post from Binder about the basic of custom Menus that I'm looking for.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Main Menu features

Post by Sacohen »

This wasn't what I was looking for but it may help too.

http://forum.reefangel.com/viewtopic.php?f=14&t=109
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

My Menu is already some sort of custom from Roberto back in 2012....
I just want to change some colors and font thicknesses, but must be coming from external files in library?....
remove the DP and AP and things like that
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Main Menu features

Post by binder »

bigHUN wrote:My Menu is already some sort of custom from Roberto back in 2012....
I just want to change some colors and font thicknesses, but must be coming from external files in library?....
remove the DP and AP and things like that
The second link that sacohen posted is what you want: http://forum.reefangel.com/viewtopic.php?f=14&t=109

I looked at your code and with what you are using, you are going to get the default colors that are hard coded in the libraries. If you want to change the colors, the "simplest" route will be to modify the INO file to use the custom colors file (so they will remain if you update your libraries). More on this part later....I want to get your DP & AP removed from the display first. Here's the DrawCustomMain() function from your file and I'm going to highlight the part that needs to be removed for the DP & AP stuff:

Code: Select all

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Dimming Expansion
  x = 15;
  y = 2;
  for ( int a=0;a<6;a++ )
  {
    if ( a>2 ) x = 75;
    if ( a==3 ) y = 2;
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
    y += 10;
  }
  pingSerial();

  // I/O Expansion
  byte bkcolor;
  x = 14;
  y = 39;
  for ( int a=0;a<6;a++ )
  {
    ReefAngel.LCD.DrawCircleOutline( x+(a*20),y,4,COLOR_MEDIUMORCHID );
    if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; 
    else bkcolor=COLOR_GRAY;
    ReefAngel.LCD.FillCircle( x+(a*20),y,2,bkcolor );
  }
  pingSerial();

// THIS SECTION IS FOR THE DP & AP - which stands for Daylight and Actinic Ports
// REMOVE FROM HERE 
  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();
// TO HERE TO GET RID OF THE DP & AP

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 12, 90, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 122 );
  pingSerial();
}
Making that change mentioned above will get rid of the DP & AP displaying on your screen.

Depending on what colors you want to change, determines what you need to do. You are already able to change some of the colors by changing them in the code above. If you want to change the colors of some of the main items, you must do handle things a little differently (external custom colors file).

To help out further, could you explain what colors you want to change and what text you want to change the font sizes for?
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

Hello, in mean time I did some changes, got the color naming from the libraries/RA_colors
- changed the 6 chanels colors to NAVY
- also toke 2 out of 6 rings still would like to learn how to center them in horizontal
- how to shift the entire thing down couple pixels, because the space between the relay numbers to date/time is too wide but on the top the Chanels have a haircut?
- how to change the colors for Temp let say whatever BLUE and only when toutch the upper/lower level range specified to be RED?

I have seen it earlier and now just can't find it (not sure if was a post or an instructions file), how to program the fonts locations in X and Y axis, because what is on the screen is too much to the upper side and need to move downward couple lines....

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

  ReefAngel.AddStandardMenu();  // Add Standard Menu

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

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

  ReefAngel.Timer[1].SetInterval(45);

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

void loop()
{
//  ReefAngel.StandardATO( Port1,55 );
  ReefAngel.StandardHeater( Port2,240,255 );
  ReefAngel.StandardLights( Port3,8,5,20,5 );
  ReefAngel.StandardLights( Port4,11,5,15,55 );
  if (hour()>=10 && hour()<18)
  {
    ReefAngel.Wavemaker( Port5,25 );
    ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
  }
  else
  {
    ReefAngel.Relay.Off(Port5);
    ReefAngel.Relay.Off(Port6);
  }
  ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,19,5,1,100,1) );
  ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,18,5,1,100,1) );
  ReefAngel.PWM.SetChannel( 2, PWMParabola(11,5,15,35,1,100,1) );
  ReefAngel.PWM.SetChannel( 3, PWMParabola(14,5,17,25,1,100,1) );
  ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,24,5,40,100,40) );
  ReefAngel.PWM.SetChannel( 5, PWMParabola(9,3,20,15,50,100,50) );
  ////// Place your custom code below here

  //Float #1

  if (ReefAngel.IO.GetChannel(1)) // if float 1 is triggered
  {
  // ReefAngel.Relay.Off(Port8); // Turn Polario off
    ReefAngel.Relay.Off(Port7); // Turn Return off
  // BuzzerOn(); // Turn Buzzer on
  }

  //Float #2
  if (ReefAngel.IO.GetChannel(2)) // if float 2 is triggered
  {
    ReefAngel.Relay.On(Port1); // Turn AutoTopOff on
    ReefAngel.Timer[1].Start(); // Start/Trigger timer
  }

  // Float #3
  // if (ReefAngel.IO.GetChannel(3)) // if float 3 is triggered
  // BuzzerOn(); // Turn Buzzer on

  // Float #4
  // if (ReefAngel.IO.GetChannel(4)) // if float 4 is triggered
  // ReefAngel.Relay.On(Port7); // Turn Skimmer off

  // Float #5
  // if (ReefAngel.IO.GetChannel(5)) // if float 5 is triggered
  // ReefAngel.Relay.Off(Port8); // Turn Return off  
  //  BuzzerOn(); // Turn Buzzer on
  
  // Timer 1
  if (ReefAngel.Timer[1].IsTriggered())
    ReefAngel.Relay.Off(Port1); // Turn AutoTopOff off


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

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

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Dimming Expansion
  x = 15;
  y = 2;
  for ( int a=0;a<6;a++ )
  {
    if ( a>2 ) x = 75;
    if ( a==3 ) y = 2;
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x,y,"Ch :" );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+12,y,a );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
    y += 10;
  }
  pingSerial();

  // I/O Expansion
  byte bkcolor;
  x = 14;
  y = 39;
  for ( int a=0;a<4;a++ )
  {
    ReefAngel.LCD.DrawCircleOutline( x+(a*20),y,4,COLOR_NAVY );
    if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; 
    else bkcolor=COLOR_RED;
    ReefAngel.LCD.FillCircle( x+(a*20),y,2,bkcolor );
  }
  pingSerial();

  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 12, 90, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 122 );
  pingSerial();
}

void DrawCustomGraph()
{
}

void BuzzerOn()
{
  ReefAngel.PWM.SetActinic((now()%2)*100);
}

User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Main Menu features

Post by lnevo »

Btw, this type of debug and playing is perfect for your extra RA board. Although you may not have a screen so you could order an extra screen for it too :)
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

binder : - your highlights removing the entire block not only the DP / AP

Question: - I got a new Temp probe to replace the old was leaking still can use it at dry ambient.
No matter how I plug in now both, the old Temp probe gets to the first-top T1 always to show....
is there any internal code or S/N in the probes the RA+ board is recognizing them?
What is a workaround I can use the new Temp probe for water T1 and lights Temp probe for T2 ?
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Main Menu features

Post by Sacohen »

The temp probes do have a serial number assigned to them and there is not way to change that.

The lowest # will always be the 1st probe no matter what order you plug them in.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Main Menu features

Post by binder »

bigHUN wrote:binder : - your highlights removing the entire block not only the DP / AP
You are correct. I misread the block of code when I was looking at it last night. You will need to change it to be this:

Code: Select all

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Dimming Expansion
  x = 15;
  y = 2;
  for ( int a=0;a<6;a++ )
  {
    if ( a>2 ) x = 75;
    if ( a==3 ) y = 2;
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
    y += 10;
  }
  pingSerial();

  // I/O Expansion
  byte bkcolor;
  x = 14;
  y = 39;
  for ( int a=0;a<6;a++ )
  {
    ReefAngel.LCD.DrawCircleOutline( x+(a*20),y,4,COLOR_MEDIUMORCHID );
    if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; 
    else bkcolor=COLOR_GRAY;
    ReefAngel.LCD.FillCircle( x+(a*20),y,2,bkcolor );
  }
  pingSerial();

  // Parameters - does not display DP & AP
  ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
  pingSerial();

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 12, 90, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 122 );
  pingSerial();
}
I updated the code and this should take care of what you are wanting. It displays only the monitor block and not the DP & AP (aka, the PWM percentages).
Question: - I got a new Temp probe to replace the old was leaking still can use it at dry ambient.
No matter how I plug in now both, the old Temp probe gets to the first-top T1 always to show....
is there any internal code or S/N in the probes the RA+ board is recognizing them?
What is a workaround I can use the new Temp probe for water T1 and lights Temp probe for T2 ?
Like sacohen said, you cannot change the serial numbers on the temp probes. If you want to swap the T1 & T2 probes around, you can add these to your setup():

Code: Select all

void setup() {
...
  // Set the Lights Overheat probe to be T1
  ReefAngel.OverheatProbe = T1_PROBE;  // Default:  T2_PROBE
  // Set the Water Temp probe to be T2, this is used for the StandardHeater and StandardFan functions
  ReefAngel.TempProbe = T2_PROBE;  // Default:  T1_PROBE
}
You're new probe will always be T2 and your old probe will always be T1. So we are just swapping in the code what probe is used for the different sections. If you do not like this idea, then you will just need to physically change how you mount the temp probes and move them around. Otherwise, the code swap is your only software option.
- how to shift the entire thing down couple pixels, because the space between the relay numbers to date/time is too wide but on the top the Chanels have a haircut?
I have seen it earlier and now just can't find it (not sure if was a post or an instructions file), how to program the fonts locations in X and Y axis, because what is on the screen is too much to the upper side and need to move downward couple lines....
This is referenced in the link sacohen earlier. Here's the direct link to the guide that I created about the custom main screen: http://curtbinder.info/ragen/docs/RA_Cu ... Screen.pdf
It details how to draw text on the display with the X,Y coordinates and how to use the fonts, etc.

I think this covers most, if not all, of your questions. Once you get through this stuff, then we can figure out what you have left to finish.
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

I have managed to shift the existing text and graphics on the LCD also swap some colors.

Removing the DP and AP didn't work do to an error in upload:

// Parameters - does not display DP & AP
ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
pingSerial();

"No matching function to call to RA_NokiaLCD"
Also makes me think if we remove these two there will be a huge empty space, what else may be a good to place there?

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

  ReefAngel.AddStandardMenu();  // Add Standard Menu

    // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit 
| Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit 
| Port7Bit | Port8Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = 0;
  // 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( Port7 );
  ReefAngel.Relay.On( Port8 );
   
   // Set the Lights Overheat probe to be T1
  ReefAngel.OverheatProbe = T1_PROBE;  // Default:  T2_PROBE
  // Set the Water Temp probe to be T2, this is used for the StandardHeater and StandardFan functions
  ReefAngel.TempProbe = T2_PROBE;  // Default:  T1_PROBE
  
  ////// Place additional initialization code below here

  ReefAngel.Timer[1].SetInterval(45);

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

void loop()
{
//  ReefAngel.StandardATO( Port1,55 );
  ReefAngel.StandardHeater( Port2,240,255 );
  ReefAngel.StandardLights( Port3,8,5,20,5 );
  ReefAngel.StandardLights( Port4,11,5,15,55 );
  if (hour()>=10 && hour()<18)
  {
    ReefAngel.Wavemaker( Port5,25 );
    ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
  }
  else
  {
    ReefAngel.Relay.Off(Port5);
    ReefAngel.Relay.Off(Port6);
  }
  ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,19,5,1,100,1) );
  ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,18,5,1,100,1) );
  ReefAngel.PWM.SetChannel( 2, PWMParabola(11,5,15,35,1,100,1) );
  ReefAngel.PWM.SetChannel( 3, PWMParabola(14,5,17,25,1,100,1) );
  ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,24,5,40,100,40) );
  //ReefAngel.PWM.SetChannel( 5, PWMParabola(9,3,20,15,50,100,50) );
  ////// Place your custom code below here

  //Float #1

  if (ReefAngel.IO.GetChannel(1)) // if float 1 is triggered
  {
  // ReefAngel.Relay.Off(Port8); // Turn Polario off
    ReefAngel.Relay.Off(Port7); // Turn Return off
  // BuzzerOn(); // Turn Buzzer on
  }

  //Float #2
  if (ReefAngel.IO.GetChannel(2)) // if float 2 is triggered
  {
    ReefAngel.Relay.On(Port1); // Turn AutoTopOff on
    ReefAngel.Timer[1].Start(); // Start/Trigger timer
  }

  // Float #3
  // if (ReefAngel.IO.GetChannel(3)) // if float 3 is triggered
  // BuzzerOn(); // Turn Buzzer on

  // Float #4
  // if (ReefAngel.IO.GetChannel(4)) // if float 4 is triggered
  // ReefAngel.Relay.On(Port7); // Turn Skimmer off

  // Float #5
  // if (ReefAngel.IO.GetChannel(5)) // if float 5 is triggered
  // ReefAngel.Relay.Off(Port8); // Turn Return off  
  //  BuzzerOn(); // Turn Buzzer on
  
  // Timer 1
  if (ReefAngel.Timer[1].IsTriggered())
    ReefAngel.Relay.Off(Port1); // Turn AutoTopOff off


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

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

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Dimming Expansion
  x = 15;
  y = 6;
  for ( int a=0;a<6;a++ )
  {
    if ( a>2 ) x = 75;
    if ( a==3 ) y = 6;
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x,y,"Ch :" );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+12,y,a );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
    y += 10;
  }
  pingSerial();

  // I/O Expansion
  byte bkcolor;
  x = 25;
  y = 43;
  for ( int a=0;a<4;a++ )
  {
    ReefAngel.LCD.DrawCircleOutline( x+(a*25),y,4,COLOR_NAVY );
    if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; 
    else bkcolor=COLOR_RED;
    ReefAngel.LCD.FillCircle( x+(a*25),y,2,bkcolor );
  }
  pingSerial();

  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 12, 95, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 120 );
  pingSerial();
}

void DrawCustomGraph()
{
}

void BuzzerOn()
{
  ReefAngel.PWM.SetActinic((now()%2)*100);
}
How can I rename the default Temp colors to let say GREEN (same as the Ph)? If below 24 BLUE and above 25.5 RED
ReefAngel.StandardHeater( Port2,240,255 );
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Main Menu features

Post by binder »

Ok. I forgot about how the DrawMonitor function works. When you have the PWM enabled, you must include the values for DP & AP otherwise you get that error with the function. So, we just have to "un bundle" that function and display the items individually instead of use that function. Besides, in order to do what you want with the multiple colors, you must do it this way.
I've updated the DrawMain function and I'm pretty sure I have it working the way you want it. You will need to experiment with the colors and also if you want all three temp probes to display the same colors. I chose to have both the labels and the values change text color based on your 24.0 and 25.5 values. If we need to change the labels (the T1, T2, T3 words) back to their original colors, that is easy to do.

Code: Select all

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Dimming Expansion
  x = 15;
  y = 6;
  for ( int a=0;a<6;a++ )
  {
    if ( a>2 ) x = 75;
    if ( a==3 ) y = 6;
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x,y,"Ch :" );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+12,y,a );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
    y += 10;
  }
  pingSerial();

  // I/O Expansion
  byte bkcolor;
  x = 25;
  y = 43;
  for ( int a=0;a<4;a++ )
  {
    ReefAngel.LCD.DrawCircleOutline( x+(a*25),y,4,COLOR_NAVY );
    if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; 
    else bkcolor=COLOR_RED;
    ReefAngel.LCD.FillCircle( x+(a*25),y,2,bkcolor );
  }
  pingSerial();

  // Parameters
  // Set the starting coordinates for displaying the parameters
  x = 15;
  y = 53;
  // Change these values as needed. They are the threshold values
  // for the low and high temperatures, respectively. The values do
  // not contain decimal points. 
  int lowTempValue = 240;
  int highTempValue = 255;
  byte TempColor;
  // To make changes for each temp sensor, change the value
  // of TempColor to be the appropriate color
  // T1 Temperature
  if ( ReefAngel.Params.Temp1 < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp1 > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  DrawText(TempColor,COLOR_WHITE,x,y,"T1:");
  DrawSingleMonitor(ReefAngel.Params.Temp1, TempColor, x+18, y,10); 
  // T2 Temperature
  if ( ReefAngel.Params.Temp2 < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp2 > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  DrawText(TempColor,COLOR_WHITE,x,y+10,"T2:");
  DrawSingleMonitor(ReefAngel.Params.Temp2, TempColor, x+18, y+10,10); 
  // T3 Temperature
  if ( ReefAngel.Params.Temp3 < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp3 > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  DrawText(TempColor,COLOR_WHITE,x,y+20,"T3:");
  DrawSingleMonitor(ReefAngel.Params.Temp3, TempColor, x+18, y+20,10); 
  DrawText(PHColor,COLOR_WHITE,x+60,y,"PH:");
  DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x+78, y,100); 
// Keep these commented out to remove the DP & AP lines
//  DrawText(DPColor,COLOR_WHITE,x+60,y+10,"DP:");
//  DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1); 
//  DrawText(APColor,COLOR_WHITE,x+60,y+20,"AP:");
//  DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+78, y+20,1); 
  pingSerial();

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 12, 95, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 120 );
  pingSerial();
}
To handle the color changing of the temp probes based on the actual temperatures, I update the color used for each temp probe just before I update the display. That is the reason for the conditional statements before i do the DrawText and DrawSingleMonitor functions.
This should hopefully take care of what you want it to do. If you need to shift the position on the screen down some, to fill in some blank spaces, just adjust the y coordinate and it will move it either down or up the screen (depending on how you adjust the y coordinate).
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

got an error at upload:

if ( ReefAngel.Params.Temp1 < lowTempValue ) { TempColor = COLOR_BLUE; }

*****"struct ParamsSruct' has no member named 'Temp1'"

DrawText(DPColor,COLOR_WHITE,x+60,y+10,"DP:");

*****"DrawText' was not declared in the scope"
Last edited by bigHUN on Wed Dec 10, 2014 8:17 pm, edited 1 time in total.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Main Menu features

Post by rimai »

Use Temp[T1_PROBE] instead of Temp1
Roberto.
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

rimai - I will try that on spare board, right now my laptop is connected to main tank ********Temp[T1_PROBE] instead of Temp1

binder - these command lines didn't gave me error on the spare board, that is good news, but

// Set the Lights Overheat probe to be T1
ReefAngel.OverheatProbe = T1_PROBE; // Default: T2_PROBE
// Set the Water Temp probe to be T2, this is used for the StandardHeater and StandardFan functions
ReefAngel.TempProbe = T2_PROBE; // Default: T1_PROBE

this may swap the internal calculation I don't know yet, I will let it test for overnight, but still
on the display the T1 (is the upper value) is showing the "old" temp probe with ambient of 20.1C and below the T2 is showing the tank temperatures of 24.6C...............I hope so or I have a fried fish for breakfast...
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

rimai

I used all Temp[T1_PROBE] instead of Temp1; Temp[T2_PROBE] instead of Temp2; Temp[T3_PROBE] instead of Temp3

gave me an error on line

DrawText(TempColor,COLOR_WHITE,x,y,"T1:");

********'DrawText' was not declared in this scope
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

forgot

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

  ReefAngel.AddStandardMenu();  // Add Standard Menu

    // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit 
| Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit 
| Port7Bit | Port8Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = 0;
  // 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( Port7 );
  ReefAngel.Relay.On( Port8 );
   
   // Set the Lights Overheat probe to be T1
  ReefAngel.OverheatProbe = T1_PROBE;  // Default:  T2_PROBE
  // Set the Water Temp probe to be T2, this is used for the StandardHeater and StandardFan functions
  ReefAngel.TempProbe = T2_PROBE;  // Default:  T1_PROBE
  
  ////// Place additional initialization code below here

  ReefAngel.Timer[1].SetInterval(45);

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

void loop()
{
//  ReefAngel.StandardATO( Port1,55 );
  ReefAngel.StandardHeater( Port2,240,255 );
  ReefAngel.StandardLights( Port3,11,5,20,5 );
  ReefAngel.StandardLights( Port4,8,5,15,55 );
  //The following is the timer for Polario
  ReefAngel.StandardLights( Port7,9,5,19,5 );
  if (hour()>=10 && hour()<18)
  {
    ReefAngel.Wavemaker( Port5,25 );
    ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
  }
  else
  {
    ReefAngel.Relay.Off(Port5);
    ReefAngel.Relay.Off(Port6);
  }
  ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,19,5,1,100,1) );
  ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,18,5,1,100,1) );
  ReefAngel.PWM.SetChannel( 2, PWMParabola(11,5,15,35,1,100,1) );
  ReefAngel.PWM.SetChannel( 3, PWMParabola(14,5,17,25,1,100,1) );
  ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,24,5,40,100,40) );
  //ReefAngel.PWM.SetChannel( 5, PWMParabola(9,3,20,15,50,100,50) );
  ////// Place your custom code below here

  //Float #1

  if (ReefAngel.IO.GetChannel(1)) // if float 1 is triggered
  {
  // ReefAngel.Relay.Off(Port8); // Turn Polario off
    ReefAngel.Relay.Off(Port7); // Turn Return off
  // BuzzerOn(); // Turn Buzzer on
  }

  //Float #2
  if (ReefAngel.IO.GetChannel(2)) // if float 2 is triggered
  {
    ReefAngel.Relay.On(Port1); // Turn AutoTopOff on
    ReefAngel.Timer[1].Start(); // Start/Trigger timer
  }

  // Float #3
  // if (ReefAngel.IO.GetChannel(3)) // if float 3 is triggered
  // BuzzerOn(); // Turn Buzzer on

  // Float #4
  // if (ReefAngel.IO.GetChannel(4)) // if float 4 is triggered
  // ReefAngel.Relay.On(Port7); // Turn Skimmer off

  // Float #5
  // if (ReefAngel.IO.GetChannel(5)) // if float 5 is triggered
  // ReefAngel.Relay.Off(Port8); // Turn Return off  
  //  BuzzerOn(); // Turn Buzzer on
  
  // Timer 1
  if (ReefAngel.Timer[1].IsTriggered())
    ReefAngel.Relay.Off(Port1); // Turn AutoTopOff off


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

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

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Dimming Expansion
  x = 15;
  y = 6;
  for ( int a=0;a<6;a++ )
  {
    if ( a>2 ) x = 75;
    if ( a==3 ) y = 6;
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x,y,"Ch :" );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+12,y,a );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
    y += 10;
  }
  pingSerial();

  // I/O Expansion
  byte bkcolor;
  x = 25;
  y = 43;
  for ( int a=0;a<4;a++ )
  {
    ReefAngel.LCD.DrawCircleOutline( x+(a*25),y,4,COLOR_NAVY );
    if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; 
    else bkcolor=COLOR_RED;
    ReefAngel.LCD.FillCircle( x+(a*25),y,2,bkcolor );
  }
  pingSerial();

  // Parameters
//#if defined DisplayLEDPWM && ! defined RemoveAllLights
  //ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params,
  //ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
//#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  //ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
//#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  
  // Parameters
  // Set the starting coordinates for displaying the parameters
  x = 15;
  y = 53;
  // Change these values as needed. They are the threshold values
  // for the low and high temperatures, respectively. The values do
  // not contain decimal points. 
  int lowTempValue = 240;
  int highTempValue = 255;
  byte TempColor;
  // To make changes for each temp sensor, change the value
  // of TempColor to be the appropriate color
  // T1 Temperature
  if ( ReefAngel.Params.Temp[T1_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T1_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  DrawText(TempColor,COLOR_BLUE,x,y,"T1:");
  DrawSingleMonitor(ReefAngel.Params.Temp1, TempColor, x+18, y,10); 
  // T2 Temperature
  if ( ReefAngel.Params.Temp[T2_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T2_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  DrawText(TempColor,COLOR_WHITE,x,y+10,"T2:");
  DrawSingleMonitor(ReefAngel.Params.Temp2, TempColor, x+18, y+10,10); 
  // T3 Temperature
  if ( ReefAngel.Params.Temp[T3_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T3_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  DrawText(TempColor,COLOR_WHITE,x,y+20,"T3:");
  DrawSingleMonitor(ReefAngel.Params.Temp3, TempColor, x+18, y+20,10); 
  DrawText(PHColor,COLOR_WHITE,x+60,y,"PH:");
  DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x+78, y,100); 
  
  pingSerial();
  
  

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 12, 95, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 120 );
  pingSerial();
}

void DrawCustomGraph()
{
}

void BuzzerOn()
{
  ReefAngel.PWM.SetActinic((now()%2)*100);
}

binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Main Menu features

Post by binder »

yeah, i just realized I forgot to add in a part that will make it work. you need to add

Code: Select all

 ReefAngel.LCD. 
in front of all the drawtext and drawsinglemonitor lines, like this :

Code: Select all

 ReefAngel.LCD.DrawText(...) 
ReefAngel.LCD.DrawSingleMonitor(...) 

that should hopefully fix it.

Sent from my Moto X
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

mind you inserting it for me, not sure I can follow you entirely, and thanks in advance
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

rimai, binder THANK YOU FOR THE GREAT HELP
all uploads working, testing now for the functionality
including the code for future reference

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

  ReefAngel.AddStandardMenu();  // Add Standard Menu

    // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit 
| Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit 
| Port7Bit | Port8Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = 0;
  // 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( Port7 );
  ReefAngel.Relay.On( Port8 );
   
   // Set the Lights Overheat probe to be T1
  ReefAngel.OverheatProbe = T1_PROBE;  // Default:  T2_PROBE
  // Set the Water Temp probe to be T2, this is used for the StandardHeater and StandardFan functions
  ReefAngel.TempProbe = T2_PROBE;  // Default:  T1_PROBE
  
  ////// Place additional initialization code below here

  ReefAngel.Timer[1].SetInterval(45);

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

void loop()
{
//  ReefAngel.StandardATO( Port1,55 );
  ReefAngel.StandardHeater( Port2,240,255 );
  ReefAngel.StandardLights( Port3,11,5,20,5 );
  ReefAngel.StandardLights( Port4,8,5,15,55 );
  //The following is the timer for Polario
  ReefAngel.StandardLights( Port7,9,5,19,5 );
  if (hour()>=10 && hour()<18)
  {
    ReefAngel.Wavemaker( Port5,25 );
    ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
  }
  else
  {
    ReefAngel.Relay.Off(Port5);
    ReefAngel.Relay.Off(Port6);
  }
  ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,19,5,0,100,0) );
  ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,18,5,0,100,0) );
  ReefAngel.PWM.SetChannel( 2, PWMParabola(11,5,15,35,0,100,0) );
  ReefAngel.PWM.SetChannel( 3, PWMParabola(14,5,17,25,0,100,0) );
  ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,24,5,40,100,40) );
  //ReefAngel.PWM.SetChannel( 5, PWMParabola(9,3,20,15,50,100,50) );
  ////// Place your custom code below here

  //Float #1

  if (ReefAngel.IO.GetChannel(1)) // if float 1 is triggered
  {
  // ReefAngel.Relay.Off(Port8); // Turn Polario off
    ReefAngel.Relay.Off(Port7); // Turn Return off
  // BuzzerOn(); // Turn Buzzer on
  }

  //Float #2
  if (ReefAngel.IO.GetChannel(2)) // if float 2 is triggered
  {
    ReefAngel.Relay.On(Port1); // Turn AutoTopOff on
    ReefAngel.Timer[1].Start(); // Start/Trigger timer
  }

  // Float #3
  // if (ReefAngel.IO.GetChannel(3)) // if float 3 is triggered
  // BuzzerOn(); // Turn Buzzer on

  // Float #4
  // if (ReefAngel.IO.GetChannel(4)) // if float 4 is triggered
  // ReefAngel.Relay.On(Port7); // Turn Skimmer off

  // Float #5
  // if (ReefAngel.IO.GetChannel(5)) // if float 5 is triggered
  // ReefAngel.Relay.Off(Port8); // Turn Return off  
  //  BuzzerOn(); // Turn Buzzer on
  
  // Timer 1
  if (ReefAngel.Timer[1].IsTriggered())
    ReefAngel.Relay.Off(Port1); // Turn AutoTopOff off


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

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

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Dimming Expansion
  x = 14;
  y = 6;
  for ( int a=0;a<6;a++ )
  {
    if ( a>2 ) x = 75;
    if ( a==3 ) y = 6;
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x,y,"Ch :" );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+12,y,a );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
    y += 10;
  }
  pingSerial();

  // I/O Expansion
  byte bkcolor;
  x = 27;
  y = 47;
  for ( int a=0;a<4;a++ )
  {
    ReefAngel.LCD.DrawCircleOutline( x+(a*25),y,4,COLOR_NAVY );
    if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; 
    else bkcolor=COLOR_RED;
    ReefAngel.LCD.FillCircle( x+(a*25),y,2,bkcolor );
  }
  pingSerial();

  // Parameters
//#if defined DisplayLEDPWM && ! defined RemoveAllLights
  //ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params,
  //ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
//#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  //ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
//#endif // defined DisplayLEDPWM && ! defined RemoveAllLights

// Parameters
  // Set the starting coordinates for displaying the parameters
  x =14;
  y = 60;
  // Change these values as needed. They are the threshold values
  // for the low and high temperatures, respectively. The values do
  // not contain decimal points. 
  int lowTempValue = 240;
  int highTempValue = 255;
  byte TempColor;
  // To make changes for each temp sensor, change the value
  // of TempColor to be the appropriate color
  // T1 Temperature
  if ( ReefAngel.Params.Temp[T1_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T1_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y,"LEDs:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T1_PROBE], TempColor, x+30, y,10); 
  // T2 Temperature
  if ( ReefAngel.Params.Temp[T2_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T2_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y+10,"Tank:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], TempColor, x+30, y+10,10); 
  // T3 Temperature
  if ( ReefAngel.Params.Temp[T3_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T3_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y+20,"Room:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], TempColor, x+30, y+20,10); 
  ReefAngel.LCD.DrawText(PHColor,COLOR_WHITE,x+60,y,"PH:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x+80, y,100); 
// Keep these commented out to remove the DP & AP lines
//  DrawText(DPColor,COLOR_WHITE,x+60,y+10,"DP:");
//  DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1); 
//  DrawText(APColor,COLOR_WHITE,x+60,y+20,"AP:");
//  DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+78, y+20,1); 
  pingSerial();

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 14, 95, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 120 );
  pingSerial();
}

void DrawCustomGraph()
{
}

void BuzzerOn()
{
  ReefAngel.PWM.SetActinic((now()%2)*100);
}

My next step is to find the way dimming to dark when the values showing zero
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Main Menu features

Post by binder »

awesome! glad you got it figured out!

Sent from my Moto X
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

I am noticing, in relative to the time of the day the display shows either 0 or 100% and nothing in between...
at this moment I am testing the parabola, one day, the other day the slope
(btw the LED's are ramping up in the morning, it is visible how the light increases whenever I am passing by, but at evening there is no ramping down, feels like full power until the timer shots the 5-6 relay ports down)
do we have a known issue?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Main Menu features

Post by rimai »

Maybe you got the wrong times?
Can you post the updated code?
Which channels are your LEDs connected to?
Roberto.
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

this last code just couple posts above
#4-5 relays powering the 2+2 dimmers, and these are the four channels from 0-3 feeding the LEDs
(4 is a moonlight and the 5 would be the a cooling fan but the dimming module can't give enough Amps)
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Main Menu features

Post by rimai »

Your relay #4 is on from about 8:05am to 3:55pm
Relay #5 is setup as wavemaker for Koralias or something.
But your channels are setup to go all over the place.
Channel 0 is from 9:05am to 7:05pm
Channel 1 is from 10:05am to 6:05pm
Channel 2 is from 11:05am to 3:35pm
Channel 3 is from 2:05pm to 5:25pm
Your code is really confusing.
Roberto.
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

sorry not #5
3 and 4 have one of each power cables running to 2+2 ELM's,
{I did rewiring the ELM 60-40 drivers for a manual overdrive for case of emergency and when I finished then I noticed the #3 and #4 powercable swap inside the box, didn't wanted to re-solder again so I just moved the timing....}
I had to go downstairs to my old laptop monitoring the parameters for my testing....here is a current code from the RA+

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

  ReefAngel.AddStandardMenu();  // Add Standard Menu

    // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit 
| Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit 
| Port7Bit | Port8Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = 0;
  // 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( Port7 );
  ReefAngel.Relay.On( Port8 );
   
   // Set the Lights Overheat probe to be T1
  ReefAngel.OverheatProbe = T1_PROBE;  // Default:  T2_PROBE
  // Set the Water Temp probe to be T2, this is used for the StandardHeater and StandardFan functions
  ReefAngel.TempProbe = T2_PROBE;  // Default:  T1_PROBE
  
  ////// Place additional initialization code below here

  ReefAngel.Timer[1].SetInterval(45);

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

void loop()
{
//  ReefAngel.StandardATO( Port1,55 );
  ReefAngel.StandardHeater( Port2,240,255 );
  ReefAngel.StandardLights( Port3,11,5,20,5 );
  ReefAngel.StandardLights( Port4,8,5,15,55 );
  //The following is the timer for Polario
  ReefAngel.StandardLights( Port7,9,5,19,5 );
  if (hour()>=10 && hour()<18)
  {
    ReefAngel.Wavemaker( Port5,25 );
    ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
  }
  else
  {
    ReefAngel.Relay.Off(Port5);
    ReefAngel.Relay.Off(Port6);
  }
  //ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,14,5,0,100,0) );
  //ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,15,35,0,100,0) );
  //ReefAngel.PWM.SetChannel( 2, PWMParabola(12,5,17,5,0,100,0) );
  //ReefAngel.PWM.SetChannel( 3, PWMParabola(14,5,19,25,0,100,0) );
  //ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,23,55,0,100,0) );
  //ReefAngel.PWM.SetChannel( 5, PWMParabola(9,3,20,15,50,100,50) );
  
    ReefAngel.PWM.SetChannel( 0, PWMSlope(9,5,14,5,0,100,20,0) );
    ReefAngel.PWM.SetChannel( 1, PWMSlope(10,5,13,35,0,100,20,0) );
    ReefAngel.PWM.SetChannel( 2, PWMSlope(12,5,17,5,0,100,20,0) );
    ReefAngel.PWM.SetChannel( 3, PWMSlope(14,5,19,25,0,100,20,0) );
    ReefAngel.PWM.SetChannel( 4, PWMSlope(18,35,23,55,0,100,30,0) );
  
  ////// Place your custom code below here

  //Float #1

  if (ReefAngel.IO.GetChannel(1)) // if float 1 is triggered
  {
  // ReefAngel.Relay.Off(Port8); // Turn Polario off
    ReefAngel.Relay.Off(Port7); // Turn Return off
  // BuzzerOn(); // Turn Buzzer on
  }

  //Float #2
  if (ReefAngel.IO.GetChannel(2)) // if float 2 is triggered
  {
    ReefAngel.Relay.On(Port1); // Turn AutoTopOff on
    ReefAngel.Timer[1].Start(); // Start/Trigger timer
  }

  // Float #3
  // if (ReefAngel.IO.GetChannel(3)) // if float 3 is triggered
  // BuzzerOn(); // Turn Buzzer on

  // Float #4
  // if (ReefAngel.IO.GetChannel(4)) // if float 4 is triggered
  // ReefAngel.Relay.On(Port7); // Turn Skimmer off

  // Float #5
  // if (ReefAngel.IO.GetChannel(5)) // if float 5 is triggered
  // ReefAngel.Relay.Off(Port8); // Turn Return off  
  //  BuzzerOn(); // Turn Buzzer on
  
  // Timer 1
  if (ReefAngel.Timer[1].IsTriggered())
    ReefAngel.Relay.Off(Port1); // Turn AutoTopOff off


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

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

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Dimming Expansion
  x = 14;
  y = 6;
  for ( int a=0;a<6;a++ )
  {
    if ( a>2 ) x = 75;
    if ( a==3 ) y = 6;
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x,y,"Ch :" );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+12,y,a );
    ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
    y += 10;
  }
  pingSerial();

  // I/O Expansion
  byte bkcolor;
  x = 27;
  y = 47;
  for ( int a=0;a<4;a++ )
  {
    ReefAngel.LCD.DrawCircleOutline( x+(a*25),y,4,COLOR_NAVY );
    if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; 
    else bkcolor=COLOR_RED;
    ReefAngel.LCD.FillCircle( x+(a*25),y,2,bkcolor );
  }
  pingSerial();

  // Parameters
//#if defined DisplayLEDPWM && ! defined RemoveAllLights
  //ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params,
  //ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
//#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  //ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
//#endif // defined DisplayLEDPWM && ! defined RemoveAllLights

// Parameters
  // Set the starting coordinates for displaying the parameters
  x =14;
  y = 60;
  // Change these values as needed. They are the threshold values
  // for the low and high temperatures, respectively. The values do
  // not contain decimal points. 
  int lowTempValue = 240;
  int highTempValue = 255;
  byte TempColor;
  // To make changes for each temp sensor, change the value
  // of TempColor to be the appropriate color
  // T1 Temperature
  if ( ReefAngel.Params.Temp[T1_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T1_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y,"LEDs:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T1_PROBE], TempColor, x+30, y,10); 
  // T2 Temperature
  if ( ReefAngel.Params.Temp[T2_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T2_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y+10,"Tank:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], TempColor, x+30, y+10,10); 
  // T3 Temperature
  if ( ReefAngel.Params.Temp[T3_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
  else if ( ReefAngel.Params.Temp[T3_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
  else { TempColor = PHColor; }
  ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y+20,"Room:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], TempColor, x+30, y+20,10); 
  ReefAngel.LCD.DrawText(PHColor,COLOR_WHITE,x+60,y,"PH:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x+80, y,100); 
// Keep these commented out to remove the DP & AP lines
//  DrawText(DPColor,COLOR_WHITE,x+60,y+10,"DP:");
//  DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1); 
//  DrawText(APColor,COLOR_WHITE,x+60,y+20,"AP:");
//  DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+78, y+20,1); 
  pingSerial();

  // Main Relay Box
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox( 14, 95, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 120 );
  pingSerial();
}

void DrawCustomGraph()
{
}

void BuzzerOn()
{
  ReefAngel.PWM.SetActinic((now()%2)*100);
}

The #4 relay is powering the 2 ELM's with Channels 0 and 1 (one ELM each)
The #3 relay is powering the 2 ELM's with Channels 2 and 3 (one ELM each)
The #4 is a moonlight
#5 is off becuase the expansion module can't support enough Amps to the fans.

ReefAngel.StandardLights( Port3,11,5,20,5 );
ReefAngel.StandardLights( Port4,8,5,15,55 );

//ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,14,5,0,100,0) );
//ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,15,35,0,100,0) );
//ReefAngel.PWM.SetChannel( 2, PWMParabola(12,5,17,5,0,100,0) );
//ReefAngel.PWM.SetChannel( 3, PWMParabola(14,5,19,25,0,100,0) );
//ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,23,55,0,100,0) );
//ReefAngel.PWM.SetChannel( 5, PWMParabola(9,3,20,15,50,100,50) );

ReefAngel.PWM.SetChannel( 0, PWMSlope(9,5,14,5,0,100,20,0) );
ReefAngel.PWM.SetChannel( 1, PWMSlope(10,5,13,35,0,100,20,0) );
ReefAngel.PWM.SetChannel( 2, PWMSlope(12,5,17,5,0,100,20,0) );
ReefAngel.PWM.SetChannel( 3, PWMSlope(14,5,19,25,0,100,20,0) );
ReefAngel.PWM.SetChannel( 4, PWMSlope(18,35,23,55,0,100,30,0) );

8.05 AM relay #4 turns ON, 9.05 Channel 0 comes ON
10.05 Channel 1
11.05 relay #3
and so on
At evening the Channels 2 and 3 are ...looks like full light before turns OFF at 20.05 PM

Right now I am sitting in front of the tank, the RA+ LCD shows me
Channel 0=0; measuring 7.7 Volts on the dimming module port
ch1=0; 7.29V
ch2=0; 7.74V
ch3=100; 5.49V
ch4=0; 8.0V
ch5=0; 7.9V
but the LED channels 2 and 3 are ON both, can't say full light but almost
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

18 minutes after midnight, a quick look at the RA+

ch0=0 10.64 Volt on the expansion module port
ch1=0 10.64 V
ch2=0 10.64 V
ch3=00 5.78 V
ch4=000 8.6 V

Is this normal? Also, finding it interesting the number of zeros........
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Main Menu features

Post by lnevo »

Are you sure the time is set properly on your RA?
bigHUN
Posts: 96
Joined: Sat Dec 03, 2011 9:41 pm

Re: Main Menu features

Post by bigHUN »

How you mean "time is set properly"?
AM and PM is right, the RA clock is in sync to PC, what else is there?
Post Reply