Add FM tone decrease Macro

Reorganize macro menu buttons to enable tone decrease and eliminate
channel save as it was not yet implemented.
This commit is contained in:
Niccolò Izzo 2022-09-25 20:55:35 +02:00
parent d395afd370
commit 5ff74aaaa7
2 changed files with 49 additions and 31 deletions

View File

@ -756,6 +756,15 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
} }
break; break;
case 2: case 2:
if(state.channel.mode == OPMODE_FM)
{
state.channel.fm.txTone--;
state.channel.fm.txTone %= MAX_TONE_INDEX;
state.channel.fm.rxTone = state.channel.fm.txTone;
*sync_rtx = true;
}
break;
case 3:
if(state.channel.mode == OPMODE_FM) if(state.channel.mode == OPMODE_FM)
{ {
tone_flags++; tone_flags++;
@ -767,13 +776,6 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
*sync_rtx = true; *sync_rtx = true;
} }
break; break;
case 3:
if (state.channel.power == 100)
state.channel.power = 135;
else
state.channel.power = 100;
*sync_rtx = true;
break;
case 4: case 4:
if(state.channel.mode == OPMODE_FM) if(state.channel.mode == OPMODE_FM)
{ {
@ -789,7 +791,14 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
else if(state.channel.mode == OPMODE_M17) else if(state.channel.mode == OPMODE_M17)
state.channel.mode = OPMODE_FM; state.channel.mode = OPMODE_FM;
*sync_rtx = true; *sync_rtx = true;
case 6:
if (state.channel.power == 100)
state.channel.power = 135;
else
state.channel.power = 100;
*sync_rtx = true;
break; break;
break;
case 7: case 7:
_ui_changeBrightness(+5); _ui_changeBrightness(+5);
break; break;

View File

@ -668,21 +668,31 @@ bool _ui_drawMacroMenu()
gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, "Macro Menu"); color_white, "Macro Menu");
// First row // First row
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
yellow_fab413, "1");
if (last_state.channel.mode == OPMODE_FM) if (last_state.channel.mode == OPMODE_FM)
{ {
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " %6.1f", yellow_fab413, "1");
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " T+");
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " %7.1f",
ctcss_tone[last_state.channel.fm.txTone]/10.0f); ctcss_tone[last_state.channel.fm.txTone]/10.0f);
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-");
} }
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,
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,
yellow_fab413, "2 ");
} }
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
yellow_fab413, "2 "); yellow_fab413, "3 ");
if (last_state.channel.mode == OPMODE_FM) if (last_state.channel.mode == OPMODE_FM)
{ {
char encdec_str[9] = { 0 }; char encdec_str[9] = { 0 };
@ -696,7 +706,7 @@ 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_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
color_white, encdec_str); color_white, encdec_str);
} }
else if (last_state.channel.mode == OPMODE_M17) else if (last_state.channel.mode == OPMODE_M17)
@ -705,10 +715,6 @@ bool _ui_drawMacroMenu()
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, encdec_str); color_white, encdec_str);
} }
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
yellow_fab413, "3 ");
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_RIGHT,
color_white, "%.1gW", dBmToWatt(last_state.channel.power));
// Second row // Second row
// Calculate symmetric second row position, line2_pos is asymmetric like main screen // Calculate symmetric second row position, line2_pos is asymmetric like main screen
point_t pos_2 = {layout.line1_pos.x, layout.line1_pos.y + point_t pos_2 = {layout.line1_pos.x, layout.line1_pos.y +
@ -717,17 +723,17 @@ bool _ui_drawMacroMenu()
yellow_fab413, "4"); yellow_fab413, "4");
if (last_state.channel.mode == OPMODE_FM) if (last_state.channel.mode == OPMODE_FM)
{ {
char bw_str[8] = { 0 }; char bw_str[12] = { 0 };
switch (last_state.channel.bandwidth) switch (last_state.channel.bandwidth)
{ {
case BW_12_5: case BW_12_5:
snprintf(bw_str, 8, " 12.5"); snprintf(bw_str, 12, " BW 12.5");
break; break;
case BW_20: case BW_20:
snprintf(bw_str, 8, " 20"); snprintf(bw_str, 12, " BW 20 ");
break; break;
case BW_25: case BW_25:
snprintf(bw_str, 8, " 25"); snprintf(bw_str, 12, " BW 25 ");
break; break;
} }
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
@ -740,18 +746,18 @@ bool _ui_drawMacroMenu()
} }
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER,
yellow_fab413, "5 "); yellow_fab413, "5");
char mode_str[9] = ""; char mode_str[12] = "";
switch(last_state.channel.mode) switch(last_state.channel.mode)
{ {
case OPMODE_FM: case OPMODE_FM:
snprintf(mode_str, 9," FM"); snprintf(mode_str, 12," FM");
break; break;
case OPMODE_DMR: case OPMODE_DMR:
snprintf(mode_str, 9," DMR"); snprintf(mode_str, 12," DMR");
break; break;
case OPMODE_M17: case OPMODE_M17:
snprintf(mode_str, 9," M17"); snprintf(mode_str, 12," M17");
break; break;
} }
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER,
@ -759,20 +765,23 @@ bool _ui_drawMacroMenu()
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT, gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT,
yellow_fab413, "6 "); yellow_fab413, "6 ");
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT, gfx_print(pos_2, layout.top_font, TEXT_ALIGN_RIGHT,
color_white, "Lck"); color_white, "%.1gW", dBmToWatt(last_state.channel.power));
// Third row // Third row
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
yellow_fab413, "7"); yellow_fab413, "7");
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT, gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " B+"); color_white, " B+");
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " %5d",
state.settings.brightness);
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER,
yellow_fab413, "8 "); yellow_fab413, "8");
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER, gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER,
color_white, " B-"); color_white, " B-");
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT, gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT,
yellow_fab413, "9 "); yellow_fab413, "9 ");
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT, gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT,
color_white, "Sav"); color_white, "Lck");
// Draw S-meter bar // Draw S-meter bar
_ui_drawMainBottom(); _ui_drawMainBottom();