Skip to content

Commit

Permalink
simplified serial port initialization for MLink telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
mha1 committed May 5, 2023
1 parent df9612e commit 54220ab
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions radio/src/pulses/ppm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,11 @@ static etx_serial_init ppmMLinkSerialParams = {
static void* ppmMLinkInit(uint8_t module) {
etx_module_state_t *mod_st = (etx_module_state_t *)ppmInit(module);

if (mod_st) {
mod_st = modulePortInitSerial(module, ETX_MOD_PORT_UART, &ppmMLinkSerialParams);

if (!mod_st) {
// inverted soft-serial fallback
ppmMLinkSerialParams.polarity = ETX_Pol_Normal;
mod_st = modulePortInitSerial(module, ETX_MOD_PORT_SPORT_INV, &ppmMLinkSerialParams);
}
if (!mod_st)
return nullptr;

if (!modulePortInitSerial(module, ETX_MOD_PORT_UART, &ppmMLinkSerialParams)) {
modulePortInitSerial(module, ETX_MOD_PORT_SPORT_INV, &ppmMLinkSerialParams);
}

return (void*)mod_st;
Expand Down

0 comments on commit 54220ab

Please sign in to comment.