If HAVE_POWEROFF_WHILE_CHARGING is not defined and the charging configuration specifi...
authorjethead71 <jethead71@a1c6a512-1295-4272-9138-f99709370657>
Sat, 15 May 2010 15:03:16 +0000 (15 15:03 +0000)
committerjethead71 <jethead71@a1c6a512-1295-4272-9138-f99709370657>
Sat, 15 May 2010 15:03:16 +0000 (15 15:03 +0000)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26055 a1c6a512-1295-4272-9138-f99709370657

apps/misc.c
firmware/drivers/button.c
firmware/powermgmt.c

index 3dfc289..07b4c94 100644 (file)
@@ -264,8 +264,12 @@ 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();
         int audio_stat = audio_status();
@@ -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 */
index f7523d7..100957b 100644 (file)
@@ -205,8 +205,12 @@ 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)
                         {
                             /* Tell the main thread that it's time to
index f1dd83e..bf5734c 100644 (file)
@@ -358,8 +358,12 @@ 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");
                 set_sleep_timer(0);