From 1651254ba4db1d949bb2d58dd742a846b1e910b1 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 29 Oct 2023 11:12:12 +0000 Subject: 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 --- firmware/powermgmt.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'firmware/powermgmt.c') 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) /* switch off unit if battery level is too low for reliable operation */ bool query_force_shutdown(void) { +#if CONFIG_CHARGING + /* It doesn't make sense to force shutdown when externally powered. */ + if (power_input_present()) + return false; +#endif + #if defined(NO_LOW_BATTERY_SHUTDOWN) return false; #elif CONFIG_BATTERY_MEASURE & PERCENTAGE_MEASURE -- cgit v1.2.3