kopia lustrzana https://github.com/OpenRTX/OpenRTX
Usability improvements
Remove DMR from macro menu until we actually support it. Remove print of M17 source callsign Bank and channel visualization is more compact to make room for additional data on a single screen. Refactor mode screen to fit all data into a single screen.pull/116/head
rodzic
91d608cc6b
commit
6a9ce50f6b
|
|
@ -53,7 +53,6 @@ openrtx_src = ['openrtx/src/core/state.c',
|
||||||
'openrtx/src/core/memory_profiling.cpp',
|
'openrtx/src/core/memory_profiling.cpp',
|
||||||
'openrtx/src/ui/ui.c',
|
'openrtx/src/ui/ui.c',
|
||||||
'openrtx/src/ui/ui_main.c',
|
'openrtx/src/ui/ui_main.c',
|
||||||
'openrtx/src/ui/ui_mode.c',
|
|
||||||
'openrtx/src/ui/ui_menu.c',
|
'openrtx/src/ui/ui_menu.c',
|
||||||
'openrtx/src/rtx/rtx.cpp',
|
'openrtx/src/rtx/rtx.cpp',
|
||||||
'openrtx/src/rtx/OpMode_FM.cpp',
|
'openrtx/src/rtx/OpMode_FM.cpp',
|
||||||
|
|
|
||||||
|
|
@ -85,11 +85,9 @@ extern void _ui_drawVFOMiddle();
|
||||||
extern void _ui_drawMEMMiddle();
|
extern void _ui_drawMEMMiddle();
|
||||||
extern void _ui_drawVFOBottom();
|
extern void _ui_drawVFOBottom();
|
||||||
extern void _ui_drawMEMBottom();
|
extern void _ui_drawMEMBottom();
|
||||||
extern void _ui_drawMainVFO();
|
extern void _ui_drawMainVFO(ui_state_t* ui_state);
|
||||||
extern void _ui_drawMainVFOInput(ui_state_t* ui_state);
|
extern void _ui_drawMainVFOInput(ui_state_t* ui_state);
|
||||||
extern void _ui_drawMainMEM();
|
extern void _ui_drawMainMEM(ui_state_t* ui_state);
|
||||||
extern void _ui_drawModeVFO();
|
|
||||||
extern void _ui_drawModeMEM();
|
|
||||||
/* UI menu functions, their implementation is in "ui_menu.c" */
|
/* UI menu functions, their implementation is in "ui_menu.c" */
|
||||||
extern void _ui_drawMenuTop(ui_state_t* ui_state);
|
extern void _ui_drawMenuTop(ui_state_t* ui_state);
|
||||||
extern void _ui_drawMenuBank(ui_state_t* ui_state);
|
extern void _ui_drawMenuBank(ui_state_t* ui_state);
|
||||||
|
|
@ -787,8 +785,6 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
|
||||||
case 5:
|
case 5:
|
||||||
// Cycle through radio modes
|
// Cycle through radio modes
|
||||||
if(state.channel.mode == OPMODE_FM)
|
if(state.channel.mode == OPMODE_FM)
|
||||||
state.channel.mode = OPMODE_DMR;
|
|
||||||
else if(state.channel.mode == OPMODE_DMR)
|
|
||||||
state.channel.mode = OPMODE_M17;
|
state.channel.mode = OPMODE_M17;
|
||||||
else if(state.channel.mode == OPMODE_M17)
|
else if(state.channel.mode == OPMODE_M17)
|
||||||
state.channel.mode = OPMODE_FM;
|
state.channel.mode = OPMODE_FM;
|
||||||
|
|
@ -995,7 +991,54 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
{
|
{
|
||||||
// VFO screen
|
// VFO screen
|
||||||
case MAIN_VFO:
|
case MAIN_VFO:
|
||||||
if(msg.keys & KEY_UP || msg.keys & KNOB_RIGHT)
|
// M17 Destination callsign input
|
||||||
|
if(ui_state.edit_mode)
|
||||||
|
{
|
||||||
|
if(state.channel.mode == OPMODE_M17)
|
||||||
|
{
|
||||||
|
if(msg.keys & KEY_ENTER)
|
||||||
|
{
|
||||||
|
_ui_textInputConfirm(ui_state.new_callsign);
|
||||||
|
// Save selected dst ID and disable input mode
|
||||||
|
strncpy(state.m17_data.dst_addr, ui_state.new_callsign, 10);
|
||||||
|
ui_state.edit_mode = false;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_HASH)
|
||||||
|
{
|
||||||
|
// Save selected dst ID and disable input mode
|
||||||
|
strncpy(state.m17_data.dst_addr, "", 1);
|
||||||
|
ui_state.edit_mode = false;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_ESC)
|
||||||
|
// Discard selected dst ID and disable input mode
|
||||||
|
ui_state.edit_mode = false;
|
||||||
|
else if(msg.keys & KEY_UP || msg.keys & KEY_DOWN ||
|
||||||
|
msg.keys & KEY_LEFT || msg.keys & KEY_RIGHT)
|
||||||
|
_ui_textInputDel(ui_state.new_callsign);
|
||||||
|
else if(input_isNumberPressed(msg))
|
||||||
|
_ui_textInputKeypad(ui_state.new_callsign, 9, msg, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(msg.keys & KEY_ENTER)
|
||||||
|
{
|
||||||
|
// Save current main state
|
||||||
|
ui_state.last_main_state = state.ui_screen;
|
||||||
|
// Open Menu
|
||||||
|
state.ui_screen = MENU_TOP;
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_HASH)
|
||||||
|
{
|
||||||
|
// Enable dst ID input
|
||||||
|
ui_state.edit_mode = true;
|
||||||
|
// Reset text input variables
|
||||||
|
_ui_textInputReset(ui_state.new_callsign);
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_UP || msg.keys & KNOB_RIGHT)
|
||||||
{
|
{
|
||||||
// Increment TX and RX frequency of 12.5KHz
|
// Increment TX and RX frequency of 12.5KHz
|
||||||
if(_ui_freq_check_limits(state.channel.rx_frequency + 12500) &&
|
if(_ui_freq_check_limits(state.channel.rx_frequency + 12500) &&
|
||||||
|
|
@ -1036,11 +1079,6 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
state.ui_screen = MAIN_MEM;
|
state.ui_screen = MAIN_MEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(msg.keys & KEY_F1)
|
|
||||||
{
|
|
||||||
// Switch to Digital Mode VFO screen
|
|
||||||
state.ui_screen = MODE_VFO;
|
|
||||||
}
|
|
||||||
else if(input_isNumberPressed(msg))
|
else if(input_isNumberPressed(msg))
|
||||||
{
|
{
|
||||||
// Open Frequency input screen
|
// Open Frequency input screen
|
||||||
|
|
@ -1056,6 +1094,7 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
ui_state.new_rx_frequency = _ui_freq_add_digit(ui_state.new_rx_frequency,
|
ui_state.new_rx_frequency = _ui_freq_add_digit(ui_state.new_rx_frequency,
|
||||||
ui_state.input_position, ui_state.input_number);
|
ui_state.input_position, ui_state.input_number);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
// VFO frequency input screen
|
// VFO frequency input screen
|
||||||
case MAIN_VFO_INPUT:
|
case MAIN_VFO_INPUT:
|
||||||
|
|
@ -1084,6 +1123,39 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
break;
|
break;
|
||||||
// MEM screen
|
// MEM screen
|
||||||
case MAIN_MEM:
|
case MAIN_MEM:
|
||||||
|
// M17 Destination callsign input
|
||||||
|
if(ui_state.edit_mode)
|
||||||
|
{
|
||||||
|
if(state.channel.mode == OPMODE_M17)
|
||||||
|
{
|
||||||
|
if(msg.keys & KEY_ENTER)
|
||||||
|
{
|
||||||
|
_ui_textInputConfirm(ui_state.new_callsign);
|
||||||
|
// Save selected dst ID and disable input mode
|
||||||
|
strncpy(state.m17_data.dst_addr, ui_state.new_callsign, 10);
|
||||||
|
ui_state.edit_mode = false;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_HASH)
|
||||||
|
{
|
||||||
|
// Save selected dst ID and disable input mode
|
||||||
|
strncpy(state.m17_data.dst_addr, "", 1);
|
||||||
|
ui_state.edit_mode = false;
|
||||||
|
*sync_rtx = true;
|
||||||
|
}
|
||||||
|
else if(msg.keys & KEY_ESC)
|
||||||
|
// Discard selected dst ID and disable input mode
|
||||||
|
ui_state.edit_mode = false;
|
||||||
|
else if(msg.keys & KEY_UP || msg.keys & KEY_DOWN ||
|
||||||
|
msg.keys & KEY_LEFT || msg.keys & KEY_RIGHT)
|
||||||
|
_ui_textInputDel(ui_state.new_callsign);
|
||||||
|
else if(input_isNumberPressed(msg))
|
||||||
|
_ui_textInputKeypad(ui_state.new_callsign, 9, msg, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if(msg.keys & KEY_ENTER)
|
if(msg.keys & KEY_ENTER)
|
||||||
{
|
{
|
||||||
// Save current main state
|
// Save current main state
|
||||||
|
|
@ -1100,10 +1172,12 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
// Switch to VFO screen
|
// Switch to VFO screen
|
||||||
state.ui_screen = MAIN_VFO;
|
state.ui_screen = MAIN_VFO;
|
||||||
}
|
}
|
||||||
else if(msg.keys & KEY_F1)
|
else if(msg.keys & KEY_HASH)
|
||||||
{
|
{
|
||||||
// Switch to Digital Mode MEM screen
|
// Enable dst ID input
|
||||||
state.ui_screen = MODE_MEM;
|
ui_state.edit_mode = true;
|
||||||
|
// Reset text input variables
|
||||||
|
_ui_textInputReset(ui_state.new_callsign);
|
||||||
}
|
}
|
||||||
else if(msg.keys & KEY_UP || msg.keys & KNOB_RIGHT)
|
else if(msg.keys & KEY_UP || msg.keys & KNOB_RIGHT)
|
||||||
{
|
{
|
||||||
|
|
@ -1113,155 +1187,6 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
{
|
{
|
||||||
_ui_fsm_loadChannel(state.channel_index - 1, sync_rtx);
|
_ui_fsm_loadChannel(state.channel_index - 1, sync_rtx);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
// Digital Mode VFO screen
|
|
||||||
case MODE_VFO:
|
|
||||||
if(state.channel.mode == OPMODE_M17)
|
|
||||||
{
|
|
||||||
// Dst ID input
|
|
||||||
if(ui_state.edit_mode)
|
|
||||||
{
|
|
||||||
if(msg.keys & KEY_ENTER)
|
|
||||||
{
|
|
||||||
_ui_textInputConfirm(ui_state.new_callsign);
|
|
||||||
// Save selected dst ID and disable input mode
|
|
||||||
strncpy(state.m17_data.dst_addr, ui_state.new_callsign, 10);
|
|
||||||
ui_state.edit_mode = false;
|
|
||||||
*sync_rtx = true;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_ESC)
|
|
||||||
// Discard selected dst ID and disable input mode
|
|
||||||
ui_state.edit_mode = false;
|
|
||||||
else if(msg.keys & KEY_UP || msg.keys & KEY_DOWN ||
|
|
||||||
msg.keys & KEY_LEFT || msg.keys & KEY_RIGHT)
|
|
||||||
_ui_textInputDel(ui_state.new_callsign);
|
|
||||||
else if(input_isNumberPressed(msg))
|
|
||||||
_ui_textInputKeypad(ui_state.new_callsign, 9, msg, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(msg.keys & KEY_ENTER)
|
|
||||||
{
|
|
||||||
// Save current main state
|
|
||||||
ui_state.last_main_state = state.ui_screen;
|
|
||||||
// Open Menu
|
|
||||||
state.ui_screen = MENU_TOP;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_ESC)
|
|
||||||
{
|
|
||||||
// Switch to VFO screen
|
|
||||||
state.ui_screen = MAIN_VFO;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_F1)
|
|
||||||
{
|
|
||||||
// Switch to Main VFO screen
|
|
||||||
state.ui_screen = MAIN_VFO;
|
|
||||||
}
|
|
||||||
else if(input_isNumberPressed(msg))
|
|
||||||
{
|
|
||||||
// Enable dst ID input
|
|
||||||
ui_state.edit_mode = true;
|
|
||||||
// Reset text input variables
|
|
||||||
_ui_textInputReset(ui_state.new_callsign);
|
|
||||||
// Type first character
|
|
||||||
_ui_textInputKeypad(ui_state.new_callsign, 9, msg, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(msg.keys & KEY_ENTER)
|
|
||||||
{
|
|
||||||
// Save current main state
|
|
||||||
ui_state.last_main_state = state.ui_screen;
|
|
||||||
// Open Menu
|
|
||||||
state.ui_screen = MENU_TOP;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_ESC)
|
|
||||||
{
|
|
||||||
// Switch to VFO screen
|
|
||||||
state.ui_screen = MAIN_VFO;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_F1)
|
|
||||||
{
|
|
||||||
// Switch to Main VFO screen
|
|
||||||
state.ui_screen = MAIN_VFO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
// Digital Mode MEM screen
|
|
||||||
case MODE_MEM:
|
|
||||||
if(state.channel.mode == OPMODE_M17)
|
|
||||||
{
|
|
||||||
// Dst ID input
|
|
||||||
if(ui_state.edit_mode)
|
|
||||||
{
|
|
||||||
if(msg.keys & KEY_ENTER)
|
|
||||||
{
|
|
||||||
_ui_textInputConfirm(ui_state.new_callsign);
|
|
||||||
// Save selected dst ID and disable input mode
|
|
||||||
strncpy(state.m17_data.dst_addr, ui_state.new_callsign, 10);
|
|
||||||
ui_state.edit_mode = false;
|
|
||||||
*sync_rtx = true;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_ESC)
|
|
||||||
// Discard selected dst ID and disable input mode
|
|
||||||
ui_state.edit_mode = false;
|
|
||||||
else if(msg.keys & KEY_UP || msg.keys & KEY_DOWN ||
|
|
||||||
msg.keys & KEY_LEFT || msg.keys & KEY_RIGHT)
|
|
||||||
_ui_textInputDel(ui_state.new_callsign);
|
|
||||||
else if(input_isNumberPressed(msg))
|
|
||||||
_ui_textInputKeypad(ui_state.new_callsign, 9, msg, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(msg.keys & KEY_ENTER)
|
|
||||||
{
|
|
||||||
// Save current main state
|
|
||||||
ui_state.last_main_state = state.ui_screen;
|
|
||||||
// Open Menu
|
|
||||||
state.ui_screen = MENU_TOP;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_ESC)
|
|
||||||
{
|
|
||||||
// Switch to MEM screen
|
|
||||||
state.ui_screen = MAIN_MEM;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_F1)
|
|
||||||
{
|
|
||||||
// Switch to Main MEM screen
|
|
||||||
state.ui_screen = MAIN_MEM;
|
|
||||||
}
|
|
||||||
else if(input_isNumberPressed(msg))
|
|
||||||
{
|
|
||||||
// Enable dst ID input
|
|
||||||
ui_state.edit_mode = true;
|
|
||||||
// Reset text input variables
|
|
||||||
_ui_textInputReset(ui_state.new_callsign);
|
|
||||||
// Type first character
|
|
||||||
_ui_textInputKeypad(ui_state.new_callsign, 9, msg, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(msg.keys & KEY_ENTER)
|
|
||||||
{
|
|
||||||
// Save current main state
|
|
||||||
ui_state.last_main_state = state.ui_screen;
|
|
||||||
// Open Menu
|
|
||||||
state.ui_screen = MENU_TOP;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_ESC)
|
|
||||||
{
|
|
||||||
// Switch to MEM screen
|
|
||||||
state.ui_screen = MAIN_MEM;
|
|
||||||
}
|
|
||||||
else if(msg.keys & KEY_F1)
|
|
||||||
{
|
|
||||||
// Switch to Main MEM screen
|
|
||||||
state.ui_screen = MAIN_MEM;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Top menu screen
|
// Top menu screen
|
||||||
|
|
@ -1690,7 +1615,7 @@ bool ui_updateGUI()
|
||||||
{
|
{
|
||||||
// VFO main screen
|
// VFO main screen
|
||||||
case MAIN_VFO:
|
case MAIN_VFO:
|
||||||
_ui_drawMainVFO();
|
_ui_drawMainVFO(&ui_state);
|
||||||
break;
|
break;
|
||||||
// VFO frequency input screen
|
// VFO frequency input screen
|
||||||
case MAIN_VFO_INPUT:
|
case MAIN_VFO_INPUT:
|
||||||
|
|
@ -1698,15 +1623,7 @@ bool ui_updateGUI()
|
||||||
break;
|
break;
|
||||||
// MEM main screen
|
// MEM main screen
|
||||||
case MAIN_MEM:
|
case MAIN_MEM:
|
||||||
_ui_drawMainMEM();
|
_ui_drawMainMEM(&ui_state);
|
||||||
break;
|
|
||||||
// Digital Mode VFO screen
|
|
||||||
case MODE_VFO:
|
|
||||||
_ui_drawModeVFO(&ui_state);
|
|
||||||
break;
|
|
||||||
// Digital Mode MEM screen
|
|
||||||
case MODE_MEM:
|
|
||||||
_ui_drawModeMEM(&ui_state);
|
|
||||||
break;
|
break;
|
||||||
// Top menu screen
|
// Top menu screen
|
||||||
case MENU_TOP:
|
case MENU_TOP:
|
||||||
|
|
|
||||||
|
|
@ -75,20 +75,68 @@ void _ui_drawMainTop()
|
||||||
|
|
||||||
void _ui_drawBankChannel()
|
void _ui_drawBankChannel()
|
||||||
{
|
{
|
||||||
// Print Bank name
|
// Print Bank number, channel number and Channel name
|
||||||
if(!last_state.bank_enabled)
|
uint16_t b = (last_state.bank_enabled) ? last_state.bank : 0;
|
||||||
gfx_print(layout.line1_pos, layout.line1_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line1_pos, layout.line1_font, TEXT_ALIGN_CENTER,
|
||||||
color_white, "bank: All channels");
|
color_white, "%01d-%03d: %.12s",
|
||||||
else {
|
b, last_state.channel_index + 1, last_state.channel.name);
|
||||||
bankHdr_t bank = { 0 };
|
}
|
||||||
cps_readBankHeader(&bank, last_state.bank);
|
|
||||||
gfx_print(layout.line1_pos, layout.line1_font, TEXT_ALIGN_LEFT,
|
void _ui_drawModeInfo(ui_state_t* ui_state)
|
||||||
color_white, "bank: %.13s", bank.name);
|
{
|
||||||
|
char bw_str[8] = { 0 };
|
||||||
|
char encdec_str[9] = { 0 };
|
||||||
|
|
||||||
|
rtxStatus_t cfg = rtx_getCurrentStatus();
|
||||||
|
|
||||||
|
switch(last_state.channel.mode)
|
||||||
|
{
|
||||||
|
case OPMODE_FM:
|
||||||
|
// Get Bandwidth string
|
||||||
|
if(last_state.channel.bandwidth == BW_12_5)
|
||||||
|
snprintf(bw_str, 8, "12.5");
|
||||||
|
else if(last_state.channel.bandwidth == BW_20)
|
||||||
|
snprintf(bw_str, 8, "20");
|
||||||
|
else if(last_state.channel.bandwidth == BW_25)
|
||||||
|
snprintf(bw_str, 8, "25");
|
||||||
|
// Get encdec string
|
||||||
|
bool tone_tx_enable = last_state.channel.fm.txToneEn;
|
||||||
|
bool tone_rx_enable = last_state.channel.fm.rxToneEn;
|
||||||
|
if (tone_tx_enable && tone_rx_enable)
|
||||||
|
snprintf(encdec_str, 9, "E+D");
|
||||||
|
else if (tone_tx_enable && !tone_rx_enable)
|
||||||
|
snprintf(encdec_str, 9, "E");
|
||||||
|
else if (!tone_tx_enable && tone_rx_enable)
|
||||||
|
snprintf(encdec_str, 9, "D");
|
||||||
|
else
|
||||||
|
snprintf(encdec_str, 9, " ");
|
||||||
|
|
||||||
|
// Print Bandwidth, Tone and encdec info
|
||||||
|
gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
|
color_white, "B:%s T:%4.1f S:%s",
|
||||||
|
bw_str, ctcss_tone[last_state.channel.fm.txTone]/10.0f,
|
||||||
|
encdec_str);
|
||||||
|
break;
|
||||||
|
case OPMODE_DMR:
|
||||||
|
// Print talkgroup
|
||||||
|
gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
|
color_white, "TG:%s",
|
||||||
|
"");
|
||||||
|
break;
|
||||||
|
case OPMODE_M17:
|
||||||
|
{
|
||||||
|
// Print M17 Destination ID on line 3 of 3
|
||||||
|
char *dst = NULL;
|
||||||
|
if(ui_state->edit_mode)
|
||||||
|
dst = ui_state->new_callsign;
|
||||||
|
else
|
||||||
|
dst = (!strnlen(cfg.destination_address, 10)) ?
|
||||||
|
"Broadcast" : cfg.destination_address;
|
||||||
|
gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_CENTER,
|
||||||
|
color_white, "#%s", dst);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Print Channel name
|
|
||||||
gfx_print(layout.line2_pos, layout.line2_font, TEXT_ALIGN_LEFT,
|
|
||||||
color_white, " %03d: %.12s",
|
|
||||||
last_state.channel_index + 1, last_state.channel.name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawFrequency()
|
void _ui_drawFrequency()
|
||||||
|
|
@ -195,10 +243,11 @@ void _ui_drawMainBottom()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMainVFO()
|
void _ui_drawMainVFO(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
_ui_drawMainTop();
|
_ui_drawMainTop();
|
||||||
|
_ui_drawModeInfo(ui_state);
|
||||||
_ui_drawFrequency();
|
_ui_drawFrequency();
|
||||||
_ui_drawMainBottom();
|
_ui_drawMainBottom();
|
||||||
}
|
}
|
||||||
|
|
@ -211,11 +260,12 @@ void _ui_drawMainVFOInput(ui_state_t* ui_state)
|
||||||
_ui_drawMainBottom();
|
_ui_drawMainBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _ui_drawMainMEM()
|
void _ui_drawMainMEM(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
gfx_clearScreen();
|
gfx_clearScreen();
|
||||||
_ui_drawMainTop();
|
_ui_drawMainTop();
|
||||||
_ui_drawBankChannel();
|
_ui_drawBankChannel();
|
||||||
|
_ui_drawModeInfo(ui_state);
|
||||||
_ui_drawFrequency();
|
_ui_drawFrequency();
|
||||||
_ui_drawMainBottom();
|
_ui_drawMainBottom();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,138 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2021 - 2022 by Federico Amedeo Izzo IU2NUO, *
|
|
||||||
* Niccolò Izzo IU2KIN *
|
|
||||||
* Frederik Saraci IU2NRO *
|
|
||||||
* Silvano Seva IU2KWO *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or *
|
|
||||||
* (at your option) any later version. *
|
|
||||||
* *
|
|
||||||
* This program is distributed in the hope that it will be useful, *
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
||||||
* GNU General Public License for more details. *
|
|
||||||
* *
|
|
||||||
* You should have received a copy of the GNU General Public License *
|
|
||||||
* along with this program; if not, see <http://www.gnu.org/licenses/> *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <ui.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <rtx.h>
|
|
||||||
|
|
||||||
/* UI main screen helper functions, their implementation is in "ui_main.c" */
|
|
||||||
extern void _ui_drawMainTop();
|
|
||||||
extern void _ui_drawMainBottom();
|
|
||||||
|
|
||||||
void _ui_drawModeVFOFreq()
|
|
||||||
{
|
|
||||||
// Print VFO RX Frequency on line 1 of 3
|
|
||||||
gfx_printLine(1, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_big,
|
|
||||||
TEXT_ALIGN_CENTER, color_white, "%03lu.%05lu",
|
|
||||||
(unsigned long)last_state.channel.rx_frequency/1000000,
|
|
||||||
(unsigned long)last_state.channel.rx_frequency%1000000/10);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _ui_drawMEMChannel()
|
|
||||||
{
|
|
||||||
// Print Channel name on line 1 of 3
|
|
||||||
gfx_printLine(1, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_small,
|
|
||||||
TEXT_ALIGN_CENTER, color_white, "%03d: %.12s",
|
|
||||||
last_state.channel_index, last_state.channel.name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _ui_drawModeDetails(ui_state_t* ui_state)
|
|
||||||
{
|
|
||||||
char bw_str[8] = { 0 };
|
|
||||||
char encdec_str[9] = { 0 };
|
|
||||||
|
|
||||||
rtxStatus_t cfg = rtx_getCurrentStatus();
|
|
||||||
|
|
||||||
switch(last_state.channel.mode)
|
|
||||||
{
|
|
||||||
case OPMODE_FM:
|
|
||||||
// Get Bandwith string
|
|
||||||
if(last_state.channel.bandwidth == BW_12_5)
|
|
||||||
snprintf(bw_str, 8, "12.5");
|
|
||||||
else if(last_state.channel.bandwidth == BW_20)
|
|
||||||
snprintf(bw_str, 8, "20");
|
|
||||||
else if(last_state.channel.bandwidth == BW_25)
|
|
||||||
snprintf(bw_str, 8, "25");
|
|
||||||
// Get encdec string
|
|
||||||
bool tone_tx_enable = last_state.channel.fm.txToneEn;
|
|
||||||
bool tone_rx_enable = last_state.channel.fm.rxToneEn;
|
|
||||||
if (tone_tx_enable && tone_rx_enable)
|
|
||||||
snprintf(encdec_str, 9, "E+D");
|
|
||||||
else if (tone_tx_enable && !tone_rx_enable)
|
|
||||||
snprintf(encdec_str, 9, "E");
|
|
||||||
else if (!tone_tx_enable && tone_rx_enable)
|
|
||||||
snprintf(encdec_str, 9, "D");
|
|
||||||
else
|
|
||||||
snprintf(encdec_str, 9, " ");
|
|
||||||
|
|
||||||
// Print Bandwidth info
|
|
||||||
gfx_printLine(2, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_small,
|
|
||||||
TEXT_ALIGN_LEFT, color_white, "BW:%s", bw_str);
|
|
||||||
// Print Tone and encdec info
|
|
||||||
gfx_printLine(3, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_small,
|
|
||||||
TEXT_ALIGN_LEFT, color_white, "T:%4.1f S:%s",
|
|
||||||
ctcss_tone[last_state.channel.fm.txTone]/10.0f,
|
|
||||||
encdec_str);
|
|
||||||
break;
|
|
||||||
case OPMODE_DMR:
|
|
||||||
// Print talkgroup on line 2 of 3
|
|
||||||
gfx_printLine(2, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_small,
|
|
||||||
TEXT_ALIGN_LEFT, color_white, "TG:");
|
|
||||||
// Print User ID on line 3 of 3
|
|
||||||
gfx_printLine(3, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_small,
|
|
||||||
TEXT_ALIGN_LEFT, color_white, "ID:");
|
|
||||||
break;
|
|
||||||
case OPMODE_M17:
|
|
||||||
// Print M17 Source ID on line 2 of 3
|
|
||||||
gfx_printLine(2, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_small,
|
|
||||||
TEXT_ALIGN_LEFT, color_white, "Src ID: %s", cfg.source_address);
|
|
||||||
// Print M17 Destination ID on line 3 of 3
|
|
||||||
if(ui_state->edit_mode)
|
|
||||||
{
|
|
||||||
gfx_printLine(3, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_small,
|
|
||||||
TEXT_ALIGN_LEFT, color_white, "Dst ID: %s_", ui_state->new_callsign);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gfx_printLine(3, 3, layout.top_h, SCREEN_HEIGHT - layout.bottom_h,
|
|
||||||
layout.horizontal_pad, layout.mode_font_small,
|
|
||||||
TEXT_ALIGN_LEFT, color_white, "Dst ID: %s", cfg.destination_address);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _ui_drawModeVFO(ui_state_t* ui_state)
|
|
||||||
{
|
|
||||||
gfx_clearScreen();
|
|
||||||
_ui_drawMainTop();
|
|
||||||
_ui_drawModeVFOFreq();
|
|
||||||
_ui_drawModeDetails(ui_state);
|
|
||||||
_ui_drawMainBottom();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _ui_drawModeMEM(ui_state_t* ui_state)
|
|
||||||
{
|
|
||||||
gfx_clearScreen();
|
|
||||||
_ui_drawMainTop();
|
|
||||||
_ui_drawMEMChannel();
|
|
||||||
_ui_drawModeDetails(ui_state);
|
|
||||||
_ui_drawMainBottom();
|
|
||||||
}
|
|
||||||
Ładowanie…
Reference in New Issue