diff options
-rw-r--r-- | firmware/powermgmt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index aa45357c7b..7f89434198 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -101,7 +101,7 @@ static char power_thread_name[] = "power"; | |||
101 | 101 | ||
102 | static int poweroff_timeout = 0; | 102 | static int poweroff_timeout = 0; |
103 | static long last_charge_time = 0; | 103 | static long last_charge_time = 0; |
104 | static int powermgmt_est_runningtime_min = -1; | 104 | int powermgmt_est_runningtime_min = -1; |
105 | 105 | ||
106 | static bool sleeptimer_active = false; | 106 | static bool sleeptimer_active = false; |
107 | static unsigned long sleeptimer_endtick; | 107 | static unsigned long sleeptimer_endtick; |
@@ -164,7 +164,7 @@ int battery_level(void) | |||
164 | #ifdef HAVE_CHARGE_CTRL | 164 | #ifdef HAVE_CHARGE_CTRL |
165 | if (powermgmt_last_cycle_startstop_min < 20) { | 165 | if (powermgmt_last_cycle_startstop_min < 20) { |
166 | /* the batteries are lazy, so take a value between the result of the two table lookups */ | 166 | /* the batteries are lazy, so take a value between the result of the two table lookups */ |
167 | if (charger_enabled) | 167 | if (charge_state == 1) |
168 | level = (voltage_to_percent(level, percent_to_volt_charge) | 168 | level = (voltage_to_percent(level, percent_to_volt_charge) |
169 | * battery_lazyness[powermgmt_last_cycle_startstop_min] | 169 | * battery_lazyness[powermgmt_last_cycle_startstop_min] |
170 | + voltage_to_percent(level, percent_to_volt_nocharge) | 170 | + voltage_to_percent(level, percent_to_volt_nocharge) |
@@ -175,7 +175,7 @@ int battery_level(void) | |||
175 | + voltage_to_percent(level, percent_to_volt_charge) | 175 | + voltage_to_percent(level, percent_to_volt_charge) |
176 | * (100 - battery_lazyness[powermgmt_last_cycle_startstop_min])) / 100; | 176 | * (100 - battery_lazyness[powermgmt_last_cycle_startstop_min])) / 100; |
177 | } else { | 177 | } else { |
178 | if (charger_enabled) | 178 | if (charge_state == 1) |
179 | level = voltage_to_percent(level, percent_to_volt_charge); | 179 | level = voltage_to_percent(level, percent_to_volt_charge); |
180 | else | 180 | else |
181 | level = voltage_to_percent(level, percent_to_volt_nocharge); | 181 | level = voltage_to_percent(level, percent_to_volt_nocharge); |
@@ -340,7 +340,7 @@ static void power_thread(void) | |||
340 | /* charging: remaining charging time */ | 340 | /* charging: remaining charging time */ |
341 | 341 | ||
342 | #ifdef HAVE_CHARGE_CTRL | 342 | #ifdef HAVE_CHARGE_CTRL |
343 | if (charger_enabled) | 343 | if (charge_state == 1) |
344 | /* if taking the nocharge battery level, charging lasts 30% longer than the value says */ | 344 | /* if taking the nocharge battery level, charging lasts 30% longer than the value says */ |
345 | /* so consider it because there's the battery lazyness inside the the battery_level */ | 345 | /* so consider it because there's the battery lazyness inside the the battery_level */ |
346 | if (powermgmt_last_cycle_startstop_min < 20) { | 346 | if (powermgmt_last_cycle_startstop_min < 20) { |