diff --git a/openrtx/src/ui/ui.c b/openrtx/src/ui/ui.c index fe7ec405..ed3ab268 100644 --- a/openrtx/src/ui/ui.c +++ b/openrtx/src/ui/ui.c @@ -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 diff --git a/openrtx/src/ui/ui_menu.c b/openrtx/src/ui/ui_menu.c index 3183e829..f413e7b4 100644 --- a/openrtx/src/ui/ui_menu.c +++ b/openrtx/src/ui/ui_menu.c @@ -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] = ""; diff --git a/platform/drivers/baseband/radio_MD3x0.cpp b/platform/drivers/baseband/radio_MD3x0.cpp index 015934a5..ec4db682 100644 --- a/platform/drivers/baseband/radio_MD3x0.cpp +++ b/platform/drivers/baseband/radio_MD3x0.cpp @@ -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 } diff --git a/platform/drivers/baseband/radio_UV3x0.cpp b/platform/drivers/baseband/radio_UV3x0.cpp index 54d2db9a..19da6efc 100644 --- a/platform/drivers/baseband/radio_UV3x0.cpp +++ b/platform/drivers/baseband/radio_UV3x0.cpp @@ -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); }