Disable CTCSS tones in M17 mode

Removed CTCSS modulation for M17 mode, removed FM analog specific
settings in macro menu such as tone selection, tone enable and tx
bandwidth.
This commit is contained in:
Niccolò Izzo 2021-07-04 16:09:31 +02:00
parent dc346497d0
commit 65a632054a
4 changed files with 80 additions and 45 deletions

View File

@ -649,19 +649,25 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) {
switch(ui_state.input_number)
{
case 1:
state.channel.fm.txTone++;
state.channel.fm.txTone %= MAX_TONE_INDEX;
state.channel.fm.rxTone = state.channel.fm.txTone;
*sync_rtx = true;
if(state.channel.mode == 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 2:
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;
if(state.channel.mode == 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;
}
break;
case 3:
if (state.channel.power == 1.0f)
@ -671,9 +677,12 @@ void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) {
*sync_rtx = true;
break;
case 4:
state.channel.bandwidth++;
state.channel.bandwidth %= 3;
*sync_rtx = true;
if(state.channel.mode == FM)
{
state.channel.bandwidth++;
state.channel.bandwidth %= 3;
*sync_rtx = true;
}
break;
case 5:
// Cycle through radio modes

View File

@ -550,24 +550,41 @@ bool _ui_drawMacroMenu() {
// First row
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,
color_white, " %6.1f",
ctcss_tone[last_state.channel.fm.txTone]/10.0f);
if (last_state.channel.mode == FM)
{
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " %6.1f",
ctcss_tone[last_state.channel.fm.txTone]/10.0f);
}
else if (last_state.channel.mode == M17)
{
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " ");
}
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
yellow_fab413, "2 ");
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_CENTER,
color_white, encdec_str);
if (last_state.channel.mode == 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_CENTER,
color_white, encdec_str);
}
else if (last_state.channel.mode == M17)
{
char encdec_str[9] = " ";
gfx_print(layout.line1_pos, layout.top_font, TEXT_ALIGN_CENTER,
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,
@ -578,21 +595,30 @@ bool _ui_drawMacroMenu() {
(layout.line3_pos.y - layout.line1_pos.y)/2};
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
yellow_fab413, "4");
char bw_str[8] = { 0 };
switch (last_state.channel.bandwidth)
if (last_state.channel.mode == FM)
{
case BW_12_5:
snprintf(bw_str, 8, " 12.5");
break;
case BW_20:
snprintf(bw_str, 8, " 20");
break;
case BW_25:
snprintf(bw_str, 8, " 25");
break;
char bw_str[8] = { 0 };
switch (last_state.channel.bandwidth)
{
case BW_12_5:
snprintf(bw_str, 8, " 12.5");
break;
case BW_20:
snprintf(bw_str, 8, " 20");
break;
case BW_25:
snprintf(bw_str, 8, " 25");
break;
}
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
color_white, bw_str);
}
else if (last_state.channel.mode == M17)
{
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
color_white, " ");
}
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_LEFT,
color_white, bw_str);
gfx_print(pos_2, layout.top_font, TEXT_ALIGN_CENTER,
yellow_fab413, "5 ");
char mode_str[9] = "";

View File

@ -300,7 +300,7 @@ void radio_enableTx()
gpio_setPin(TX_STG_EN); // Enable TX PA
if(config->txToneEn == 1)
if(config->opMode == FM && config->txToneEn == 1)
{
toneGen_toneOn(); // Enable CTSS
}

View File

@ -222,7 +222,7 @@ void radio_enableTx()
gpio_setPin(PA_EN_2);
if(config->txToneEn)
if(config.opMode == FM && config->txToneEn)
{
at1846s.enableTxCtcss(config->txTone);
}