diff --git a/libraries/AP_HAL_ChibiOS/RCOutput.cpp b/libraries/AP_HAL_ChibiOS/RCOutput.cpp index ed5d746c78..0d51df06c5 100644 --- a/libraries/AP_HAL_ChibiOS/RCOutput.cpp +++ b/libraries/AP_HAL_ChibiOS/RCOutput.cpp @@ -1649,7 +1649,9 @@ void RCOutput::dshot_send(pwm_group &group, rcout_timer_t cycle_start_us, rcout_ bdshot_decode_telemetry_from_erpm(group.bdshot.erpm[i], chan); } #endif - if (safety_on && !(safety_mask & (1U<<(chan+chan_offset)))) { + const uint32_t servo_chan_mask = 1U<<(chan+chan_offset); + + if (safety_on && !(safety_mask & servo_chan_mask)) { // safety is on, don't output anything continue; } @@ -1661,12 +1663,10 @@ void RCOutput::dshot_send(pwm_group &group, rcout_timer_t cycle_start_us, rcout_ continue; } - const uint32_t chan_mask = (1U< 0 - for (uint8_t i=chan_offset; i 0 + for (uint8_t i=0; i