shortcuts: add missing voice for sleep shortcuts without name

Change-Id: I1178be8c82671d64746297306b27ee9ccb50c1a2
This commit is contained in:
Christian Soffke 2025-06-06 18:57:28 +02:00
parent e9d0be5dfd
commit 94cf3403e2
4 changed files with 10 additions and 9 deletions

View file

@ -485,7 +485,7 @@ int sleeptimer_voice(int selected_item, void*data)
{ {
(void)selected_item; (void)selected_item;
(void)data; (void)data;
talk_sleeptimer(); talk_sleeptimer(-1);
return 0; return 0;
} }

View file

@ -1555,13 +1555,14 @@ int toggle_sleeptimer(void)
return 0; return 0;
} }
void talk_sleeptimer(void) void talk_sleeptimer(int custom_duration)
{ {
int seconds = get_sleep_timer(); int seconds = custom_duration < 0 ? get_sleep_timer() : custom_duration*60;
long talk_ids[] = { long talk_ids[] = {
seconds ? LANG_SLEEP_TIMER_CANCEL_CURRENT custom_duration >= 0 ? LANG_SLEEP_TIMER :
: LANG_SLEEP_TIMER_START_CURRENT, (seconds ? LANG_SLEEP_TIMER_CANCEL_CURRENT : LANG_SLEEP_TIMER_START_CURRENT),
VOICE_PAUSE, VOICE_PAUSE,
custom_duration == 0 ? LANG_OFF :
(seconds ? seconds_to_min(seconds) (seconds ? seconds_to_min(seconds)
: global_settings.sleeptimer_duration) | UNIT_MIN << UNIT_SHIFT, : global_settings.sleeptimer_duration) | UNIT_MIN << UNIT_SHIFT,
TALK_FINAL_ID TALK_FINAL_ID

View file

@ -101,7 +101,7 @@ const char* format_sleeptimer(char* buffer, size_t buffer_size,
canceled, and how long it will be or how long is remaining in brackets */ canceled, and how long it will be or how long is remaining in brackets */
char* string_sleeptimer(char *buffer, size_t buffer_len); char* string_sleeptimer(char *buffer, size_t buffer_len);
int toggle_sleeptimer(void); int toggle_sleeptimer(void);
void talk_sleeptimer(void); void talk_sleeptimer(int custom_duration);
#if CONFIG_RTC #if CONFIG_RTC
void talk_timedate(void); void talk_timedate(void);

View file

@ -607,10 +607,10 @@ static int shortcut_menu_speak_item(int selected_item, void * data)
talk_timedate(); talk_timedate();
else else
#endif #endif
if (sc->u.timedata.sleep_timeout < 0) if (sc->name[0])
talk_sleeptimer();
else if (sc->name[0])
talk_spell(sc->name, false); talk_spell(sc->name, false);
else
talk_sleeptimer(sc->u.timedata.sleep_timeout);
break; break;
case SHORTCUT_SHUTDOWN: case SHORTCUT_SHUTDOWN:
case SHORTCUT_REBOOT: case SHORTCUT_REBOOT: