summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/powermgmt.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 041fed0361..5f488810ac 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -282,17 +282,14 @@ static void battery_status_update(void)
else
#endif
/* discharging: remaining running time */
- if ((battery_millivolts + 20) > percent_to_volt_discharge[0][0]) {
+ if (battery_millivolts > percent_to_volt_discharge[0][0]) {
+ /* linear extrapolation */
powermgmt_est_runningtime_min = (level + battery_percent)*60
* battery_capacity / 200 / runcurrent();
}
- else if (battery_millivolts <= battery_level_shutoff[0]) {
+ if (0 > powermgmt_est_runningtime_min) {
powermgmt_est_runningtime_min = 0;
}
- else {
- powermgmt_est_runningtime_min =
- (battery_millivolts - battery_level_shutoff[0]) / 2;
- }
battery_percent = level;
send_battery_level_event();