HP Forums
My analysis of the battery icon is done....results - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: My analysis of the battery icon is done....results (/thread-8610.html)



My analysis of the battery icon is done....results - webmasterpdx - 07-01-2017 07:09 PM

Here is the table of results. I've changed the output of the routine to output what the HP guys say is the output of the hardware. Note that when it reaches zero, it'll work for a while before popping up a critical low battery message (there are 2 different messages depending on what you are doing, but they are in english and are self explanatary). Note that the color is the color of the on pixels indicating charge level. When empty (zero), the color is white, and that is what is indicated in the table. The Y values are the highest pixel vertically on. Pixels are the number of pixels on for that status.

Code:
V   Y  Pixels  HP   C
100 04 11     100 #008400h Bright Green
 75 07 08      75 #008400h Bright Green
 50 09 06      50 #008400h Bright Green
 25 12 03      25 #EFCE29h Yellow
 00 15 00      00 #D6DEDE White

Here is the new utility to read the icon and return the percentage battery full. Note that I'm using <> for the not equal symbol (isn't on my laptop keyboard).

Code:
// Battery test
EXPORT BATVAL()
BEGIN
 LOCAL x:=315,y:=14,c,d;
 d:=GETPIX_P(x,y);
 IF d==#D6DEDEh THEN RETURN 0; END;
 FOR y FROM 13 DOWNTO 3 STEP 1 DO
  c:=GETPIX_P(x,y);
  IF c<>d THEN // color change
   CASE
    IF y==3 THEN RETURN 100; END;                                                                                                                                                                                                                                        
    IF y==6 THEN RETURN 75; END;
    IF y==8 THEN RETURN 50; END;
    DEFAULT RETURN 25;
   END; // CASE...
  END; // IF c<>d...
  d:=c;
 END; // FOR y.....
END; // BEGIN....



RE: My analysis of the battery icon is done....results - webmasterpdx - 07-03-2017 05:32 AM

I optimized the code.....

Code:
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...



RE: My analysis of the battery icon is done....results - DrD - 07-03-2017 10:44 AM

Tap (or click) near the battery icon and a pop up provides more detail, including percent level. Mode info is also provided, which can be changed there.

-Dale-


RE: My analysis of the battery icon is done....results - webmasterpdx - 07-03-2017 05:33 PM

the idea is to determine battery level from a program....