summaryrefslogtreecommitdiff
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.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)
295{ 295{
296 long msg_id = -1; 296 long msg_id = -1;
297 297
298 status_save();
299
298#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) 300#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)
299 if(!charger_inserted()) 301 if(!charger_inserted())
300#endif 302#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)
1008 1008
1009 plugin_check_open_close__exit(); 1009 plugin_check_open_close__exit();
1010 1010
1011 status_save();
1012
1011 if (rc == PLUGIN_ERROR) 1013 if (rc == PLUGIN_ERROR)
1012 splash(HZ*2, str(LANG_PLUGIN_ERROR)); 1014 splash(HZ*2, str(LANG_PLUGIN_ERROR));
1013 1015
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)
1018{ 1018{
1019 static const char *lines[]={ID2P(LANG_CLEAR_TIME)}; 1019 static const char *lines[]={ID2P(LANG_CLEAR_TIME)};
1020 static const struct text_message message={lines, 1}; 1020 static const struct text_message message={lines, 1};
1021 bool say_runtime = true;
1021 1022
1022 struct gui_synclist lists; 1023 struct gui_synclist lists;
1023 int action; 1024 int action;
@@ -1031,12 +1032,17 @@ int view_runtime(void)
1031 gui_synclist_set_voice_callback(&lists, runtime_speak_data); 1032 gui_synclist_set_voice_callback(&lists, runtime_speak_data);
1032 gui_synclist_set_icon_callback(&lists, NULL); 1033 gui_synclist_set_icon_callback(&lists, NULL);
1033 gui_synclist_set_nb_items(&lists, 4); 1034 gui_synclist_set_nb_items(&lists, 4);
1034 gui_synclist_speak_item(&lists); 1035
1035 while(1) 1036 while(1)
1036 { 1037 {
1037 global_status.runtime += ((current_tick - lasttime) / HZ); 1038 global_status.runtime += ((current_tick - lasttime) / HZ);
1038 1039
1039 lasttime = current_tick; 1040 lasttime = current_tick;
1041 if (say_runtime)
1042 {
1043 gui_synclist_speak_item(&lists);
1044 say_runtime = false;
1045 }
1040 gui_synclist_draw(&lists); 1046 gui_synclist_draw(&lists);
1041 list_do_action(CONTEXT_STD, HZ, 1047 list_do_action(CONTEXT_STD, HZ,
1042 &lists, &action, LIST_WRAP_UNLESS_HELD); 1048 &lists, &action, LIST_WRAP_UNLESS_HELD);
@@ -1049,7 +1055,7 @@ int view_runtime(void)
1049 global_status.runtime = 0; 1055 global_status.runtime = 0;
1050 else 1056 else
1051 global_status.topruntime = 0; 1057 global_status.topruntime = 0;
1052 gui_synclist_speak_item(&lists); 1058 say_runtime = true;
1053 } 1059 }
1054 } 1060 }
1055 if(default_event_handler(action) == SYS_USB_CONNECTED) 1061 if(default_event_handler(action) == SYS_USB_CONNECTED)