UI: Change layout to show big digits frequency

replace/493762b509824225ce1995febc4b2993b63ec845
Federico Amedeo Izzo 2021-01-31 11:37:42 +01:00
rodzic 046d1a160c
commit c8b4328450
3 zmienionych plików z 78 dodań i 82 usunięć

Wyświetl plik

@ -78,7 +78,6 @@ typedef struct layout_t
uint16_t line3_h;
uint16_t bottom_h;
uint16_t status_v_pad;
uint16_t line_v_pad;
uint16_t horizontal_pad;
uint16_t text_v_offset;
point_t top_pos;

Wyświetl plik

@ -31,35 +31,33 @@
*
* 160x128 display (MD380) Recommended font size
*
* top_status_bar (16 px) 8 pt (11 px) font with 2 px vertical padding
* 1 px line
* top_status_bar (16px) 8 pt (11 px) font with 2 px vertical padding
* top_pad (4px) 4 px padding
* Line 1 (20px) 8 pt (11 px) font with 4 px vertical padding
* Line 2 (20px) 8 pt (11 px) font with 4 px vertical padding
*
* Line 1 (34px) 12 pt (18 px) font with 8 px vertical padding
*
* Line 2 (30px) 12 pt (18 px) font with 6 px vertical padding
*
* Line 3 (30px) 12 pt (18 px) font with 6 px vertical padding
* 1 px line
* bottom_status_bar (16 px) 8 pt (11 px) font with 2 px vertical padding
* Line 3 (40px) 16 pt (xx px) font with 6 px vertical padding
* RSSI+squelch bar (20px) 20 px
* bottom_pad (4px) 4 px padding
*
*
* 128x64 display (GD-77)
*
* top_status_bar (11 px) 6 pt (9 px) font with 1 px vertical padding
* 1 px line
* top_pad (1px) 1 px padding
* Line 1 (10px) 6 pt (9 px) font without vertical padding
* Line 2 (15px) 8 pt (11 px) font with 2 px vertical padding
* Line 3 (15px) 8 pt (11 px) font with 2 px vertical padding
* 1 px line
* bottom_status_bar(11 px) 6 pt (9 px) font with 1 px vertical padding
* Line 2 (10px) 6 pt (9 px) font with 2 px vertical padding
* Line 3 (18px) 12 pt (xx px) font with 0 px vertical padding
* RSSI+squelch bar (11px) 11 px
* bottom_pad (1px) 1 px padding
*
*
* 128x48 display (RD-5R)
*
* top_status_bar (11 px) 6 pt (9 px) font with 1 px vertical padding
* 1 px line
* Line 2 (19px) 8 pt (11 px) font with 4 px vertical padding
* Line 3 (19px) 8 pt (11 px) font with 4 px vertical padding
* Line 2 (10px) 8 pt (11 px) font with 4 px vertical padding
* Line 3 (18px) 8 pt (11 px) font with 4 px vertical padding
*
*/
@ -188,20 +186,24 @@ layout_t _ui_calculateLayout()
// Height and padding shown in diagram at beginning of file
const uint16_t top_h = 16;
const uint16_t bottom_h = top_h;
const uint16_t line1_h = 34;
const uint16_t line2_h = 30;
const uint16_t line3_h = 30;
const uint16_t top_pad = 4;
const uint16_t line1_h = 20;
const uint16_t line2_h = 20;
const uint16_t line3_h = 40;
const uint16_t bottom_h = 20;
const uint16_t bottom_pad = top_pad;
const uint16_t status_v_pad = 2;
const uint16_t line_v_pad = 6;
const uint16_t small_line_v_pad = 2;
const uint16_t big_line_v_pad = 6;
const uint16_t horizontal_pad = 4;
// Top bar font: 8 pt
const fontSize_t top_font = FONT_SIZE_8PT;
// Middle line fonts: 12 pt
const fontSize_t line1_font = FONT_SIZE_9PT;
const fontSize_t line2_font = FONT_SIZE_12PT;
const fontSize_t line3_font = FONT_SIZE_12PT;
// Text line font: 8 pt
const fontSize_t line1_font = FONT_SIZE_8PT;
const fontSize_t line2_font = FONT_SIZE_8PT;
// Frequency line font: 16 pt
const fontSize_t line3_font = FONT_SIZE_16PT;
// Bottom bar font: 8 pt
const fontSize_t bottom_font = FONT_SIZE_8PT;
@ -210,20 +212,23 @@ layout_t _ui_calculateLayout()
// Height and padding shown in diagram at beginning of file
const uint16_t top_h = 11;
const uint16_t bottom_h = top_h;
const uint16_t top_pad = 1;
const uint16_t line1_h = 10;
const uint16_t line2_h = 15;
const uint16_t line3_h = 15;
const uint16_t line2_h = 10;
const uint16_t line3_h = 18;
const uint16_t bottom_h = top_h;
const uint16_t bottom_pad = 1;
const uint16_t status_v_pad = 1;
const uint16_t line_v_pad = 2;
const uint16_t small_line_v_pad = 1;
const uint16_t big_line_v_pad = 0;
const uint16_t horizontal_pad = 4;
// Top bar font: 6 pt
const fontSize_t top_font = FONT_SIZE_6PT;
// Middle line fonts: 5, 8, 8 pt
const fontSize_t line1_font = FONT_SIZE_5PT;
const fontSize_t line2_font = FONT_SIZE_8PT;
const fontSize_t line3_font = FONT_SIZE_8PT;
const fontSize_t line1_font = FONT_SIZE_6PT;
const fontSize_t line2_font = FONT_SIZE_6PT;
const fontSize_t line3_font = FONT_SIZE_12PT;
// Bottom bar font: 6 pt
const fontSize_t bottom_font = FONT_SIZE_6PT;
@ -232,20 +237,23 @@ layout_t _ui_calculateLayout()
// Height and padding shown in diagram at beginning of file
const uint16_t top_h = 11;
const uint16_t bottom_h = 0;
const uint16_t top_pad = 1;
const uint16_t line1_h = 0;
const uint16_t line2_h = 19;
const uint16_t line3_h = 19;
const uint16_t line2_h = 10;
const uint16_t line3_h = 18;
const uint16_t bottom_h = 0;
const uint16_t bottom_pad = 0;
const uint16_t status_v_pad = 1;
const uint16_t line_v_pad = 4;
const uint16_t horizontal_pad = 0;
const uint16_t small_line_v_pad = 1;
const uint16_t big_line_v_pad = 0;
const uint16_t horizontal_pad = 4;
// Top bar font: 8 pt
const fontSize_t top_font = FONT_SIZE_6PT;
// Middle line fonts: 16, 16
const fontSize_t line2_font = FONT_SIZE_8PT;
const fontSize_t line3_font = FONT_SIZE_8PT;
// Not present in this UI
const fontSize_t line2_font = FONT_SIZE_6PT;
const fontSize_t line3_font = FONT_SIZE_12PT;
// Not present on this resolution
const fontSize_t line1_font = 0;
const fontSize_t bottom_font = 0;
@ -255,10 +263,10 @@ layout_t _ui_calculateLayout()
// Calculate printing positions
point_t top_pos = {horizontal_pad, top_h - status_v_pad - text_v_offset};
point_t line1_pos = {horizontal_pad, top_h + hline_h + line1_h - line_v_pad - text_v_offset};
point_t line2_pos = {horizontal_pad, top_h + hline_h + line1_h + line2_h - line_v_pad - text_v_offset};
point_t line3_pos = {horizontal_pad, top_h + hline_h + line1_h + line2_h + line3_h - line_v_pad - text_v_offset};
point_t bottom_pos = {horizontal_pad, top_h + hline_h + line1_h + line2_h + line3_h + hline_h + bottom_h - status_v_pad - text_v_offset};
point_t line1_pos = {horizontal_pad, top_h + top_pad + line1_h - small_line_v_pad - text_v_offset};
point_t line2_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h - small_line_v_pad - text_v_offset};
point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - big_line_v_pad - text_v_offset};
point_t bottom_pos = {horizontal_pad, SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset};
layout_t new_layout =
{
@ -269,7 +277,6 @@ layout_t _ui_calculateLayout()
line3_h,
bottom_h,
status_v_pad,
line_v_pad,
horizontal_pad,
text_v_offset,
top_pos,

Wyświetl plik

@ -64,37 +64,29 @@ void _ui_drawMainTop()
color_white);
}
void _ui_drawVFOMiddle()
void _ui_drawZoneChannel(bool print_zone)
{
// Print VFO frequencies
char freq_buf[20] = "";
snprintf(freq_buf, sizeof(freq_buf), " Rx:%03lu.%05lu",
(unsigned long)last_state.channel.rx_frequency/1000000,
(unsigned long)last_state.channel.rx_frequency%1000000/10);
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
color_white);
snprintf(freq_buf, sizeof(freq_buf), " Tx:%03lu.%05lu",
(unsigned long)last_state.channel.tx_frequency/1000000,
(unsigned long)last_state.channel.tx_frequency%1000000/10);
gfx_print(layout.line3_pos, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
color_white);
if(print_zone)
{
char zone_buf[20] = "";
snprintf(zone_buf, sizeof(zone_buf), "zone: %.13s", "Test Zone");
// Print Zone name
gfx_print(layout.line1_pos, zone_buf, layout.line1_font, TEXT_ALIGN_LEFT, color_white);
}
char channel_buf[20] = "";
snprintf(channel_buf, sizeof(channel_buf), " %03d: %.12s", last_state.channel_index,
last_state.channel.name);
// Print Channel name
gfx_print(layout.line2_pos, channel_buf, layout.line2_font, TEXT_ALIGN_LEFT, color_white);
}
void _ui_drawMEMMiddle()
void _ui_drawFrequency()
{
// Print Channel name
gfx_print(layout.line1_pos, last_state.channel.name, layout.line1_font, TEXT_ALIGN_CENTER,
color_white);
// Print Channel frequencies
char freq_buf[20] = "";
snprintf(freq_buf, sizeof(freq_buf), " Rx:%03lu.%05lu",
// Print big numbers frequency
char freq_buf[10] = "";
snprintf(freq_buf, sizeof(freq_buf), "%03lu.%05lu",
(unsigned long)last_state.channel.rx_frequency/1000000,
(unsigned long)last_state.channel.rx_frequency%1000000/10);
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
color_white);
snprintf(freq_buf, sizeof(freq_buf), " Tx:%03lu.%05lu",
(unsigned long)last_state.channel.tx_frequency/1000000,
(unsigned long)last_state.channel.tx_frequency%1000000/10);
gfx_print(layout.line3_pos, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
color_white);
}
@ -114,7 +106,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
snprintf(freq_buf, sizeof(freq_buf), ">Rx:%03lu.%05lu",
(unsigned long)ui_state->new_rx_frequency/1000000,
(unsigned long)ui_state->new_rx_frequency%1000000/10);
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line1_pos, freq_buf, layout.line1_font, TEXT_ALIGN_CENTER,
color_white);
}
else
@ -123,13 +115,13 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
if(ui_state->input_position == 1)
strcpy(ui_state->new_rx_freq_buf, ">Rx:___._____");
ui_state->new_rx_freq_buf[insert_pos] = input_char;
gfx_print(layout.line2_pos, ui_state->new_rx_freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line1_pos, ui_state->new_rx_freq_buf, layout.line1_font, TEXT_ALIGN_CENTER,
color_white);
}
snprintf(freq_buf, sizeof(freq_buf), " Tx:%03lu.%05lu",
(unsigned long)last_state.channel.tx_frequency/1000000,
(unsigned long)last_state.channel.tx_frequency%1000000/10);
gfx_print(layout.line3_pos, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
color_white);
}
else if(ui_state->input_set == SET_TX)
@ -137,7 +129,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
snprintf(freq_buf, sizeof(freq_buf), " Rx:%03lu.%05lu",
(unsigned long)ui_state->new_rx_frequency/1000000,
(unsigned long)ui_state->new_rx_frequency%1000000/10);
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line1_pos, freq_buf, layout.line1_font, TEXT_ALIGN_CENTER,
color_white);
// Replace Rx frequency with underscorses
if(ui_state->input_position == 0)
@ -145,7 +137,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
snprintf(freq_buf, sizeof(freq_buf), ">Tx:%03lu.%05lu",
(unsigned long)ui_state->new_rx_frequency/1000000,
(unsigned long)ui_state->new_rx_frequency%1000000/10);
gfx_print(layout.line3_pos, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
color_white);
}
else
@ -153,7 +145,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
if(ui_state->input_position == 1)
strcpy(ui_state->new_tx_freq_buf, ">Tx:___._____");
ui_state->new_tx_freq_buf[insert_pos] = input_char;
gfx_print(layout.line3_pos, ui_state->new_tx_freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
gfx_print(layout.line2_pos, ui_state->new_tx_freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
color_white);
}
}
@ -174,16 +166,14 @@ void _ui_drawBottom()
void _ui_drawMainVFO()
{
gfx_clearScreen();
_ui_drawMainBackground();
_ui_drawMainTop();
_ui_drawVFOMiddle();
_ui_drawFrequency();
_ui_drawBottom();
}
void _ui_drawMainVFOInput(ui_state_t* ui_state)
{
gfx_clearScreen();
_ui_drawMainBackground();
_ui_drawMainTop();
_ui_drawVFOMiddleInput(ui_state);
_ui_drawBottom();
@ -192,8 +182,8 @@ void _ui_drawMainVFOInput(ui_state_t* ui_state)
void _ui_drawMainMEM()
{
gfx_clearScreen();
_ui_drawMainBackground();
_ui_drawMainTop();
_ui_drawMEMMiddle();
_ui_drawZoneChannel(false);
_ui_drawFrequency();
_ui_drawBottom();
}