1
0
Fork 0
forked from len0rd/rockbox

pwrmgmt: sleep timer: don't shut down while charging

This mirrors the behavior of idle poweroff,
which inhibits shutdown as long as a charger
is plugged in, even if a device is capable
of powering off while charging.

Since usb_inserted() already checks for USB_POWERED,
certain devices with the ability to power off while
charging, already exhibit this behavior when using
the sleep timer anyway.

Change-Id: I35ed4b542a8a4df06a34395c85f4d37fc1d2ce53
This commit is contained in:
Christian Soffke 2025-03-14 11:24:51 +01:00
parent df7d68a6e2
commit 9d82db1146

View file

@ -1184,7 +1184,7 @@ static void handle_sleep_timer(void)
{ {
if (TIME_AFTER(current_tick, sleeptimer_endtick)) { if (TIME_AFTER(current_tick, sleeptimer_endtick)) {
if (usb_inserted() if (usb_inserted()
#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) #if CONFIG_CHARGING
|| charger_input_state != NO_CHARGER || charger_input_state != NO_CHARGER
#endif #endif
) { ) {