summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-03-16 12:06:18 +0000
committerSolomon Peachy <pizza@shaftnet.org>2021-03-23 03:03:57 +0000
commit4d83f7a1926540278240033e4255f2c8bc6aed6a (patch)
treea415c7648efa34c042ea341b3f9b319721d66b6f /firmware
parent1c54c5227b4b8640c979000a340631dbeb190111 (diff)
downloadrockbox-4d83f7a1926540278240033e4255f2c8bc6aed6a.tar.gz
rockbox-4d83f7a1926540278240033e4255f2c8bc6aed6a.zip
Call powermgmt_init_target() before polling the battery
In the old position of the call, the first battery reading would be made before initializing the target's power management code. If the target needs to initialize before giving a battery reading, then the first reading would be wrong and the power thread might inappropriately shut down based on a false zero reading. The new position avoids forcing special-case logic onto the target power management code. Change-Id: I483cfabe30c6881d80a1094fd526fa0065523d19
Diffstat (limited to 'firmware')
-rw-r--r--firmware/powermgmt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 6cac300cdf..3b56242b21 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -705,14 +705,14 @@ static void power_thread(void)
705 power_thread_inputs = power_input_status(); 705 power_thread_inputs = power_input_status();
706#endif 706#endif
707 707
708 /* call target specific init now */
709 powermgmt_init_target();
708 /* initialize voltage averaging (if available) */ 710 /* initialize voltage averaging (if available) */
709 average_init(); 711 average_init();
710 /* get initial battery level value (in %) */ 712 /* get initial battery level value (in %) */
711 init_battery_percent(); 713 init_battery_percent();
712 /* get some initial data for the power curve */ 714 /* get some initial data for the power curve */
713 collect_power_history(); 715 collect_power_history();
714 /* call target specific init now */
715 powermgmt_init_target();
716 716
717 next_power_hist = current_tick + HZ*60; 717 next_power_hist = current_tick + HZ*60;
718 718