forked from len0rd/rockbox
First lame attempt to show correct battery level on the iRiver
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6258 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
09e55a9218
commit
43bf39edb7
6 changed files with 26 additions and 4 deletions
|
@ -825,6 +825,8 @@ bool dbg_ports(void)
|
|||
char buf[128];
|
||||
int button;
|
||||
int line;
|
||||
int battery_voltage;
|
||||
int batt_int, batt_frac;
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
lcd_setmargins(0, 0);
|
||||
|
@ -873,6 +875,14 @@ bool dbg_ports(void)
|
|||
snprintf(buf, sizeof(buf), "ADC_BATTERY: %02x", adc_battery);
|
||||
lcd_puts(0, line++, buf);
|
||||
|
||||
battery_voltage = (adc_battery * BATTERY_SCALE_FACTOR) / 10000;
|
||||
batt_int = battery_voltage / 100;
|
||||
batt_frac = battery_voltage % 100;
|
||||
|
||||
snprintf(buf, 32, "Batt: %d.%02dV %d%% ", batt_int, batt_frac,
|
||||
battery_level());
|
||||
lcd_puts(0, line++, buf);
|
||||
|
||||
lcd_update();
|
||||
button = button_get_w_tmo(HZ/10);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue