If HAVE_POWEROFF_WHILE_CHARGING is not defined and the charging configuration specifies CHARGING_MONITOR or greater, allow poweroff while plugged but not actually charging the battery.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26055 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2010-05-15 15:03:16 +00:00
parent e34c0593e7
commit 414dad42c5
3 changed files with 17 additions and 1 deletions

View File

@ -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 */

View File

@ -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)
{

View File

@ -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");