Removed use of floating points when printing/announcing CTCSS tone frequency

pull/238/head
Silvano Seva 2023-12-26 17:15:31 +01:00
rodzic 5b3929ef44
commit cb7b605251
5 zmienionych plików z 26 dodań i 10 usunięć

Wyświetl plik

@ -22,6 +22,7 @@
#include <datatypes.h>
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {

Wyświetl plik

@ -18,6 +18,7 @@
***************************************************************************/
#include <utils.h>
#include <stdio.h>
#include <math.h>
uint8_t interpCalParameter(const freq_t freq, const freq_t *calPoints,

Wyświetl plik

@ -380,7 +380,9 @@ void vp_announceCTCSS(const bool rxToneEnabled, const uint8_t rxTone,
if (flags & vpqIncludeDescriptions)
vp_queuePrompt(PROMPT_TONE);
snprintf(buffer, 16, "%3.1f", ctcss_tone[rxTone] / 10.0f);
uint16_t tone = ctcss_tone[rxTone];
snprintf(buffer, sizeof(buffer), "%d.%d", (tone / 10), (tone % 10));
vp_queueString(buffer, vpAnnounceCommonSymbols);
vp_queuePrompt(PROMPT_HERTZ);
playIfNeeded(flags);
@ -396,7 +398,10 @@ void vp_announceCTCSS(const bool rxToneEnabled, const uint8_t rxTone,
vp_queuePrompt(PROMPT_RECEIVE);
vp_queuePrompt(PROMPT_TONE);
}
snprintf(buffer, 16, "%3.1f", ctcss_tone[rxTone] / 10.0f);
uint16_t tone = ctcss_tone[rxTone];
snprintf(buffer, sizeof(buffer), "%d.%d", (tone / 10), (tone % 10));
vp_queueString(buffer, vpAnnounceCommonSymbols);
vp_queuePrompt(PROMPT_HERTZ);
}
@ -408,7 +413,9 @@ void vp_announceCTCSS(const bool rxToneEnabled, const uint8_t rxTone,
vp_queuePrompt(PROMPT_TONE);
}
snprintf(buffer, 16, "%3.1f", ctcss_tone[txTone] / 10.0f);
uint16_t tone = ctcss_tone[txTone];
snprintf(buffer, sizeof(buffer), "%d.%d", (tone / 10), (tone % 10));
vp_queueString(buffer, vpAnnounceCommonSymbols);
vp_queuePrompt(PROMPT_HERTZ);
}

Wyświetl plik

@ -25,6 +25,7 @@
#include <ui/ui_default.h>
#include <string.h>
#include <ui/ui_strings.h>
#include <utils.h>
void _ui_drawMainBackground()
{
@ -102,12 +103,17 @@ void _ui_drawModeInfo(ui_state_t* ui_state)
// Print Bandwidth, Tone and encdec info
if (tone_tx_enable || tone_rx_enable)
gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_CENTER,
color_white, "%s %4.1f %s", bw_str,
ctcss_tone[last_state.channel.fm.txTone]/10.0f, encdec_str);
{
uint16_t tone = ctcss_tone[last_state.channel.fm.txTone];
gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_CENTER,
color_white, "%s %d.%d %s", bw_str, (tone / 10),
(tone % 10), encdec_str);
}
else
gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_CENTER,
color_white, "%s", bw_str );
{
gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_CENTER,
color_white, "%s", bw_str );
}
break;
case OPMODE_DMR:

Wyświetl plik

@ -1034,9 +1034,10 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
yellow_fab413, "1");
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " T-");
uint16_t tone = ctcss_tone[last_state.channel.fm.txTone];
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " %7.1f",
ctcss_tone[last_state.channel.fm.txTone]/10.0f);
color_white, " %d.%d", (tone / 10), (tone % 10));
#if defined(CONFIG_UI_NO_KEYBOARD)
if (ui_state->macro_menu_selected == 1)
#endif // CONFIG_UI_NO_KEYBOARD