diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-22 15:33:14 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2002-07-22 15:33:14 +0000 |
commit | 703704d4f657db7820e4a6c9d40a22089a4b1f08 (patch) | |
tree | fa6883102469f791b9bd27f0028218d3bea06f05 /firmware/drivers | |
parent | facc2cd663f3b729e52a4b6dba6f5f2cf35c046f (diff) |
Slightly different battery level range
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1396 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/power.c | 5 | ||||
-rw-r--r-- | firmware/drivers/power.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index 5de53b296f..85f1393719 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c @@ -45,7 +45,10 @@ int battery_level(void) if(level > BATTERY_LEVEL_FULL) level = BATTERY_LEVEL_FULL; - return ((level-BATTERY_LEVEL_SHUTDOWN) * 100) / BATTERY_RANGE; + if(level < BATTERY_LEVEL_DANGEROUS) + level = BATTERY_LEVEL_DANGEROUS; + + return ((level-BATTERY_LEVEL_DANGEROUS) * 100) / BATTERY_RANGE; } void charger_enable(bool on) diff --git a/firmware/drivers/power.h b/firmware/drivers/power.h index 4b08648112..9ad657c536 100644 --- a/firmware/drivers/power.h +++ b/firmware/drivers/power.h @@ -23,7 +23,7 @@ #define BATTERY_LEVEL_DANGEROUS (4750000 / BATTERY_SCALE_FACTOR) /* 4.75V */ #define BATTERY_LEVEL_FULL (5300000 / BATTERY_SCALE_FACTOR) /* 5.3V */ -#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_SHUTDOWN) +#define BATTERY_RANGE (BATTERY_LEVEL_FULL - BATTERY_LEVEL_DANGEROUS) bool charger_inserted(void); void charger_enable(bool on); |