Omnimaga

Calculator Community => HP Calculators => Topic started by: bwDraco on February 16, 2015, 10:37:45 pm

Title: Is it possible to programmatically get the HP Prime's battery level or voltage?
Post by: bwDraco on February 16, 2015, 10:37:45 pm
The HP Prime is capable of precisely measuring the battery voltage, evident in the diagnostic mode (hold F C O keys while pressing the Reset button). However, the displayed battery meter only specifies battery level in 25% steps.

Is there some function or other means by which I can get the precise battery level or voltage without having to go into the diagnostic mode? Any help would be appreciated.

—DragonLord
Title: Re: Is it possible to programmatically get the HP Prime's battery level or voltage?
Post by: TIfanx1999 on February 17, 2015, 12:09:22 am
I'm not sure. Not many of us here have the Prime unfortunately (I can only think of myself and DJ_Omnimaga), and I've barely touched mine to be honest. However, Tim Wessman: https://www.omnimaga.org/profile/timwessman/ should know. He's actually an HP employee that works on the Prime.
Title: Re: Is it possible to programmatically get the HP Prime's battery level or voltage?
Post by: timwessman on February 18, 2015, 12:08:18 pm
You rang?

No, it isn't possible. In fact, the "voltage" displayed in the diagnostic menu is just the same steps roughly translated over. The battery charging/detection hardware doesn't have fine control of the levels exposed anywhere that the OS could tap into.

The steps roughly correspond to High, medium, low, empty, "I'm about to shut off", "I'm shutting off". Sometimes the time between 5-6 can be a few seconds, but most of the time it is shorter. The time between 4-5 can be minutes, or seconds. It is not very precise at the low levels.

Title: Re: Is it possible to programmatically get the HP Prime's battery level or voltage?
Post by: bwDraco on February 18, 2015, 02:51:32 pm
No, it isn't possible. In fact, the "voltage" displayed in the diagnostic menu is just the same steps roughly translated over. The battery charging/detection hardware doesn't have fine control of the levels exposed anywhere that the OS could tap into.

Oh well... I remember using a third-party library on my HP 50g which provided the precise battery level and voltage.

—DragonLord
Title: Re: Is it possible to programmatically get the HP Prime's battery level or voltage?
Post by: TravisE on February 19, 2015, 09:54:25 pm
Oh well... I remember using a third-party library on my HP 50g which provided the precise battery level and voltage.

I still use that. I would measure the voltage over time and make an equation that roughly estimates % state of charge based on voltage for a particular brand of NiMH cell. Not the most accurate thing (especially since the voltage fluctuates with load) but still useful. The thing that sucks about the library is that it usually fails to update without a power cycle. I never could figure out why.

This thread is interesting since I always thought Li-Ion systems usually had precise monitoring. I guess there are exceptions. :)
Title: Re: Is it possible to programmatically get the HP Prime's battery level or voltage?
Post by: timwessman on February 27, 2015, 02:48:32 pm
The charging part does have to have tight control over how much current to be drawing internally, however that does not necessarily mean that information is exposed outside the charge controller in a more granular way.
Title: Re: Is it possible to programmatically get the HP Prime's battery level or voltage?
Post by: webmasterpdx on September 03, 2017, 07:20:42 pm
I wrote a program that gets it from the graphical representation on the screen in 25% increments. Here is the source code...

Code: [Select]
EXPORT BATVAL() // Battery test
BEGIN
LOCAL x:=315,d:=#D6DEDEh;
CASE
IF GETPIX_P(x,14)==d THEN RETURN 0; END;
IF GETPIX_P(x,11)==d THEN RETURN 25; END;
IF GETPIX_P(x,8)==d THEN RETURN 50; END;
IF GETPIX_P(x,6)==d THEN RETURN 75; END;
DEFAULT RETURN 100;
END; // CASE...
END; // BEGIN