kopia lustrzana https://github.com/OpenRTX/OpenRTX
Module17: hide menu entries for soft potentiometers if hardware does not have them
rodzic
e50b8ce80c
commit
84d9803f57
|
@ -129,13 +129,13 @@ enum m17Items
|
|||
|
||||
enum module17Items
|
||||
{
|
||||
D_TXWIPER = 0,
|
||||
D_RXWIPER,
|
||||
D_MICGAIN = 0,
|
||||
D_PTTINLEVEL,
|
||||
D_PTTOUTLEVEL,
|
||||
D_TXINVERT,
|
||||
D_RXINVERT,
|
||||
D_MICGAIN,
|
||||
D_PTTINLEVEL,
|
||||
D_PTTOUTLEVEL
|
||||
D_TXWIPER,
|
||||
D_RXWIPER
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -100,13 +100,13 @@ const char *m17_items[] =
|
|||
|
||||
const char *module17_items[] =
|
||||
{
|
||||
"TX Softpot",
|
||||
"RX Softpot",
|
||||
"TX Phase",
|
||||
"RX Phase",
|
||||
"Mic Gain",
|
||||
"PTT In",
|
||||
"PTT Out"
|
||||
"PTT Out",
|
||||
"TX Phase",
|
||||
"RX Phase",
|
||||
"TX Softpot",
|
||||
"RX Softpot"
|
||||
};
|
||||
|
||||
#ifdef CONFIG_GPS
|
||||
|
@ -388,12 +388,17 @@ static void _ui_changeMicGain(int variation)
|
|||
static void _ui_menuUp(uint8_t menu_entries)
|
||||
{
|
||||
uint8_t maxEntries = menu_entries - 1;
|
||||
uint8_t ver = platform_getHwInfo()->hw_version;
|
||||
const hwInfo_t* hwinfo = platform_getHwInfo();
|
||||
|
||||
// Hide the "shutdown" main menu entry for versions lower than 0.1e
|
||||
if((ver < 1) && (state.ui_screen == MENU_TOP))
|
||||
if((hwinfo->hw_version < 1) && (state.ui_screen == MENU_TOP))
|
||||
maxEntries -= 1;
|
||||
|
||||
// Hide the softpot menu entries if hardware does not have them
|
||||
uint8_t softpot = hwinfo->flags & MOD17_FLAGS_SOFTPOT;
|
||||
if((softpot == 0) && (state.ui_screen == SETTINGS_MODULE17))
|
||||
maxEntries -= 2;
|
||||
|
||||
if(ui_state.menu_selected > 0)
|
||||
ui_state.menu_selected -= 1;
|
||||
else
|
||||
|
@ -403,12 +408,17 @@ static void _ui_menuUp(uint8_t menu_entries)
|
|||
static void _ui_menuDown(uint8_t menu_entries)
|
||||
{
|
||||
uint8_t maxEntries = menu_entries - 1;
|
||||
uint8_t ver = platform_getHwInfo()->hw_version;
|
||||
const hwInfo_t* hwinfo = platform_getHwInfo();
|
||||
|
||||
// Hide the "shutdown" main menu entry for versions lower than 0.1e
|
||||
if((ver < 1) && (state.ui_screen == MENU_TOP))
|
||||
if((hwinfo->hw_version < 1) && (state.ui_screen == MENU_TOP))
|
||||
maxEntries -= 1;
|
||||
|
||||
// Hide the softpot menu entries if hardware does not have them
|
||||
uint8_t softpot = hwinfo->flags & MOD17_FLAGS_SOFTPOT;
|
||||
if((softpot == 0) && (state.ui_screen == SETTINGS_MODULE17))
|
||||
maxEntries -= 2;
|
||||
|
||||
if(ui_state.menu_selected < maxEntries)
|
||||
ui_state.menu_selected += 1;
|
||||
else
|
||||
|
|
|
@ -220,18 +220,6 @@ int _ui_getModule17ValueName(char *buf, uint8_t max_len, uint8_t index)
|
|||
|
||||
switch(index)
|
||||
{
|
||||
case D_TXWIPER:
|
||||
snprintf(buf, max_len, "%d", mod17CalData.tx_wiper);
|
||||
break;
|
||||
case D_RXWIPER:
|
||||
snprintf(buf, max_len, "%d", mod17CalData.rx_wiper);
|
||||
break;
|
||||
case D_TXINVERT:
|
||||
snprintf(buf, max_len, "%s", phase_values[mod17CalData.bb_tx_invert]);
|
||||
break;
|
||||
case D_RXINVERT:
|
||||
snprintf(buf, max_len, "%s", phase_values[mod17CalData.bb_rx_invert]);
|
||||
break;
|
||||
case D_MICGAIN:
|
||||
snprintf(buf, max_len, "%s", mic_gain_values[mod17CalData.mic_gain]);
|
||||
break;
|
||||
|
@ -241,6 +229,18 @@ int _ui_getModule17ValueName(char *buf, uint8_t max_len, uint8_t index)
|
|||
case D_PTTOUTLEVEL:
|
||||
snprintf(buf, max_len, "%s", mod17CalData.ptt_out_level ? "Act high" : "Act low");
|
||||
break;
|
||||
case D_TXINVERT:
|
||||
snprintf(buf, max_len, "%s", phase_values[mod17CalData.bb_tx_invert]);
|
||||
break;
|
||||
case D_RXINVERT:
|
||||
snprintf(buf, max_len, "%s", phase_values[mod17CalData.bb_rx_invert]);
|
||||
break;
|
||||
case D_TXWIPER:
|
||||
snprintf(buf, max_len, "%d", mod17CalData.tx_wiper);
|
||||
break;
|
||||
case D_RXWIPER:
|
||||
snprintf(buf, max_len, "%d", mod17CalData.rx_wiper);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Ładowanie…
Reference in New Issue