summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2019-08-05 22:05:32 -0400
committerSolomon Peachy <pizza@shaftnet.org>2019-08-06 04:47:20 +0200
commit2d70fdcd8c6f4fc30c06d07299d6b499389456b8 (patch)
treeaa16de91240b5568dd9395410873ea371f182e2e
parent4c481d2b0e8443ff5ae2cbb62a3b3065c0c0106a (diff)
downloadrockbox-2d70fdcd8c6f4fc30c06d07299d6b499389456b8.tar.gz
rockbox-2d70fdcd8c6f4fc30c06d07299d6b499389456b8.tar.bz2
rockbox-2d70fdcd8c6f4fc30c06d07299d6b499389456b8.zip
Improved reliability of runtime accounting and speaking it.
Change-Id: I6f0fb907e0378487cec387a2cfd3a20b9a596c4e
-rw-r--r--apps/misc.c2
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/screens.c10
3 files changed, 12 insertions, 2 deletions
diff --git a/apps/misc.c b/apps/misc.c
index b9d6bfb1d9..501237e616 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -295,6 +295,8 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
{
long msg_id = -1;
+ status_save();
+
#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
if(!charger_inserted())
#endif
diff --git a/apps/plugin.c b/apps/plugin.c
index 3c957b40c8..1506554790 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -1008,6 +1008,8 @@ int plugin_load(const char* plugin, const void* parameter)
plugin_check_open_close__exit();
+ status_save();
+
if (rc == PLUGIN_ERROR)
splash(HZ*2, str(LANG_PLUGIN_ERROR));
diff --git a/apps/screens.c b/apps/screens.c
index 9cb5ebe258..e7262704f0 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -1018,6 +1018,7 @@ int view_runtime(void)
{
static const char *lines[]={ID2P(LANG_CLEAR_TIME)};
static const struct text_message message={lines, 1};
+ bool say_runtime = true;
struct gui_synclist lists;
int action;
@@ -1031,12 +1032,17 @@ int view_runtime(void)
gui_synclist_set_voice_callback(&lists, runtime_speak_data);
gui_synclist_set_icon_callback(&lists, NULL);
gui_synclist_set_nb_items(&lists, 4);
- gui_synclist_speak_item(&lists);
+
while(1)
{
global_status.runtime += ((current_tick - lasttime) / HZ);
lasttime = current_tick;
+ if (say_runtime)
+ {
+ gui_synclist_speak_item(&lists);
+ say_runtime = false;
+ }
gui_synclist_draw(&lists);
list_do_action(CONTEXT_STD, HZ,
&lists, &action, LIST_WRAP_UNLESS_HELD);
@@ -1049,7 +1055,7 @@ int view_runtime(void)
global_status.runtime = 0;
else
global_status.topruntime = 0;
- gui_synclist_speak_item(&lists);
+ say_runtime = true;
}
}
if(default_event_handler(action) == SYS_USB_CONNECTED)