1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Uwe Freese 2002-12-14 21:01:32 +00:00
parent 48e8e98efa
commit 0f30f66c6c
2 changed files with 7 additions and 5 deletions

View file

@ -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);

View file

@ -39,7 +39,8 @@
#ifdef HAVE_CHARGE_CTRL
#define POWER_MESSAGE_LEN 32 /* power thread status message */
#define CHARGE_MAX_TIME 8*60 /* minutes: maximum charging time */
#define CHARGE_MAX_TIME_1500 450 /* minutes: maximum charging time for 1500 mAh batteries */
/* actual max time depends also on BATTERY_CAPACITY! */
#define CHARGE_MIN_TIME 10 /* minutes: minimum charging time */
#define CHARGE_RESTART_HI 85 /* %: when to restart charging in 'charge' mode */
/* attention: if set too high, normal charging is started in trickle mode */