Changed underlying type of 'freq_t' from 'float' to 'uint32_t'

This commit is contained in:
Silvano Seva 2020-11-24 15:39:10 +01:00
parent 65e4643f1e
commit 380f489eb0
2 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,8 @@
#ifndef DATATYPES_H #ifndef DATATYPES_H
#define DATATYPES_H #define DATATYPES_H
#include <stdint.h>
/** /**
* \brief CTCSS and DCS type definition. * \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. * Frequency type unit in Hz, able to hold SHF frequencies.
*/ */
typedef float freq_t; typedef uint32_t freq_t;
#endif /* DATATYPES_H */ #endif /* DATATYPES_H */

View File

@ -221,10 +221,10 @@ void _ui_drawVFO()
{ {
// Print VFO frequencies // Print VFO frequencies
char freq_buf[20] = ""; 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, gfx_print(layout.line2_pos, freq_buf, layout.line1_font, TEXT_ALIGN_CENTER,
color_white); 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, gfx_print(layout.line3_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
color_white); color_white);
} }