ttwrplus: disable Tx in menus

As T-TWR Plus reuses the PTT as a back button, thus we need to disable
PTT in menus. Also enforce rx_only logic from CPS.

TG-553
pull/193/head
Niccolò Izzo 2023-09-10 22:57:04 +02:00 zatwierdzone przez Silvano Seva
rodzic 7619b9473b
commit 21895ae304
5 zmienionych plików z 27 dodań i 1 usunięć

Wyświetl plik

@ -59,6 +59,7 @@ typedef struct
bool backup_eflash;
bool restore_eflash;
char m17_dest[10];
bool txDisable;
}
state_t;

Wyświetl plik

@ -32,6 +32,7 @@ channel_t cps_getDefaultChannel()
#endif
channel.bandwidth = BW_25;
channel.power = 100; // 1W, P = 10dBm + n*0.2dBm, we store n
channel.rx_only = false; // Enable tx by default
// Set initial frequency based on supported bands
const hwInfo_t* hwinfo = platform_getHwInfo();

Wyświetl plik

@ -71,6 +71,7 @@ void state_init()
state.bank_enabled = false;
state.rtxStatus = RTX_OFF;
state.emergency = false;
state.txDisable = false;
// Force brightness field to be in range 0 - 100
if(state.settings.brightness > 100)

Wyświetl plik

@ -100,7 +100,10 @@ void *ui_threadFunc(void *arg)
rtx_cfg.txToneEn = state.channel.fm.txToneEn;
rtx_cfg.txTone = ctcss_tone[state.channel.fm.txTone];
// Copy new M17 CAN, M17 CAN RX check,source and destination addresses
// Enable Tx if channel allows it and we are in UI main screen
rtx_cfg.txDisable = state.channel.rx_only || state.txDisable;
// Copy new M17 CAN, source and destination addresses
rtx_cfg.can = state.settings.m17_can;
rtx_cfg.canRxEn = state.settings.m17_can_rx;
strncpy(rtx_cfg.source_address, state.settings.callsign, 10);

Wyświetl plik

@ -1324,6 +1324,12 @@ void ui_updateFSM(bool *sync_rtx)
{
// VFO screen
case MAIN_VFO:
// Enable Tx in MAIN_VFO mode
if (state.txDisable)
{
state.txDisable = false;
*sync_rtx = true;
}
// M17 Destination callsign input
if(ui_state.edit_mode)
{
@ -1494,6 +1500,12 @@ void ui_updateFSM(bool *sync_rtx)
break;
// MEM screen
case MAIN_MEM:
// Enable Tx in MAIN_MEM mode
if (state.txDisable)
{
state.txDisable = false;
*sync_rtx = true;
}
// M17 Destination callsign input
if(ui_state.edit_mode)
{
@ -2141,6 +2153,14 @@ void ui_updateFSM(bool *sync_rtx)
}
break;
}
// Enable Tx only if in MAIN_VFO or MAIN_MEM states
bool inMemOrVfo = (state.ui_screen == MAIN_VFO) || (state.ui_screen == MAIN_MEM);
if ((macro_menu == true) || ((inMemOrVfo == false) && (state.txDisable == false)))
{
state.txDisable = true;
*sync_rtx = true;
}
if (!f1Handled && (msg.keys & KEY_F1) && (state.settings.vpLevel > vpBeep))
{
vp_replayLastPrompt();