summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2023-10-29 11:12:12 +0000
committerAidan MacDonald <amachronic@protonmail.com>2023-10-29 11:22:01 +0000
commit1651254ba4db1d949bb2d58dd742a846b1e910b1 (patch)
treeff67e0dd4ee5587b7a6d10decb5e89f9e6698503
parent954dd0ff758b7ec95e387cca9124529c63339791 (diff)
downloadrockbox-1651254ba4db1d949bb2d58dd742a846b1e910b1.tar.gz
rockbox-1651254ba4db1d949bb2d58dd742a846b1e910b1.zip
powermgmt: Don't force shutdown when externally powered
In rare cases, battery voltage at boot can be below the shutdown threshold even if a charger is plugged in. This triggers a forced shutdown and tells you to "RECHARGE!" despite there being plenty of power available, which is annoying. Tweak the forced shutdown check so it accounts for external power sources; if any are present, battery voltage will be ignored. Change-Id: Id6280b0b666df9eef31c37a03c07c9d6d3f50221
-rw-r--r--firmware/powermgmt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index e455127496..95763dc950 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -500,6 +500,12 @@ static void power_thread_rtc_process(void)
500/* switch off unit if battery level is too low for reliable operation */ 500/* switch off unit if battery level is too low for reliable operation */
501bool query_force_shutdown(void) 501bool query_force_shutdown(void)
502{ 502{
503#if CONFIG_CHARGING
504 /* It doesn't make sense to force shutdown when externally powered. */
505 if (power_input_present())
506 return false;
507#endif
508
503#if defined(NO_LOW_BATTERY_SHUTDOWN) 509#if defined(NO_LOW_BATTERY_SHUTDOWN)
504 return false; 510 return false;
505#elif CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE 511#elif CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE