kopia lustrzana https://github.com/OpenRTX/OpenRTX
Improved indentation in _ui_drawMacroMenu()
rodzic
c3f1ec0ea1
commit
f771d4ec06
|
@ -1014,164 +1014,176 @@ void _ui_drawMacroTop()
|
||||||
|
|
||||||
bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
bool _ui_drawMacroMenu(ui_state_t* ui_state)
|
||||||
{
|
{
|
||||||
// Header
|
// Header
|
||||||
_ui_drawMacroTop();
|
_ui_drawMacroTop();
|
||||||
// First row
|
// First row
|
||||||
if (last_state.channel.mode == OPMODE_FM)
|
if (last_state.channel.mode == OPMODE_FM)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If we have a keyboard installed draw all numbers, otherwise draw only the
|
* If we have a keyboard installed draw all numbers, otherwise draw only the
|
||||||
* currently selected number.
|
* currently selected number.
|
||||||
*/
|
*/
|
||||||
#if defined(UI_NO_KEYBOARD)
|
#if defined(UI_NO_KEYBOARD)
|
||||||
if (ui_state->macro_menu_selected == 0)
|
if (ui_state->macro_menu_selected == 0)
|
||||||
#endif // UI_NO_KEYBOARD
|
#endif // UI_NO_KEYBOARD
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
yellow_fab413, "1");
|
yellow_fab413, "1");
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white, " T-");
|
color_white, " T-");
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white, " %7.1f",
|
color_white, " %7.1f",
|
||||||
ctcss_tone[last_state.channel.fm.txTone]/10.0f);
|
ctcss_tone[last_state.channel.fm.txTone]/10.0f);
|
||||||
#if defined(UI_NO_KEYBOARD)
|
#if defined(UI_NO_KEYBOARD)
|
||||||
if (ui_state->macro_menu_selected == 1)
|
if (ui_state->macro_menu_selected == 1)
|
||||||
#endif // UI_NO_KEYBOARD
|
#endif // UI_NO_KEYBOARD
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
yellow_fab413, "2");
|
yellow_fab413, "2");
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
color_white, " T+");
|
color_white, " T+");
|
||||||
}
|
}
|
||||||
else if (last_state.channel.mode == OPMODE_M17)
|
else if (last_state.channel.mode == OPMODE_M17)
|
||||||
{
|
{
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
yellow_fab413, "1");
|
yellow_fab413, "1");
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white, " ");
|
color_white, " ");
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
yellow_fab413, "2");
|
yellow_fab413, "2");
|
||||||
}
|
}
|
||||||
#if defined(UI_NO_KEYBOARD)
|
#if defined(UI_NO_KEYBOARD)
|
||||||
if (ui_state->macro_menu_selected == 2)
|
if (ui_state->macro_menu_selected == 2)
|
||||||
#endif // UI_NO_KEYBOARD
|
#endif // UI_NO_KEYBOARD
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
yellow_fab413, "3 ");
|
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)
|
|
||||||
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, " ");
|
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
|
||||||
color_white, encdec_str);
|
|
||||||
}
|
|
||||||
else if (last_state.channel.mode == OPMODE_M17)
|
|
||||||
{
|
|
||||||
char encdec_str[9] = " ";
|
|
||||||
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
|
||||||
color_white, encdec_str);
|
|
||||||
}
|
|
||||||
// Second row
|
|
||||||
// Calculate symmetric second row position, line2_pos is asymmetric like main screen
|
|
||||||
point_t pos_2 = {layout.line1_pos.x, layout.line1_pos.y +
|
|
||||||
(layout.line3_large_pos.y - layout.line1_pos.y)/2};
|
|
||||||
#if defined(UI_NO_KEYBOARD)
|
|
||||||
if (ui_state->macro_menu_selected == 3)
|
|
||||||
#endif // UI_NO_KEYBOARD
|
|
||||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
|
|
||||||
yellow_fab413, "4");
|
|
||||||
if (last_state.channel.mode == OPMODE_FM)
|
|
||||||
{
|
|
||||||
char bw_str[12] = { 0 };
|
|
||||||
switch (last_state.channel.bandwidth)
|
|
||||||
{
|
|
||||||
case BW_12_5:
|
|
||||||
snprintf(bw_str, 12, " BW 12.5");
|
|
||||||
break;
|
|
||||||
case BW_20:
|
|
||||||
snprintf(bw_str, 12, " BW 20 ");
|
|
||||||
break;
|
|
||||||
case BW_25:
|
|
||||||
snprintf(bw_str, 12, " BW 25 ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
|
|
||||||
color_white, bw_str);
|
|
||||||
}
|
|
||||||
else if (last_state.channel.mode == OPMODE_M17)
|
|
||||||
{
|
|
||||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
|
|
||||||
color_white, " ");
|
|
||||||
|
|
||||||
}
|
if (last_state.channel.mode == OPMODE_FM)
|
||||||
#if defined(UI_NO_KEYBOARD)
|
{
|
||||||
if (ui_state->macro_menu_selected == 4)
|
char encdec_str[9] = { 0 };
|
||||||
#endif // UI_NO_KEYBOARD
|
bool tone_tx_enable = last_state.channel.fm.txToneEn;
|
||||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER,
|
bool tone_rx_enable = last_state.channel.fm.rxToneEn;
|
||||||
yellow_fab413, "5");
|
if (tone_tx_enable && tone_rx_enable)
|
||||||
char mode_str[12] = "";
|
snprintf(encdec_str, 9, " E+D");
|
||||||
switch(last_state.channel.mode)
|
else if (tone_tx_enable && !tone_rx_enable)
|
||||||
{
|
snprintf(encdec_str, 9, " E ");
|
||||||
case OPMODE_FM:
|
else if (!tone_tx_enable && tone_rx_enable)
|
||||||
snprintf(mode_str, 12," FM");
|
snprintf(encdec_str, 9, " D ");
|
||||||
break;
|
|
||||||
case OPMODE_DMR:
|
|
||||||
snprintf(mode_str, 12," DMR");
|
|
||||||
break;
|
|
||||||
case OPMODE_M17:
|
|
||||||
snprintf(mode_str, 12," M17");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER,
|
|
||||||
color_white, mode_str);
|
|
||||||
#if defined(UI_NO_KEYBOARD)
|
|
||||||
if (ui_state->macro_menu_selected == 5)
|
|
||||||
#endif // UI_NO_KEYBOARD
|
|
||||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT,
|
|
||||||
yellow_fab413, "6 ");
|
|
||||||
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT,
|
|
||||||
color_white, "%.1gW", dBmToWatt(last_state.channel.power));
|
|
||||||
// Third row
|
|
||||||
#if defined(UI_NO_KEYBOARD)
|
|
||||||
if (ui_state->macro_menu_selected == 6)
|
|
||||||
#endif // UI_NO_KEYBOARD
|
|
||||||
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
|
||||||
yellow_fab413, "7");
|
|
||||||
#ifdef SCREEN_BRIGHTNESS
|
|
||||||
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
|
||||||
color_white, " B-");
|
|
||||||
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
|
||||||
color_white, " %5d",
|
|
||||||
state.settings.brightness);
|
|
||||||
#endif
|
|
||||||
#if defined(UI_NO_KEYBOARD)
|
|
||||||
if (ui_state->macro_menu_selected == 7)
|
|
||||||
#endif // UI_NO_KEYBOARD
|
|
||||||
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
|
||||||
yellow_fab413, "8");
|
|
||||||
#ifdef SCREEN_BRIGHTNESS
|
|
||||||
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
|
||||||
color_white, " B+");
|
|
||||||
#endif
|
|
||||||
#if defined(UI_NO_KEYBOARD)
|
|
||||||
if (ui_state->macro_menu_selected == 8)
|
|
||||||
#endif // UI_NO_KEYBOARD
|
|
||||||
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
|
||||||
yellow_fab413, "9 ");
|
|
||||||
if( ui_state->input_locked == true )
|
|
||||||
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
|
||||||
color_white, "Unlk");
|
|
||||||
else
|
else
|
||||||
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
snprintf(encdec_str, 9, " ");
|
||||||
color_white, "Lck");
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
|
color_white, encdec_str);
|
||||||
|
}
|
||||||
|
else if (last_state.channel.mode == OPMODE_M17)
|
||||||
|
{
|
||||||
|
char encdec_str[9] = " ";
|
||||||
|
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
|
color_white, encdec_str);
|
||||||
|
}
|
||||||
|
|
||||||
// Draw S-meter bar
|
// Second row
|
||||||
_ui_drawMainBottom();
|
// Calculate symmetric second row position, line2_pos is asymmetric like main screen
|
||||||
return true;
|
point_t pos_2 = {layout.line1_pos.x, layout.line1_pos.y +
|
||||||
|
(layout.line3_large_pos.y - layout.line1_pos.y)/2};
|
||||||
|
|
||||||
|
#if defined(UI_NO_KEYBOARD)
|
||||||
|
if (ui_state->macro_menu_selected == 3)
|
||||||
|
#endif // UI_NO_KEYBOARD
|
||||||
|
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
|
yellow_fab413, "4");
|
||||||
|
|
||||||
|
if (last_state.channel.mode == OPMODE_FM)
|
||||||
|
{
|
||||||
|
char bw_str[12] = { 0 };
|
||||||
|
switch (last_state.channel.bandwidth)
|
||||||
|
{
|
||||||
|
case BW_12_5:
|
||||||
|
snprintf(bw_str, 12, " BW 12.5");
|
||||||
|
break;
|
||||||
|
case BW_20:
|
||||||
|
snprintf(bw_str, 12, " BW 20 ");
|
||||||
|
break;
|
||||||
|
case BW_25:
|
||||||
|
snprintf(bw_str, 12, " BW 25 ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
|
color_white, bw_str);
|
||||||
|
}
|
||||||
|
else if (last_state.channel.mode == OPMODE_M17)
|
||||||
|
{
|
||||||
|
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
|
color_white, " ");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(UI_NO_KEYBOARD)
|
||||||
|
if (ui_state->macro_menu_selected == 4)
|
||||||
|
#endif // UI_NO_KEYBOARD
|
||||||
|
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
|
yellow_fab413, "5");
|
||||||
|
|
||||||
|
char mode_str[12] = "";
|
||||||
|
switch(last_state.channel.mode)
|
||||||
|
{
|
||||||
|
case OPMODE_FM:
|
||||||
|
snprintf(mode_str, 12," FM");
|
||||||
|
break;
|
||||||
|
case OPMODE_DMR:
|
||||||
|
snprintf(mode_str, 12," DMR");
|
||||||
|
break;
|
||||||
|
case OPMODE_M17:
|
||||||
|
snprintf(mode_str, 12," M17");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
|
color_white, mode_str);
|
||||||
|
|
||||||
|
#if defined(UI_NO_KEYBOARD)
|
||||||
|
if (ui_state->macro_menu_selected == 5)
|
||||||
|
#endif // UI_NO_KEYBOARD
|
||||||
|
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
|
yellow_fab413, "6 ");
|
||||||
|
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
|
color_white, "%.1gW", dBmToWatt(last_state.channel.power));
|
||||||
|
|
||||||
|
// Third row
|
||||||
|
#if defined(UI_NO_KEYBOARD)
|
||||||
|
if (ui_state->macro_menu_selected == 6)
|
||||||
|
#endif // UI_NO_KEYBOARD
|
||||||
|
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
|
yellow_fab413, "7");
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
|
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
|
color_white, " B-");
|
||||||
|
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
|
color_white, " %5d",
|
||||||
|
state.settings.brightness);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(UI_NO_KEYBOARD)
|
||||||
|
if (ui_state->macro_menu_selected == 7)
|
||||||
|
#endif // UI_NO_KEYBOARD
|
||||||
|
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
|
yellow_fab413, "8");
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
|
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
|
color_white, " B+");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(UI_NO_KEYBOARD)
|
||||||
|
if (ui_state->macro_menu_selected == 8)
|
||||||
|
#endif // UI_NO_KEYBOARD
|
||||||
|
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
|
yellow_fab413, "9 ");
|
||||||
|
if( ui_state->input_locked == true )
|
||||||
|
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
|
color_white, "Unlk");
|
||||||
|
else
|
||||||
|
gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
|
color_white, "Lck");
|
||||||
|
|
||||||
|
// Draw S-meter bar
|
||||||
|
_ui_drawMainBottom();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue