summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.c
diff options
context:
space:
mode:
authorUwe Freese <thebreaker@rockbox.org>2002-12-14 21:01:32 +0000
committerUwe Freese <thebreaker@rockbox.org>2002-12-14 21:01:32 +0000
commit0f30f66c6c575d9a3aa8bd4fa2fe6607db7b2076 (patch)
treebf116ba56b50159b8a87abaf00c90237613f7ce7 /firmware/powermgmt.c
parent48e8e98efa4cb30a72ee4f8ef7be17e372db84b7 (diff)
max charge duration now depends on batt. capacity and is a little longer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2992 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r--firmware/powermgmt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index bcf0659585..62bc5d3814 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -466,10 +466,11 @@ static void power_thread(void)
snprintf(power_message, POWER_MESSAGE_LEN, "chg pause %d min", charge_pause);
} else {
/* calculate max charge time depending on current battery level */
- /* take 20% more because battery level is not linear */
- charge_max_time_now = CHARGE_MAX_TIME * (100 + 30 - battery_level()) / 100;
- if (charge_max_time_now > CHARGE_MAX_TIME) {
- charge_max_time_now = CHARGE_MAX_TIME;
+ /* take 35% more because battery level is not linear */
+ i = CHARGE_MAX_TIME_1500 * BATTERY_CAPACITY / 1500;
+ charge_max_time_now = i * (100 + 35 - battery_level()) / 100;
+ if (charge_max_time_now > i) {
+ charge_max_time_now = i;
}
snprintf(power_message, POWER_MESSAGE_LEN, "ChgAt %d%% max %dm", battery_level(), charge_max_time_now);