summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/misc.c10
-rw-r--r--firmware/drivers/button.c4
-rw-r--r--firmware/powermgmt.c4
3 files changed, 17 insertions, 1 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 3dfc2892ca..07b4c947a2 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -264,8 +264,12 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
264 scrobbler_poweroff(); 264 scrobbler_poweroff();
265 265
266#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) 266#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
267#if CONFIG_CHARGING >= CHARGING_MONITOR
268 if(!charging_state())
269#else
267 if(!charger_inserted()) 270 if(!charger_inserted())
268#endif 271#endif
272#endif
269 { 273 {
270 bool batt_safe = battery_level_safe(); 274 bool batt_safe = battery_level_safe();
271 int audio_stat = audio_status(); 275 int audio_stat = audio_status();
@@ -406,7 +410,11 @@ bool list_stop_handler(void)
406 410
407 if (TIME_BEFORE(current_tick, last_off + HZ/2)) 411 if (TIME_BEFORE(current_tick, last_off + HZ/2))
408 { 412 {
409 if (charger_inserted()) 413#if CONFIG_CHARGING >= CHARGING_MONITOR
414 if (charging_state())
415#else
416 if (charger_inserted())
417#endif
410 { 418 {
411 charging_splash(); 419 charging_splash();
412 ret = true; /* screen is dirty, caller needs to refresh */ 420 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,8 +205,12 @@ static void button_tick(void)
205#endif 205#endif
206 ) && 206 ) &&
207#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) 207#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
208#if CONFIG_CHARGING >= CHARGING_MONITOR
209 !charging_state() &&
210#else
208 !charger_inserted() && 211 !charger_inserted() &&
209#endif 212#endif
213#endif
210 repeat_count > POWEROFF_COUNT) 214 repeat_count > POWEROFF_COUNT)
211 { 215 {
212 /* Tell the main thread that it's time to 216 /* Tell the main thread that it's time to
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index f1dd83ef52..bf5734c264 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -358,8 +358,12 @@ static void handle_auto_poweroff(void)
358 358
359 if (usb_inserted() 359 if (usb_inserted()
360#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) 360#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
361#if CONFIG_CHARGING >= CHARGING_MONITOR
362 || charging_state()
363#else
361 || charger_input_state != NO_CHARGER 364 || charger_input_state != NO_CHARGER
362#endif 365#endif
366#endif
363 ) { 367 ) {
364 DEBUGF("Sleep timer timeout. Stopping...\n"); 368 DEBUGF("Sleep timer timeout. Stopping...\n");
365 set_sleep_timer(0); 369 set_sleep_timer(0);