From 380f489eb0dbf92f255d6897c989f1ffe5ddb3ee Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Tue, 24 Nov 2020 15:39:10 +0100 Subject: [PATCH] Changed underlying type of 'freq_t' from 'float' to 'uint32_t' --- openrtx/include/datatypes.h | 4 +++- openrtx/src/ui.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openrtx/include/datatypes.h b/openrtx/include/datatypes.h index 01a43fc8..a6106cf8 100644 --- a/openrtx/include/datatypes.h +++ b/openrtx/include/datatypes.h @@ -20,6 +20,8 @@ #ifndef DATATYPES_H #define DATATYPES_H +#include + /** * \brief CTCSS and DCS type definition. * @@ -37,6 +39,6 @@ typedef unsigned int tone_t; * * Frequency type unit in Hz, able to hold SHF frequencies. */ -typedef float freq_t; +typedef uint32_t freq_t; #endif /* DATATYPES_H */ diff --git a/openrtx/src/ui.c b/openrtx/src/ui.c index 59c74b16..e17476c6 100644 --- a/openrtx/src/ui.c +++ b/openrtx/src/ui.c @@ -221,10 +221,10 @@ void _ui_drawVFO() { // Print VFO frequencies char freq_buf[20] = ""; - snprintf(freq_buf, sizeof(freq_buf), "Rx: %09.5f", state.rx_freq); + snprintf(freq_buf, sizeof(freq_buf), "Rx: %09.5f", ((float) state.rx_freq)); gfx_print(layout.line2_pos, freq_buf, layout.line1_font, TEXT_ALIGN_CENTER, color_white); - snprintf(freq_buf, sizeof(freq_buf), "Tx: %09.5f", state.tx_freq); + snprintf(freq_buf, sizeof(freq_buf), "Tx: %09.5f", ((float) state.tx_freq)); gfx_print(layout.line3_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER, color_white); }