Changed the granularity of VFO frequency input mode from tens to hundreds: this reduces the number of digits to be inserted to seven and avoids the line to overflow towards the bottom

pull/114/head v0.3.4
Silvano Seva 2022-09-02 07:54:32 +02:00
rodzic b5fc9b252d
commit 94baec6981
3 zmienionych plików z 12 dodań i 12 usunięć

Wyświetl plik

@ -31,7 +31,7 @@
// Maximum menu entry length
#define MAX_ENTRY_LEN 21
// Frequency digits
#define FREQ_DIGITS 8
#define FREQ_DIGITS 7
// Time & Date digits
#define TIMEDATE_DIGITS 10
// Max number of UI events

Wyświetl plik

@ -458,7 +458,7 @@ void _ui_drawLowBatteryScreen()
freq_t _ui_freq_add_digit(freq_t freq, uint8_t pos, uint8_t number)
{
freq_t coefficient = 10;
freq_t coefficient = 100;
for(uint8_t i=0; i < FREQ_DIGITS - pos; i++)
{
coefficient *= 10;

Wyświetl plik

@ -115,42 +115,42 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
if(ui_state->input_position == 0)
{
gfx_print(layout.line2_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ">Rx:%03lu.%05lu",
color_white, ">Rx:%03lu.%04lu",
(unsigned long)ui_state->new_rx_frequency/1000000,
(unsigned long)ui_state->new_rx_frequency%1000000/10);
(unsigned long)(ui_state->new_rx_frequency%1000000)/100);
}
else
{
// Replace Rx frequency with underscorses
if(ui_state->input_position == 1)
strcpy(ui_state->new_rx_freq_buf, ">Rx:___._____");
strcpy(ui_state->new_rx_freq_buf, ">Rx:___.____");
ui_state->new_rx_freq_buf[insert_pos] = input_char;
gfx_print(layout.line2_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ui_state->new_rx_freq_buf);
}
gfx_print(layout.line3_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, " Tx:%03lu.%05lu",
color_white, " Tx:%03lu.%04lu",
(unsigned long)last_state.channel.tx_frequency/1000000,
(unsigned long)last_state.channel.tx_frequency%1000000/10);
(unsigned long)(last_state.channel.tx_frequency%1000000)/100);
}
else if(ui_state->input_set == SET_TX)
{
gfx_print(layout.line2_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, " Rx:%03lu.%05lu",
color_white, " Rx:%03lu.%04lu",
(unsigned long)ui_state->new_rx_frequency/1000000,
(unsigned long)ui_state->new_rx_frequency%1000000/10);
(unsigned long)(ui_state->new_rx_frequency%1000000)/100);
// Replace Rx frequency with underscorses
if(ui_state->input_position == 0)
{
gfx_print(layout.line3_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ">Tx:%03lu.%05lu",
color_white, ">Tx:%03lu.%04lu",
(unsigned long)ui_state->new_rx_frequency/1000000,
(unsigned long)ui_state->new_rx_frequency%1000000/10);
(unsigned long)(ui_state->new_rx_frequency%1000000)/100);
}
else
{
if(ui_state->input_position == 1)
strcpy(ui_state->new_tx_freq_buf, ">Tx:___._____");
strcpy(ui_state->new_tx_freq_buf, ">Tx:___.____");
ui_state->new_tx_freq_buf[insert_pos] = input_char;
gfx_print(layout.line3_pos, layout.input_font, TEXT_ALIGN_CENTER,
color_white, ui_state->new_tx_freq_buf);