Improved reliability of runtime accounting and speaking it.
Change-Id: I6f0fb907e0378487cec387a2cfd3a20b9a596c4e
This commit is contained in:
parent
4c481d2b0e
commit
2d70fdcd8c
3 changed files with 12 additions and 2 deletions
|
@ -295,6 +295,8 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
|
||||||
{
|
{
|
||||||
long msg_id = -1;
|
long msg_id = -1;
|
||||||
|
|
||||||
|
status_save();
|
||||||
|
|
||||||
#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
|
#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
|
||||||
if(!charger_inserted())
|
if(!charger_inserted())
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1008,6 +1008,8 @@ int plugin_load(const char* plugin, const void* parameter)
|
||||||
|
|
||||||
plugin_check_open_close__exit();
|
plugin_check_open_close__exit();
|
||||||
|
|
||||||
|
status_save();
|
||||||
|
|
||||||
if (rc == PLUGIN_ERROR)
|
if (rc == PLUGIN_ERROR)
|
||||||
splash(HZ*2, str(LANG_PLUGIN_ERROR));
|
splash(HZ*2, str(LANG_PLUGIN_ERROR));
|
||||||
|
|
||||||
|
|
|
@ -1018,6 +1018,7 @@ int view_runtime(void)
|
||||||
{
|
{
|
||||||
static const char *lines[]={ID2P(LANG_CLEAR_TIME)};
|
static const char *lines[]={ID2P(LANG_CLEAR_TIME)};
|
||||||
static const struct text_message message={lines, 1};
|
static const struct text_message message={lines, 1};
|
||||||
|
bool say_runtime = true;
|
||||||
|
|
||||||
struct gui_synclist lists;
|
struct gui_synclist lists;
|
||||||
int action;
|
int action;
|
||||||
|
@ -1031,12 +1032,17 @@ int view_runtime(void)
|
||||||
gui_synclist_set_voice_callback(&lists, runtime_speak_data);
|
gui_synclist_set_voice_callback(&lists, runtime_speak_data);
|
||||||
gui_synclist_set_icon_callback(&lists, NULL);
|
gui_synclist_set_icon_callback(&lists, NULL);
|
||||||
gui_synclist_set_nb_items(&lists, 4);
|
gui_synclist_set_nb_items(&lists, 4);
|
||||||
gui_synclist_speak_item(&lists);
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
global_status.runtime += ((current_tick - lasttime) / HZ);
|
global_status.runtime += ((current_tick - lasttime) / HZ);
|
||||||
|
|
||||||
lasttime = current_tick;
|
lasttime = current_tick;
|
||||||
|
if (say_runtime)
|
||||||
|
{
|
||||||
|
gui_synclist_speak_item(&lists);
|
||||||
|
say_runtime = false;
|
||||||
|
}
|
||||||
gui_synclist_draw(&lists);
|
gui_synclist_draw(&lists);
|
||||||
list_do_action(CONTEXT_STD, HZ,
|
list_do_action(CONTEXT_STD, HZ,
|
||||||
&lists, &action, LIST_WRAP_UNLESS_HELD);
|
&lists, &action, LIST_WRAP_UNLESS_HELD);
|
||||||
|
@ -1049,7 +1055,7 @@ int view_runtime(void)
|
||||||
global_status.runtime = 0;
|
global_status.runtime = 0;
|
||||||
else
|
else
|
||||||
global_status.topruntime = 0;
|
global_status.topruntime = 0;
|
||||||
gui_synclist_speak_item(&lists);
|
say_runtime = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(default_event_handler(action) == SYS_USB_CONNECTED)
|
if(default_event_handler(action) == SYS_USB_CONNECTED)
|
||||||
|
|
Loading…
Reference in a new issue