From 8056b7fd1a333fe4d0c7ed8d3de0caf702f89164 Mon Sep 17 00:00:00 2001 From: Dana Conrad Date: Sun, 16 May 2021 15:01:26 -0500 Subject: Yes/No Screen: Allow accept to be button release Allows the ACTION_YESNO_ACCEPT action to be set to a button release by ignoring certain system events. Moving USB init in main.c to the last thing to prevent getting stuck in the USB prompt, if enabled. Also changing ACTION_YESNO_ACCEPT to button release on erosq Change-Id: I5e7498521a13cb4e840223dd0b9c8633e99093bc --- apps/gui/yesno.c | 5 +++++ apps/keymaps/keymap-erosq.c | 2 +- apps/main.c | 11 +++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index a50b2f1921..669f8ca09a 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c @@ -201,8 +201,13 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, result=YESNO_YES; break; case ACTION_NONE: + case ACTION_UNKNOWN: case SYS_CHARGER_DISCONNECTED: case SYS_BATTERY_UPDATE: + case SYS_TIMEOUT: +#if CONFIG_CHARGING + case SYS_CHARGER_CONNECTED: +#endif /* ignore some SYS events that can happen */ continue; default: diff --git a/apps/keymaps/keymap-erosq.c b/apps/keymaps/keymap-erosq.c index 59b70d24ca..24d040ebec 100644 --- a/apps/keymaps/keymap-erosq.c +++ b/apps/keymaps/keymap-erosq.c @@ -118,7 +118,7 @@ static const struct button_mapping button_context_tree[] = { }; /* button_context_tree */ static const struct button_mapping button_context_yesno[] = { - { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, + { ACTION_YESNO_ACCEPT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), }; /* button_context_settings_yesno */ diff --git a/apps/main.c b/apps/main.c index 3c549a8e63..c7b223faea 100644 --- a/apps/main.c +++ b/apps/main.c @@ -321,10 +321,6 @@ static void init(void) global_status.font_id[i] = FONT_SYSFIXED; font_init(); show_logo(); -#ifndef USB_NONE - usb_init(); - usb_start_monitoring(); -#endif button_init(); powermgmt_init(); backlight_init(); @@ -374,6 +370,13 @@ static void init(void) audio_init(); talk_announce_voice_invalid(); /* notify user w/ voice prompt if voice file invalid */ settings_apply_skins(); + +/* do USB last so prompt (if enabled) can work correctly if USB was inserted with device off, + * also doesn't hurt that it will display the nice pretty backdrop this way too. */ +#ifndef USB_NONE + usb_init(); + usb_start_monitoring(); +#endif } #else /* CONFIG_PLATFORM & PLATFORM_HOSTED */ -- cgit v1.2.3