[maemo-users] [maemo-users] Check battery level

From: carles.bruguera carles.bruguera at guifi.net
Date: Thu Aug 10 21:09:56 EEST 2006

That's what i was searching.

have you tried to check value just in the moment the visual indicator 
changes from 4 bars to 3, 3 to 2 and so on, to check the teoretical 
75,50, and 25 % ob the battery?

Maybe with a litttle bit of patience i'll do it :)

En/na Matan Ziv-Av ha escrit:

You can read the raw analog battery level by running the attached 
program (value returned in HEX):

./retu-adc 2 3

How to reasonably convert the value to percents is still an open 
question. I use the followin function:

int batt_raw_to_pc( int r) {
    /* Linear, for now */
    if(r>=550) return 100;
    if(r>=500) return (r+450)/10;
    if(r<300) return 0;
    return (r-300)*96/200;

More information about the maemo-users mailing list