summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-03-04 22:55:39 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2021-03-04 22:55:39 -0500
commit03ae4e6019500c1fb9a292ae428e5c47b17bf18f (patch)
tree03250a75098627e1b44c4897088eab2a767c86ee
parent10b67071314e0f46bce81a3162ef971963d146af (diff)
Announce_status plugin make USB plug aware
Announce_status was blocking USB from working it now quits on USB plug Change-Id: I0b7e5e9c1ef118582febd459e706c9b61cf7fe25
-rw-r--r--apps/plugins/announce_status.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/plugins/announce_status.c b/apps/plugins/announce_status.c
index fa9e783fd8..9df6fef7bc 100644
--- a/apps/plugins/announce_status.c
+++ b/apps/plugins/announce_status.c
@@ -411,13 +411,15 @@ void thread(void)
interval = gAnnounce.interval * HZ;
switch (ev.id)
{
+ case SYS_USB_CONNECTED:
+ rb->usb_acknowledge(SYS_USB_CONNECTED_ACK);
case EV_EXIT:
return;
case EV_OTHINSTANCE:
if (*rb->current_tick - last_tick >= interval)
{
last_tick += interval;
- rb->sleep(0);
+ rb->sleep(HZ / 10);
announce();
}
break;
@@ -425,7 +427,7 @@ void thread(void)
rb->beep_play(1500, 100, 1000);
break;
case EV_TRACKCHANGE:
- rb->sleep(0);
+ rb->sleep(HZ / 10);
announce();
break;
}
@@ -509,7 +511,7 @@ int plugin_main(const void* parameter)
gAnnounce.index = 0;
gAnnounce.timeout = 0;
- rb->talk_id(LANG_HOLD_FOR_SETTINGS, false);
+
rb->splash(HZ / 2, "Announce Status");
if (configfile_load(CFG_FILE, config, gCfg_sz, CFG_VER) < 0)
@@ -518,6 +520,14 @@ int plugin_main(const void* parameter)
config_set_defaults();
configfile_save(CFG_FILE, config, gCfg_sz, CFG_VER);
+ if (rb->mixer_channel_status(PCM_MIXER_CHAN_PLAYBACK) == CHANNEL_PLAYING)
+ {
+ while (rb->mixer_channel_get_bytes_waiting(PCM_MIXER_CHAN_PLAYBACK) > 0)
+ rb->sleep(HZ / 10);
+ }
+
+ rb->talk_id(LANG_HOLD_FOR_SETTINGS, false);
+
rb->splash(HZ, ID2P(LANG_HOLD_FOR_SETTINGS));
}