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