Fix System/Running Time to reset the running time whenever a charger or USB cable is inserted, not just when the cable is inserted in the running time screen. Should now make the running time actually be the amount of time rockbox has run since the battery was last charged, which is as far as I can tell the original idea behind the runtime menu.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24954 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ea4eadc582
commit
1fefb48e87
3 changed files with 9 additions and 10 deletions
|
@ -91,6 +91,10 @@ static int handle_usb_events(void)
|
||||||
case SYS_USB_DISCONNECTED:
|
case SYS_USB_DISCONNECTED:
|
||||||
usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
|
usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
|
||||||
return 1;
|
return 1;
|
||||||
|
case SYS_CHARGER_DISCONNECTED:
|
||||||
|
/*reset rockbox battery runtime*/
|
||||||
|
global_status.runtime = 0;
|
||||||
|
break;
|
||||||
case SYS_TIMEOUT:
|
case SYS_TIMEOUT:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -590,6 +590,7 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
|
||||||
system_restore();
|
system_restore();
|
||||||
}
|
}
|
||||||
return SYS_USB_CONNECTED;
|
return SYS_USB_CONNECTED;
|
||||||
|
|
||||||
case SYS_POWEROFF:
|
case SYS_POWEROFF:
|
||||||
if (!clean_shutdown(callback, parameter))
|
if (!clean_shutdown(callback, parameter))
|
||||||
return SYS_POWEROFF;
|
return SYS_POWEROFF;
|
||||||
|
@ -601,6 +602,8 @@ long default_event_handler_ex(long event, void (*callback)(void *), void *parame
|
||||||
|
|
||||||
case SYS_CHARGER_DISCONNECTED:
|
case SYS_CHARGER_DISCONNECTED:
|
||||||
car_adapter_mode_processing(false);
|
car_adapter_mode_processing(false);
|
||||||
|
/*reset rockbox battery runtime*/
|
||||||
|
global_status.runtime = 0;
|
||||||
return SYS_CHARGER_DISCONNECTED;
|
return SYS_CHARGER_DISCONNECTED;
|
||||||
|
|
||||||
case SYS_CAR_ADAPTER_RESUME:
|
case SYS_CAR_ADAPTER_RESUME:
|
||||||
|
|
|
@ -825,16 +825,8 @@ bool view_runtime(void)
|
||||||
gui_synclist_speak_item(&lists);
|
gui_synclist_speak_item(&lists);
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
#if CONFIG_CHARGING
|
global_status.runtime += ((current_tick - lasttime) / HZ);
|
||||||
if (charger_inserted())
|
|
||||||
{
|
|
||||||
global_status.runtime = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
global_status.runtime += ((current_tick - lasttime) / HZ);
|
|
||||||
}
|
|
||||||
lasttime = current_tick;
|
lasttime = current_tick;
|
||||||
gui_synclist_draw(&lists);
|
gui_synclist_draw(&lists);
|
||||||
list_do_action(CONTEXT_STD, HZ,
|
list_do_action(CONTEXT_STD, HZ,
|
||||||
|
|
Loading…
Reference in a new issue