Tx16s sbus in (#7787)

Enable SBUS trainer input
This commit is contained in:
3djc
2020-07-07 15:56:18 +02:00
committed by GitHub
parent 94ba22a74d
commit 0eb203e827
9 changed files with 96 additions and 19 deletions
+2 -2
View File
@@ -372,7 +372,7 @@ bool menuRadioHardware(event_t event)
#if defined(RADIO_TX16S)
lcdDrawText(lcdNextPos, y, " (TTL)");
#endif
g_eeGeneral.auxSerialMode = editChoice(HW_SETTINGS_COLUMN2, y, STR_AUX_SERIAL_MODES, g_eeGeneral.auxSerialMode, 0, UART_MODE_MAX, attr, event);
g_eeGeneral.auxSerialMode = editChoice(HW_SETTINGS_COLUMN2, y, STR_AUX_SERIAL_MODES, g_eeGeneral.auxSerialMode, 0, UART_MODE_MAX, attr, event, isAux1ModeAvailable);
if (attr && checkIncDec_Ret) {
auxSerialInit(g_eeGeneral.auxSerialMode, modelTelemetryProtocol());
}
@@ -385,7 +385,7 @@ bool menuRadioHardware(event_t event)
#if defined(RADIO_TX16S)
lcdDrawText(lcdNextPos, y, " (TTL)");
#endif
g_eeGeneral.aux2SerialMode = editChoice(HW_SETTINGS_COLUMN2, y, STR_AUX_SERIAL_MODES, g_eeGeneral.aux2SerialMode, 0, UART_MODE_MAX, attr, event);
g_eeGeneral.aux2SerialMode = editChoice(HW_SETTINGS_COLUMN2, y, STR_AUX_SERIAL_MODES, g_eeGeneral.aux2SerialMode, 0, UART_MODE_MAX, attr, event, isAux2ModeAvailable);
if (attr && checkIncDec_Ret) {
aux2SerialInit(g_eeGeneral.aux2SerialMode, modelTelemetryProtocol());
}
+18
View File
@@ -385,6 +385,24 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
return true;
}
bool isAux1ModeAvailable(int mode)
{
#if defined(AUX2_SERIAL)
if (mode == UART_MODE_SBUS_TRAINER)
return g_eeGeneral.aux2SerialMode != UART_MODE_SBUS_TRAINER;
#endif
return true;
}
bool isAux2ModeAvailable(int mode)
{
#if defined(AUX_SERIAL)
if (mode == UART_MODE_SBUS_TRAINER)
return g_eeGeneral.auxSerialMode != UART_MODE_SBUS_TRAINER;
#endif
return true;
}
bool isSwitchAvailableInLogicalSwitches(int swtch)
{
return isSwitchAvailable(swtch, LogicalSwitchesContext);
+2
View File
@@ -70,6 +70,8 @@ bool isSourceAvailableInGlobalFunctions(int source);
bool isSourceAvailableInCustomSwitches(int source);
bool isSourceAvailableInResetSpecialFunction(int index);
bool isSourceAvailableInGlobalResetSpecialFunction(int index);
bool isAux1ModeAvailable(int mode);
bool isAux2ModeAvailable(int mode);
bool isSwitchAvailableInLogicalSwitches(int swtch);
bool isSwitchAvailableInCustomFunctions(int swtch);
bool isSwitchAvailableInMixes(int swtch);