diff --git a/apps/misc.c b/apps/misc.c index 3dfc2892ca..07b4c947a2 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -264,7 +264,11 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) scrobbler_poweroff(); #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) +#if CONFIG_CHARGING >= CHARGING_MONITOR + if(!charging_state()) +#else if(!charger_inserted()) +#endif #endif { bool batt_safe = battery_level_safe(); @@ -406,7 +410,11 @@ bool list_stop_handler(void) if (TIME_BEFORE(current_tick, last_off + HZ/2)) { - if (charger_inserted()) +#if CONFIG_CHARGING >= CHARGING_MONITOR + if (charging_state()) +#else + if (charger_inserted()) +#endif { charging_splash(); ret = true; /* screen is dirty, caller needs to refresh */ diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index f7523d776c..100957b77a 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -205,7 +205,11 @@ static void button_tick(void) #endif ) && #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) +#if CONFIG_CHARGING >= CHARGING_MONITOR + !charging_state() && +#else !charger_inserted() && +#endif #endif repeat_count > POWEROFF_COUNT) { diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index f1dd83ef52..bf5734c264 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -358,7 +358,11 @@ static void handle_auto_poweroff(void) if (usb_inserted() #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) +#if CONFIG_CHARGING >= CHARGING_MONITOR + || charging_state() +#else || charger_input_state != NO_CHARGER +#endif #endif ) { DEBUGF("Sleep timer timeout. Stopping...\n");