ui: refactor CTCSS entries in macro menu to be more user friendly
This change makes it so that the macro menu shows the current tone and change the tone setting with macro 1, then change tone frequency with macro 2 and 3. This is a clearer UX. Co-authored-by: Ryan Turner <ryan@turnrye.com> Acked-by: Silvano Seva <silseva@fastwebnet.it>
This commit is contained in:
parent
a30dae357d
commit
2df9addccc
|
|
@ -913,6 +913,22 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
|
|||
switch(ui_state.input_number)
|
||||
{
|
||||
case 1:
|
||||
if(state.channel.mode == OPMODE_FM)
|
||||
{
|
||||
tone_flags++;
|
||||
tone_flags %= 4;
|
||||
tone_tx_enable = tone_flags >> 1;
|
||||
tone_rx_enable = tone_flags & 1;
|
||||
state.channel.fm.txToneEn = tone_tx_enable;
|
||||
state.channel.fm.rxToneEn = tone_rx_enable;
|
||||
*sync_rtx = true;
|
||||
vp_announceCTCSS(
|
||||
state.channel.fm.rxToneEn, state.channel.fm.rxTone,
|
||||
state.channel.fm.txToneEn, state.channel.fm.txTone,
|
||||
queueFlags | vpqIncludeDescriptions);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (state.channel.mode == OPMODE_FM)
|
||||
{
|
||||
if (state.channel.fm.txTone == 0)
|
||||
|
|
@ -935,30 +951,13 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
|
|||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
if(state.channel.mode == OPMODE_FM)
|
||||
{
|
||||
state.channel.fm.txTone++;
|
||||
state.channel.fm.txTone %= CTCSS_FREQ_NUM;
|
||||
state.channel.fm.rxTone = state.channel.fm.txTone;
|
||||
*sync_rtx = true;
|
||||
vp_announceCTCSS(state.channel.fm.rxToneEn,
|
||||
state.channel.fm.rxTone,
|
||||
state.channel.fm.txToneEn,
|
||||
state.channel.fm.txTone,
|
||||
queueFlags);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(state.channel.mode == OPMODE_FM)
|
||||
{
|
||||
tone_flags++;
|
||||
tone_flags %= 4;
|
||||
tone_tx_enable = tone_flags >> 1;
|
||||
tone_rx_enable = tone_flags & 1;
|
||||
state.channel.fm.txToneEn = tone_tx_enable;
|
||||
state.channel.fm.rxToneEn = tone_rx_enable;
|
||||
*sync_rtx = true;
|
||||
vp_announceCTCSS(state.channel.fm.rxToneEn,
|
||||
state.channel.fm.rxTone,
|
||||
state.channel.fm.txToneEn,
|
||||
|
|
@ -2356,6 +2355,7 @@ void ui_updateFSM(bool *sync_rtx)
|
|||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case SETTINGS_ACCESSIBILITY:
|
||||
if(msg.keys & KEY_LEFT || (ui_state.edit_mode &&
|
||||
(msg.keys & KEY_DOWN || msg.keys & KNOB_LEFT)))
|
||||
|
|
|
|||
|
|
@ -1100,18 +1100,31 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
|||
#endif // CONFIG_UI_NO_KEYBOARD
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||
yellow_fab413, "1");
|
||||
|
||||
if (last_state.channel.mode == OPMODE_FM)
|
||||
{
|
||||
char encdec_str[9] = {0};
|
||||
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)
|
||||
sniprintf(encdec_str, 9, " B ");
|
||||
else if (tone_tx_enable && !tone_rx_enable)
|
||||
sniprintf(encdec_str, 9, " E ");
|
||||
else if (!tone_tx_enable && tone_rx_enable)
|
||||
sniprintf(encdec_str, 9, " D ");
|
||||
else
|
||||
sniprintf(encdec_str, 9, " N ");
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||
color_white, encdec_str);
|
||||
uint16_t tone = ctcss_tone[last_state.channel.fm.txTone];
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||
color_white, " T- %d.%d", (tone / 10), (tone % 10));
|
||||
|
||||
color_white, " %d.%d", (tone / 10), (tone % 10));
|
||||
#if defined(CONFIG_UI_NO_KEYBOARD)
|
||||
if (ui_state->macro_menu_selected == 1)
|
||||
#endif // CONFIG_UI_NO_KEYBOARD
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||
yellow_fab413, "2");
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||
color_white, " T+");
|
||||
color_white, " T-");
|
||||
}
|
||||
#ifdef CONFIG_M17
|
||||
else if (last_state.channel.mode == OPMODE_M17)
|
||||
|
|
@ -1129,22 +1142,8 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
|||
#endif // CONFIG_UI_NO_KEYBOARD
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||
yellow_fab413, "3 ");
|
||||
|
||||
if (last_state.channel.mode == OPMODE_FM)
|
||||
{
|
||||
char encdec_str[9] = { 0 };
|
||||
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)
|
||||
sniprintf(encdec_str, 9, " E+D");
|
||||
else if (tone_tx_enable && !tone_rx_enable)
|
||||
sniprintf(encdec_str, 9, " E ");
|
||||
else if (!tone_tx_enable && tone_rx_enable)
|
||||
sniprintf(encdec_str, 9, " D ");
|
||||
else
|
||||
sniprintf(encdec_str, 9, " ");
|
||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||
color_white, encdec_str);
|
||||
color_white, " T+");
|
||||
}
|
||||
#ifdef CONFIG_M17
|
||||
else if (last_state.channel.mode == OPMODE_M17)
|
||||
|
|
@ -1201,14 +1200,14 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
|||
switch(last_state.channel.mode)
|
||||
{
|
||||
case OPMODE_FM:
|
||||
sniprintf(mode_str, 12," FM");
|
||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER, color_white, " FM");
|
||||
break;
|
||||
case OPMODE_DMR:
|
||||
sniprintf(mode_str, 12," DMR");
|
||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER, color_white, " DMR");
|
||||
break;
|
||||
#ifdef CONFIG_M17
|
||||
case OPMODE_M17:
|
||||
sniprintf(mode_str, 12," M17");
|
||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER, color_white, " M17");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue