Author Topic: Is it possible to programmatically get the HP Prime's battery level or voltage?  (Read 11226 times)

0 Members and 1 Guest are viewing this topic.

Offline bwDraco

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
    • House of DragonLord
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
HP Prime | HP 50g | TI-84 Plus
A programmer at heart.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
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.

Offline timwessman

  • LV3 Member (Next: 100)
  • ***
  • Posts: 94
  • Rating: +32/-0
    • View Profile
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.

TW

Although I work for the HP calculator group, the comments and opinions I post here are my own.

Offline bwDraco

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
    • House of DragonLord
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
HP Prime | HP 50g | TI-84 Plus
A programmer at heart.

Offline TravisE

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 182
  • Rating: +33/-0
    • View Profile
    • ticalc.org
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. :)
ticalc.org staff member—http://www.ticalc.org/

Offline timwessman

  • LV3 Member (Next: 100)
  • ***
  • Posts: 94
  • Rating: +32/-0
    • View Profile
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.
TW

Although I work for the HP calculator group, the comments and opinions I post here are my own.

Offline webmasterpdx

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +0/-0
    • View Profile
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