Page 1 of 1
menu question
Posted: Wed Jan 30, 2013 8:42 pm
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
Re: menu question
Posted: Wed Jan 30, 2013 9:25 pm
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.
Re: menu question
Posted: Thu Jan 31, 2013 6:13 am
by rossbryant1956
thx all
Re: menu question
Posted: Sat Feb 02, 2013 9:25 am
by jsclownfish
Why aren't you using the DrawSingleMonitor function for the temperature?
-Jon
Re: menu question
Posted: Sat Feb 02, 2013 9:39 am
by DrewPalmer04

I was wondering too lol
Re: menu question
Posted: Sat Feb 02, 2013 5:21 pm
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