From 27b6f7cc6d1f05b3513fe8889dc4e1f5d1eea793 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 15 Jun 2023 02:30:03 +0200 Subject: [PATCH] fix(simulator): Crash if SBUS chosen as external module type (#3683) --- radio/src/pulses/sbus.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/radio/src/pulses/sbus.cpp b/radio/src/pulses/sbus.cpp index 76e1b5829..d83d72e68 100644 --- a/radio/src/pulses/sbus.cpp +++ b/radio/src/pulses/sbus.cpp @@ -140,7 +140,9 @@ static void sbusSendPulses(void* ctx, uint8_t* buffer, int16_t* channels, uint8_ auto drv_ctx = modulePortGetCtx(mod_st->tx); // TODO: check if the port has an inverter and use it instead - drv->setPolarity(drv_ctx, GET_SBUS_POLARITY(module)); + if(drv->setPolarity) + drv->setPolarity(drv_ctx, GET_SBUS_POLARITY(module)); + drv->sendBuffer(drv_ctx, buffer, p_data - buffer); // SBUS_PERIOD is not a constant! It can be set from UI