[Feature] Supress voice during sleep timer shutdown

if show_shutdown_message == false and sleep timer is active
talk will be disabled on shutdown

Change-Id: Ia660e753700f3e283691f41797ef7a77a2d9a8d9
This commit is contained in:
William Wilgus 2023-04-08 17:13:07 -04:00
parent 3554306617
commit 78c92c5ca8
3 changed files with 12 additions and 0 deletions

View file

@ -306,6 +306,12 @@ static bool clean_shutdown(enum shutdown_type sd_type,
{ {
long msg_id = -1; long msg_id = -1;
if (!global_settings.show_shutdown_message && get_sleep_timer_active())
{
talk_force_shutup();
talk_disable(true);
}
status_save(); status_save();
#if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING) #if CONFIG_CHARGING && !defined(HAVE_POWEROFF_WHILE_CHARGING)

View file

@ -164,6 +164,7 @@ int get_battery_capacity(void); /* get local battery capacity value */
void set_battery_type(int type); /* set local battery type */ void set_battery_type(int type); /* set local battery type */
void set_sleeptimer_duration(int minutes); void set_sleeptimer_duration(int minutes);
bool get_sleep_timer_active(void);
int get_sleep_timer(void); int get_sleep_timer(void);
void set_keypress_restarts_sleep_timer(bool enable); void set_keypress_restarts_sleep_timer(bool enable);
void handle_auto_poweroff(void); void handle_auto_poweroff(void);

View file

@ -961,6 +961,11 @@ static void set_sleep_timer(int seconds)
sleeptimer_duration = seconds; sleeptimer_duration = seconds;
} }
bool get_sleep_timer_active(void)
{
return sleeptimer_active;
}
int get_sleep_timer(void) int get_sleep_timer(void)
{ {
if (sleeptimer_active && (sleeptimer_endtick >= current_tick)) if (sleeptimer_active && (sleeptimer_endtick >= current_tick))