fix: check both SBUS trainer ports (#5149)

.. regardless of TRAINER_MODULE_SBUS_USART define
This commit is contained in:
Raphael Coeffic
2024-06-11 09:51:22 +10:00
committed by GitHub
parent 65a0f0d9e7
commit 61a52b8c38
2 changed files with 13 additions and 16 deletions
+6 -8
View File
@@ -180,16 +180,14 @@ static void trainer_init_module_sbus()
{
if (sbus_trainer_mod_st) return;
#if defined(TRAINER_MODULE_SBUS_USART)
// check if UART with inverter on heartbeat pin is required and available for SBUS (some Taranis radios)
// check if UART with inverter on heartbeat pin is available
sbus_trainer_mod_st = modulePortInitSerial(EXTERNAL_MODULE, ETX_MOD_PORT_UART,
&sbusTrainerParams, false);
#else
// check if UART with inverter on S.Port pin is available for SBUS (e.g. TX16s, NV14)
if(sbus_trainer_mod_st == nullptr)
sbus_trainer_mod_st = modulePortInitSerial(EXTERNAL_MODULE, ETX_MOD_PORT_SPORT,
&sbusTrainerParams, false);
#endif
if(sbus_trainer_mod_st == nullptr) {
// otherwise fall back to S.Port pin
sbus_trainer_mod_st = modulePortInitSerial(
EXTERNAL_MODULE, ETX_MOD_PORT_SPORT, &sbusTrainerParams, false);
}
if (sbus_trainer_mod_st) {
modulePortSetPower(EXTERNAL_MODULE,true);