menu question

Do you have a question on how to do something.
Ask in here.
Post Reply
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

menu question

Post by rossbryant1956 »

I am learning menus and need to understand how to place decimal in the following code line:

Code: Select all

// pH Expansion
  ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,15,75, "GT pH:" );
  ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,39,75, ReefAngel.Params.PHExp );
  pingSerial();
It is displaying:

GT pH: 805

Needs to be:

8.05

Thx
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: menu question

Post by binder »

You must use the ConvertNumToString function to accomplish this task. Check out the tutorial here:http://forum.reefangel.com/viewtopic.php?f=14&t=109
That will explain it (or show an example of it) on page 18.

Here is your example:

Code: Select all

// pH Expansion
ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,15,75, "GT pH:" );
char text[7];
ConvertNumToString(text, ReefAngel.Params.PHExp, 100);
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN, DefaultBGColor, 39, 75, text);
The function ConvertNumToString will format the value with the appropriate decimal place.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: menu question

Post by rossbryant1956 »

thx all
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
User avatar
jsclownfish
Posts: 375
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Re: menu question

Post by jsclownfish »

Why aren't you using the DrawSingleMonitor function for the temperature?

-Jon
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: menu question

Post by DrewPalmer04 »

:) I was wondering too lol
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: menu question

Post by rossbryant1956 »

actually I was just showing the board the snippet I was having a problem with. I am using this snippet for my top menus's and I don't like it:

Code: Select all

int x,y;
  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 40, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 40, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();
I will be switching over to DrawSingleMonitor function in the next day or so. Thx
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
Post Reply