From 24e8fa317e9905ee30d195c4beedd7b8939ed6e1 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 18 Aug 2021 01:23:26 -0400 Subject: plugins trade talk_value for talk_value_decimal talk_value is just talk_value_decimal with 0 decimals lets add the extended function instead static inline int talk_val(long n, int unit, bool enqueue) { #define NODECIMALS 0 return rb->talk_value_decimal(n, unit, NODECIMALS, enqueue); } Change-Id: Iaba3d2f95785f2e1855e294ccf099a977bb6cb20 --- apps/plugins/announce_status.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'apps/plugins/announce_status.c') diff --git a/apps/plugins/announce_status.c b/apps/plugins/announce_status.c index 84a44556ef..5a112ed6df 100644 --- a/apps/plugins/announce_status.c +++ b/apps/plugins/announce_status.c @@ -185,6 +185,11 @@ static void config_reset_voice(void) } /****************** helper fuctions ******************/ +static inline int talk_val(long n, int unit, bool enqueue) +{ + #define NODECIMALS 0 + return rb->talk_value_decimal(n, unit, NODECIMALS, enqueue); +} void announce(void) { @@ -658,7 +663,7 @@ static unsigned char* voice_info_group(unsigned char* current_token, bool testin if (current_char == 'T') { runtime = rb->global_status->runtime; - rb->talk_value(runtime, UNIT_TIME, true); + talk_val(runtime, UNIT_TIME, true); } /* prefix suffix connectives */ else if (current_char == '1') @@ -669,7 +674,7 @@ static unsigned char* voice_info_group(unsigned char* current_token, bool testin { if (current_char == 'S') { - rb->talk_value(sleep_remaining, UNIT_TIME, true); + talk_val(sleep_remaining, UNIT_TIME, true); } /* prefix suffix connectives */ else if (current_char == '2') @@ -704,15 +709,15 @@ static unsigned char* voice_info_group(unsigned char* current_token, bool testin if (current_char == 'E') { - rb->talk_value(elapsed_length, UNIT_TIME, true); + talk_val(elapsed_length, UNIT_TIME, true); } else if (current_char == 'L') { - rb->talk_value(track_length, UNIT_TIME, true); + talk_val(track_length, UNIT_TIME, true); } else if (current_char == 'R') { - rb->talk_value(track_remaining, UNIT_TIME, true); + talk_val(track_remaining, UNIT_TIME, true); } else if (current_char == 'T' && id3->title) { @@ -797,11 +802,11 @@ static unsigned char* voice_info_group(unsigned char* current_token, bool testin if (current_char == 'P') { - rb->talk_value(rb->battery_level(), UNIT_PERCENT, true); + talk_val(rb->battery_level(), UNIT_PERCENT, true); } else if (current_char == 'M') { - rb->talk_value(rb->battery_time() * 60, UNIT_TIME, true); + talk_val(rb->battery_time() * 60, UNIT_TIME, true); } /* prefix suffix connectives */ else if (current_char == '1') -- cgit v1.2.3