> -----Original Message-----
> From: Denny W. Jones [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, March 31, 1999 10:49 AM
> To: [EMAIL PROTECTED]
> Subject: Looking for Graphical Battery Code
>
>
> Does anybody have any source code they can share to display
> the battery
> level graphically? Like in the "App" menu header area?
>
> TIA,
> Denny
>
> **********
> Denny W. Jones
> Lighthouse Technologies
> http://www.lhtech-inc.com
> **********
>
>From three weeks ago:
-----Original Message-----
From: Daniel McCarty [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 05, 1999 2:10 PM
To: [EMAIL PROTECTED]
Subject: Re: Problems with getting accurate battery readings.
[EMAIL PROTECTED] wrote:
>
> I recieved some code a while back on how to do this but after modifying it
to
> run on the palm pro (the sysBatteryInfo call is different) I get the
> percentage but the guage is no longer correct. I am assuming that the new
call
> for Palm 3 must return something other that battery volts (mine is based a
a 3
> volt battery which I also need a better way of doing this too). Can
somebody
> help?
I use the following code to display a battery in any version of the
OS, including PalmV's LiIon batteries:
void GetVoltage(UIntPtr voltage, BytePtr percent) {
UInt warning;
DWord romVersion;
// we have to correctly calculate the current voltage on a PalmPilot,
// PalmIII, PalmIIIx and PalmV...and in the future, PalmVII.
FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
if (sysGetROMVerMajor(romVersion) < 3) {
*voltage = SysBatteryInfoV20(false, /*set*/
&warning,
NULL, /*criticalThresholdP*/
NULL, /*maxTicksP*/
NULL, /*kindP*/
NULL /*pluggedIn*/);
// calculate the current percentage using pseudo-floats
// instead of doubles and their corresponding 3.5k FPL
*percent = (*voltage - warning) * 100 / (MaxVoltage - warning);
} else
*voltage = SysBatteryInfo(false, /*set*/
NULL, /*warnThresholdP*/
NULL, /*criticalThresholdP*/
NULL, /*maxTicksP*/
NULL, /*kindP*/
NULL, /*pluggedIn*/
percent);
}
(MaxVoltage is define'd as 300.)
Hope this helps,
Daniel.