 release dev builds extras themes manual wiki device status forums mailing lists IRC bugs patches dev guide

# Rockbox mail archive

Subject: Question to powermgm.c charging algorithm

# Question to powermgm.c charging algorithm

From: Uwe Freese <mail_at_uwe-freese.de>
Date: Thu, 8 Aug 2002 12:38:51 +0200

Hello,

First: What do you call negative and positive delta? It seems that

positive delta = voltage is going down
negative delta = voltage is going up

Now a question to the code:

------snip------
if (delta < -50) { /* delta < -0.3 V */
DEBUGF("power: short-term negative delta, enough!\n");
charger_enable(false);
snprintf(power_message, POWER_MESSAGE_LEN, "end negd %d %dmin", delta, charged_time);
} else {
/* if we didn't disable the charger in the previous test, check for low positive delta */
delta = 0;
for (i = 0; i < CHARGE_END_ZEROD; i++)
delta += power_history[POWER_HISTORY_LEN-1-i]*100 - power_history[POWER_HISTORY_LEN-1-i-1]*100;
delta = delta / CHARGE_END_ZEROD;

if (delta <= 5) { /* delta of <= 0.005 V */
DEBUGF("power: long-term small positive delta, enough!\n");
charger_enable(false);
snprintf(power_message, POWER_MESSAGE_LEN, "end lowd %d %dmin", delta, charged_time);
}
}
------snip------

why is the second test (delta <= 5) ? Shouldn't it be (delta >= 5), that
means "turn off charging if the voltage went down at least by
0.005" Volts?

Does the first check (delta < -50) mean that charging stops if the
voltage went up very quickly?

Bye, Uwe.