UI: Fix uint32_t frequency printing

This commit is contained in:
Federico Amedeo Izzo 2020-11-26 16:53:17 +01:00
parent 5d964f3358
commit f7b1423053
2 changed files with 7 additions and 3 deletions

View File

@ -11,7 +11,7 @@ project('OpenRTX', 'c',
## OpenRTX
openrtx_src = ['tests/platform/printContacts_MDx.c',
openrtx_src = ['openrtx/src/main.c',
'openrtx/src/bootstrap.c',
'openrtx/src/state.c',
'openrtx/src/ui.c',

View File

@ -221,10 +221,14 @@ void _ui_drawVFO(state_t* state)
{
// Print VFO frequencies
char freq_buf[20] = "";
snprintf(freq_buf, sizeof(freq_buf), "Rx: %09.5f", ((float) state->channel.rx_frequency));
snprintf(freq_buf, sizeof(freq_buf), "Rx: %03d.%05d",
state->channel.rx_frequency/1000000,
state->channel.rx_frequency%1000000);
gfx_print(layout.line2_pos, freq_buf, layout.line1_font, TEXT_ALIGN_CENTER,
color_white);
snprintf(freq_buf, sizeof(freq_buf), "Tx: %09.5f", ((float) state->channel.tx_frequency));
snprintf(freq_buf, sizeof(freq_buf), "Tx: %03d.%05d",
state->channel.tx_frequency/1000000,
state->channel.tx_frequency%1000000);
gfx_print(layout.line3_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
color_white);
}