battery_level() would sometimes return wrong value
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1375 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ad7de31660
commit
208cb91192
1 changed files with 3 additions and 3 deletions
|
@ -38,14 +38,14 @@ int battery_level(void)
|
|||
{
|
||||
int level;
|
||||
|
||||
level = adc_read(ADC_UNREG_POWER) - BATTERY_LEVEL_SHUTDOWN;
|
||||
level = adc_read(ADC_UNREG_POWER);
|
||||
if(level < 0)
|
||||
level = 0;
|
||||
|
||||
if(level > BATTERY_LEVEL_FULL)
|
||||
level = BATTERY_LEVEL_FULL;
|
||||
|
||||
return (level * 100) / BATTERY_RANGE;
|
||||
|
||||
return ((level-BATTERY_LEVEL_SHUTDOWN) * 100) / BATTERY_RANGE;
|
||||
}
|
||||
|
||||
void charger_enable(bool on)
|
||||
|
|
Loading…
Reference in a new issue