diff options
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r-- | firmware/powermgmt.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 41bd1c4dec..df796f9140 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -179,8 +179,10 @@ static void power_thread(void) | |||
179 | * 0.0005 V). | 179 | * 0.0005 V). |
180 | */ | 180 | */ |
181 | delta = ( power_history[POWER_HISTORY_LEN-1] * 100 | 181 | delta = ( power_history[POWER_HISTORY_LEN-1] * 100 |
182 | + power_history[POWER_HISTORY_LEN-2] * 100 | ||
183 | - power_history[POWER_HISTORY_LEN-1-CHARGE_END_NEGD+1] * 100 | ||
182 | - power_history[POWER_HISTORY_LEN-1-CHARGE_END_NEGD] * 100 ) | 184 | - power_history[POWER_HISTORY_LEN-1-CHARGE_END_NEGD] * 100 ) |
183 | / CHARGE_END_NEGD; | 185 | / CHARGE_END_NEGD / 2; |
184 | 186 | ||
185 | if (delta < -100) { /* delta < -10 mV */ | 187 | if (delta < -100) { /* delta < -10 mV */ |
186 | DEBUGF("power: short-term negative delta, enough!\n"); | 188 | DEBUGF("power: short-term negative delta, enough!\n"); |
@@ -189,8 +191,10 @@ static void power_thread(void) | |||
189 | } else { | 191 | } else { |
190 | /* if we didn't disable the charger in the previous test, check for low positive delta */ | 192 | /* if we didn't disable the charger in the previous test, check for low positive delta */ |
191 | delta = ( power_history[POWER_HISTORY_LEN-1] * 100 | 193 | delta = ( power_history[POWER_HISTORY_LEN-1] * 100 |
194 | + power_history[POWER_HISTORY_LEN-2] * 100 | ||
195 | - power_history[POWER_HISTORY_LEN-1-CHARGE_END_ZEROD+1] * 100 | ||
192 | - power_history[POWER_HISTORY_LEN-1-CHARGE_END_ZEROD] * 100 ) | 196 | - power_history[POWER_HISTORY_LEN-1-CHARGE_END_ZEROD] * 100 ) |
193 | / CHARGE_END_ZEROD; | 197 | / CHARGE_END_ZEROD / 2; |
194 | 198 | ||
195 | if (delta < 1) { /* delta < 0.1 mV */ | 199 | if (delta < 1) { /* delta < 0.1 mV */ |
196 | DEBUGF("power: long-term small positive delta, enough!\n"); | 200 | DEBUGF("power: long-term small positive delta, enough!\n"); |