UI: Change right and left positions in layout_t to a unique position
This can be done since you can now print with right aligning on a left position
This commit is contained in:
parent
da7cda8020
commit
046d1a160c
|
|
@ -81,16 +81,11 @@ typedef struct layout_t
|
||||||
uint16_t line_v_pad;
|
uint16_t line_v_pad;
|
||||||
uint16_t horizontal_pad;
|
uint16_t horizontal_pad;
|
||||||
uint16_t text_v_offset;
|
uint16_t text_v_offset;
|
||||||
point_t top_left;
|
point_t top_pos;
|
||||||
point_t line1_left;
|
point_t line1_pos;
|
||||||
point_t line2_left;
|
point_t line2_pos;
|
||||||
point_t line3_left;
|
point_t line3_pos;
|
||||||
point_t bottom_left;
|
point_t bottom_pos;
|
||||||
point_t top_right;
|
|
||||||
point_t line1_right;
|
|
||||||
point_t line2_right;
|
|
||||||
point_t line3_right;
|
|
||||||
point_t bottom_right;
|
|
||||||
fontSize_t top_font;
|
fontSize_t top_font;
|
||||||
fontSize_t line1_font;
|
fontSize_t line1_font;
|
||||||
fontSize_t line2_font;
|
fontSize_t line2_font;
|
||||||
|
|
|
||||||
|
|
@ -254,16 +254,11 @@ layout_t _ui_calculateLayout()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Calculate printing positions
|
// Calculate printing positions
|
||||||
point_t top_left = {horizontal_pad, top_h - status_v_pad - text_v_offset};
|
point_t top_pos = {horizontal_pad, top_h - status_v_pad - text_v_offset};
|
||||||
point_t line1_left = {horizontal_pad, top_h + hline_h + line1_h - line_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_left = {horizontal_pad, top_h + hline_h + line1_h + line2_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_left = {horizontal_pad, top_h + hline_h + line1_h + line2_h + line3_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_left = {horizontal_pad, top_h + hline_h + line1_h + line2_h + line3_h + hline_h + bottom_h - status_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 top_right = {SCREEN_WIDTH - horizontal_pad, top_h - status_v_pad - text_v_offset};
|
|
||||||
point_t line1_right = {SCREEN_WIDTH - horizontal_pad, top_h + hline_h + line1_h - line_v_pad - text_v_offset};
|
|
||||||
point_t line2_right = {SCREEN_WIDTH - horizontal_pad, top_h + hline_h + line1_h + line2_h - line_v_pad - text_v_offset};
|
|
||||||
point_t line3_right = {SCREEN_WIDTH - horizontal_pad, top_h + hline_h + line1_h + line2_h + line3_h - line_v_pad - text_v_offset};
|
|
||||||
point_t bottom_right = {SCREEN_WIDTH - horizontal_pad, top_h + hline_h + line1_h + line2_h + line3_h + hline_h + bottom_h - status_v_pad - text_v_offset};
|
|
||||||
|
|
||||||
layout_t new_layout =
|
layout_t new_layout =
|
||||||
{
|
{
|
||||||
|
|
@ -277,16 +272,11 @@ layout_t _ui_calculateLayout()
|
||||||
line_v_pad,
|
line_v_pad,
|
||||||
horizontal_pad,
|
horizontal_pad,
|
||||||
text_v_offset,
|
text_v_offset,
|
||||||
top_left,
|
top_pos,
|
||||||
line1_left,
|
line1_pos,
|
||||||
line2_left,
|
line2_pos,
|
||||||
line3_left,
|
line3_pos,
|
||||||
bottom_left,
|
bottom_pos,
|
||||||
top_right,
|
|
||||||
line1_right,
|
|
||||||
line2_right,
|
|
||||||
line3_right,
|
|
||||||
bottom_right,
|
|
||||||
top_font,
|
top_font,
|
||||||
line1_font,
|
line1_font,
|
||||||
line2_font,
|
line2_font,
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ void _ui_drawMainTop()
|
||||||
char clock_buf[9] = "";
|
char clock_buf[9] = "";
|
||||||
snprintf(clock_buf, sizeof(clock_buf), "%02d:%02d:%02d", last_state.time.hour,
|
snprintf(clock_buf, sizeof(clock_buf), "%02d:%02d:%02d", last_state.time.hour,
|
||||||
last_state.time.minute, last_state.time.second);
|
last_state.time.minute, last_state.time.second);
|
||||||
gfx_print(layout.top_left, clock_buf, layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.top_pos, clock_buf, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ void _ui_drawMainTop()
|
||||||
strcpy(mode, "DMR");
|
strcpy(mode, "DMR");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gfx_print(layout.top_left, mode, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.top_pos, mode, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,31 +71,31 @@ void _ui_drawVFOMiddle()
|
||||||
snprintf(freq_buf, sizeof(freq_buf), " Rx:%03lu.%05lu",
|
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,
|
||||||
(unsigned long)last_state.channel.rx_frequency%1000000/10);
|
(unsigned long)last_state.channel.rx_frequency%1000000/10);
|
||||||
gfx_print(layout.line2_left, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
snprintf(freq_buf, sizeof(freq_buf), " Tx:%03lu.%05lu",
|
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,
|
||||||
(unsigned long)last_state.channel.tx_frequency%1000000/10);
|
(unsigned long)last_state.channel.tx_frequency%1000000/10);
|
||||||
gfx_print(layout.line3_left, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMEMMiddle()
|
void _ui_drawMEMMiddle()
|
||||||
{
|
{
|
||||||
// Print Channel name
|
// Print Channel name
|
||||||
gfx_print(layout.line1_left, last_state.channel.name, layout.line1_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line1_pos, last_state.channel.name, layout.line1_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
// Print Channel frequencies
|
// Print Channel frequencies
|
||||||
char freq_buf[20] = "";
|
char freq_buf[20] = "";
|
||||||
snprintf(freq_buf, sizeof(freq_buf), " Rx:%03lu.%05lu",
|
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,
|
||||||
(unsigned long)last_state.channel.rx_frequency%1000000/10);
|
(unsigned long)last_state.channel.rx_frequency%1000000/10);
|
||||||
gfx_print(layout.line2_left, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
snprintf(freq_buf, sizeof(freq_buf), " Tx:%03lu.%05lu",
|
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,
|
||||||
(unsigned long)last_state.channel.tx_frequency%1000000/10);
|
(unsigned long)last_state.channel.tx_frequency%1000000/10);
|
||||||
gfx_print(layout.line3_left, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
|
||||||
snprintf(freq_buf, sizeof(freq_buf), ">Rx:%03lu.%05lu",
|
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,
|
||||||
(unsigned long)ui_state->new_rx_frequency%1000000/10);
|
(unsigned long)ui_state->new_rx_frequency%1000000/10);
|
||||||
gfx_print(layout.line2_left, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -123,13 +123,13 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
|
||||||
if(ui_state->input_position == 1)
|
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;
|
ui_state->new_rx_freq_buf[insert_pos] = input_char;
|
||||||
gfx_print(layout.line2_left, ui_state->new_rx_freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, ui_state->new_rx_freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
snprintf(freq_buf, sizeof(freq_buf), " Tx:%03lu.%05lu",
|
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,
|
||||||
(unsigned long)last_state.channel.tx_frequency%1000000/10);
|
(unsigned long)last_state.channel.tx_frequency%1000000/10);
|
||||||
gfx_print(layout.line3_left, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
else if(ui_state->input_set == SET_TX)
|
else if(ui_state->input_set == SET_TX)
|
||||||
|
|
@ -137,7 +137,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
|
||||||
snprintf(freq_buf, sizeof(freq_buf), " Rx:%03lu.%05lu",
|
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,
|
||||||
(unsigned long)ui_state->new_rx_frequency%1000000/10);
|
(unsigned long)ui_state->new_rx_frequency%1000000/10);
|
||||||
gfx_print(layout.line2_left, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, freq_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
// Replace Rx frequency with underscorses
|
// Replace Rx frequency with underscorses
|
||||||
if(ui_state->input_position == 0)
|
if(ui_state->input_position == 0)
|
||||||
|
|
@ -145,7 +145,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
|
||||||
snprintf(freq_buf, sizeof(freq_buf), ">Tx:%03lu.%05lu",
|
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,
|
||||||
(unsigned long)ui_state->new_rx_frequency%1000000/10);
|
(unsigned long)ui_state->new_rx_frequency%1000000/10);
|
||||||
gfx_print(layout.line3_left, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -153,7 +153,7 @@ void _ui_drawVFOMiddleInput(ui_state_t* ui_state)
|
||||||
if(ui_state->input_position == 1)
|
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;
|
ui_state->new_tx_freq_buf[insert_pos] = input_char;
|
||||||
gfx_print(layout.line3_left, ui_state->new_tx_freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, ui_state->new_tx_freq_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +164,7 @@ void _ui_drawBottom()
|
||||||
// Squelch bar
|
// Squelch bar
|
||||||
float rssi = last_state.rssi;
|
float rssi = last_state.rssi;
|
||||||
float squelch = last_state.sqlLevel / 16.0f;
|
float squelch = last_state.sqlLevel / 16.0f;
|
||||||
point_t smeter_pos = { 0, layout.bottom_left.y +
|
point_t smeter_pos = { 0, layout.bottom_pos.y +
|
||||||
layout.status_v_pad +
|
layout.status_v_pad +
|
||||||
layout.text_v_offset -
|
layout.text_v_offset -
|
||||||
layout.bottom_h };
|
layout.bottom_h };
|
||||||
|
|
|
||||||
|
|
@ -176,60 +176,60 @@ void _ui_drawMenuTop(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Menu" on top bar
|
// Print "Menu" on top bar
|
||||||
gfx_print(layout.top_left, "Menu", layout.top_font,
|
gfx_print(layout.top_pos, "Menu", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
// Print menu entries
|
// Print menu entries
|
||||||
_ui_drawMenuList(layout.line1_left, ui_state->menu_selected, _ui_getMenuTopEntryName);
|
_ui_drawMenuList(layout.line1_pos, ui_state->menu_selected, _ui_getMenuTopEntryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMenuZone(ui_state_t* ui_state)
|
void _ui_drawMenuZone(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Zone" on top bar
|
// Print "Zone" on top bar
|
||||||
gfx_print(layout.top_left, "Zone", layout.top_font,
|
gfx_print(layout.top_pos, "Zone", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
// Print zone entries
|
// Print zone entries
|
||||||
_ui_drawMenuList(layout.line1_left, ui_state->menu_selected, _ui_getZoneName);
|
_ui_drawMenuList(layout.line1_pos, ui_state->menu_selected, _ui_getZoneName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMenuChannel(ui_state_t* ui_state)
|
void _ui_drawMenuChannel(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Channel" on top bar
|
// Print "Channel" on top bar
|
||||||
gfx_print(layout.top_left, "Channels", layout.top_font,
|
gfx_print(layout.top_pos, "Channels", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
// Print channel entries
|
// Print channel entries
|
||||||
_ui_drawMenuList(layout.line1_left, ui_state->menu_selected, _ui_getChannelName);
|
_ui_drawMenuList(layout.line1_pos, ui_state->menu_selected, _ui_getChannelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMenuContacts(ui_state_t* ui_state)
|
void _ui_drawMenuContacts(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Contacts" on top bar
|
// Print "Contacts" on top bar
|
||||||
gfx_print(layout.top_left, "Contacts", layout.top_font,
|
gfx_print(layout.top_pos, "Contacts", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
// Print contact entries
|
// Print contact entries
|
||||||
_ui_drawMenuList(layout.line1_left, ui_state->menu_selected, _ui_getContactName);
|
_ui_drawMenuList(layout.line1_pos, ui_state->menu_selected, _ui_getContactName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMenuSettings(ui_state_t* ui_state)
|
void _ui_drawMenuSettings(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Settings" on top bar
|
// Print "Settings" on top bar
|
||||||
gfx_print(layout.top_left, "Settings", layout.top_font,
|
gfx_print(layout.top_pos, "Settings", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
// Print menu entries
|
// Print menu entries
|
||||||
_ui_drawMenuList(layout.line1_left, ui_state->menu_selected, _ui_getSettingsEntryName);
|
_ui_drawMenuList(layout.line1_pos, ui_state->menu_selected, _ui_getSettingsEntryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMenuInfo(ui_state_t* ui_state)
|
void _ui_drawMenuInfo(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Info" on top bar
|
// Print "Info" on top bar
|
||||||
gfx_print(layout.top_left, "Info", layout.top_font,
|
gfx_print(layout.top_pos, "Info", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
// Print menu entries
|
// Print menu entries
|
||||||
_ui_drawMenuListValue(layout.line1_left, ui_state->menu_selected, _ui_getInfoEntryName,
|
_ui_drawMenuListValue(layout.line1_pos, ui_state->menu_selected, _ui_getInfoEntryName,
|
||||||
_ui_getInfoValueName);
|
_ui_getInfoValueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,10 +252,10 @@ void _ui_drawSettingsDisplay(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Display" on top bar
|
// Print "Display" on top bar
|
||||||
gfx_print(layout.top_left, "Display", layout.top_font,
|
gfx_print(layout.top_pos, "Display", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
// Print display settings entries
|
// Print display settings entries
|
||||||
_ui_drawMenuListValue(layout.line1_left, ui_state->menu_selected, _ui_getDisplayEntryName,
|
_ui_drawMenuListValue(layout.line1_pos, ui_state->menu_selected, _ui_getDisplayEntryName,
|
||||||
_ui_getDisplayValueName);
|
_ui_getDisplayValueName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,7 +264,7 @@ void _ui_drawSettingsTimeDate()
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Time&Date" on top bar
|
// Print "Time&Date" on top bar
|
||||||
gfx_print(layout.top_left, "Time&Date", layout.top_font,
|
gfx_print(layout.top_pos, "Time&Date", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
// Print current time and date
|
// Print current time and date
|
||||||
char date_buf[10] = "";
|
char date_buf[10] = "";
|
||||||
|
|
@ -273,9 +273,9 @@ void _ui_drawSettingsTimeDate()
|
||||||
last_state.time.date, last_state.time.month, last_state.time.year);
|
last_state.time.date, last_state.time.month, last_state.time.year);
|
||||||
snprintf(time_buf, sizeof(time_buf), "%02d:%02d:%02d",
|
snprintf(time_buf, sizeof(time_buf), "%02d:%02d:%02d",
|
||||||
last_state.time.hour, last_state.time.minute, last_state.time.second);
|
last_state.time.hour, last_state.time.minute, last_state.time.second);
|
||||||
gfx_print(layout.line2_left, date_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, date_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
gfx_print(layout.line3_left, time_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, time_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -285,7 +285,7 @@ void _ui_drawSettingsTimeDateSet(ui_state_t* ui_state)
|
||||||
|
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
// Print "Time&Date" on top bar
|
// Print "Time&Date" on top bar
|
||||||
gfx_print(layout.top_left, "Time&Date", layout.top_font,
|
gfx_print(layout.top_pos, "Time&Date", layout.top_font,
|
||||||
TEXT_ALIGN_CENTER, color_white);
|
TEXT_ALIGN_CENTER, color_white);
|
||||||
if(ui_state->input_position <= 0)
|
if(ui_state->input_position <= 0)
|
||||||
{
|
{
|
||||||
|
|
@ -313,26 +313,26 @@ void _ui_drawSettingsTimeDateSet(ui_state_t* ui_state)
|
||||||
ui_state->new_time_buf[pos] = input_char;
|
ui_state->new_time_buf[pos] = input_char;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gfx_print(layout.line2_left, ui_state->new_date_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, ui_state->new_date_buf, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
gfx_print(layout.line3_left, ui_state->new_time_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, ui_state->new_time_buf, layout.line3_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool _ui_drawMacroMenu() {
|
bool _ui_drawMacroMenu() {
|
||||||
// Header
|
// Header
|
||||||
gfx_print(layout.top_left, "Macro Menu", layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.top_pos, "Macro Menu", layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
// First row
|
// First row
|
||||||
gfx_print(layout.line1_left, "1", layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line1_pos, "1", layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
char code_str[11] = { 0 };
|
char code_str[11] = { 0 };
|
||||||
snprintf(code_str, 11, " %6.1f",
|
snprintf(code_str, 11, " %6.1f",
|
||||||
ctcss_tone[last_state.channel.fm.txTone]/10.0f);
|
ctcss_tone[last_state.channel.fm.txTone]/10.0f);
|
||||||
gfx_print(layout.line1_left, code_str, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line1_pos, code_str, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white);
|
color_white);
|
||||||
gfx_print(layout.line1_left, "2 ", layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line1_pos, "2 ", layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
char encdec_str[9] = { 0 };
|
char encdec_str[9] = { 0 };
|
||||||
bool tone_tx_enable = last_state.channel.fm.txToneEn;
|
bool tone_tx_enable = last_state.channel.fm.txToneEn;
|
||||||
|
|
@ -345,16 +345,16 @@ bool _ui_drawMacroMenu() {
|
||||||
snprintf(encdec_str, 9, " D ");
|
snprintf(encdec_str, 9, " D ");
|
||||||
else
|
else
|
||||||
snprintf(encdec_str, 9, " ");
|
snprintf(encdec_str, 9, " ");
|
||||||
gfx_print(layout.line1_left, encdec_str, layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line1_pos, encdec_str, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
gfx_print(layout.line1_left, "3 ", layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line1_pos, "3 ", layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
char pow_str[9] = { 0 };
|
char pow_str[9] = { 0 };
|
||||||
snprintf(pow_str, 9, "%.1gW", last_state.channel.power);
|
snprintf(pow_str, 9, "%.1gW", last_state.channel.power);
|
||||||
gfx_print(layout.line1_left, pow_str, layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line1_pos, pow_str, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
color_white);
|
color_white);
|
||||||
// Second row
|
// Second row
|
||||||
gfx_print(layout.line2_left, "4", layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line2_pos, "4", layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
char bw_str[8] = { 0 };
|
char bw_str[8] = { 0 };
|
||||||
switch (last_state.channel.bandwidth)
|
switch (last_state.channel.bandwidth)
|
||||||
|
|
@ -369,9 +369,9 @@ bool _ui_drawMacroMenu() {
|
||||||
snprintf(bw_str, 8, " 25");
|
snprintf(bw_str, 8, " 25");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gfx_print(layout.line2_left, bw_str, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line2_pos, bw_str, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white);
|
color_white);
|
||||||
gfx_print(layout.line2_left, "5 ", layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, "5 ", layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
char mode_str[9] = "";
|
char mode_str[9] = "";
|
||||||
switch(last_state.channel.mode)
|
switch(last_state.channel.mode)
|
||||||
|
|
@ -383,28 +383,28 @@ bool _ui_drawMacroMenu() {
|
||||||
snprintf(mode_str, 9," DMR");
|
snprintf(mode_str, 9," DMR");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gfx_print(layout.line2_left, mode_str, layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line2_pos, mode_str, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
gfx_print(layout.line2_left, "6 ", layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line2_pos, "6 ", layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
gfx_print(layout.line2_left, "Lck", layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line2_pos, "Lck", layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
color_white);
|
color_white);
|
||||||
// Third row
|
// Third row
|
||||||
gfx_print(layout.line3_left, "7", layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line3_pos, "7", layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
gfx_print(layout.line3_left, " B+", layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line3_pos, " B+", layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white);
|
color_white);
|
||||||
gfx_print(layout.line3_left, "8 ", layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, "8 ", layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
gfx_print(layout.line3_left, " B-", layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, " B-", layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
color_white);
|
color_white);
|
||||||
gfx_print(layout.line3_left, "9 ", layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line3_pos, "9 ", layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
yellow_fab413);
|
yellow_fab413);
|
||||||
gfx_print(layout.line3_left, "Sav", layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line3_pos, "Sav", layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
color_white);
|
color_white);
|
||||||
// Squelch bar
|
// Squelch bar
|
||||||
uint16_t squelch_width = SCREEN_WIDTH / 16 * last_state.sqlLevel;
|
uint16_t squelch_width = SCREEN_WIDTH / 16 * last_state.sqlLevel;
|
||||||
point_t squelch_pos = { layout.bottom_left.x, layout.bottom_left.y +
|
point_t squelch_pos = { layout.bottom_pos.x, layout.bottom_pos.y +
|
||||||
layout.status_v_pad +
|
layout.status_v_pad +
|
||||||
layout.text_v_offset -
|
layout.text_v_offset -
|
||||||
layout.bottom_h };
|
layout.bottom_h };
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue