diff --git a/libraries/AP_HAL_ChibiOS/RCOutput.cpp b/libraries/AP_HAL_ChibiOS/RCOutput.cpp index 310083d608..ba37fd3f29 100644 --- a/libraries/AP_HAL_ChibiOS/RCOutput.cpp +++ b/libraries/AP_HAL_ChibiOS/RCOutput.cpp @@ -595,7 +595,7 @@ void RCOutput::set_group_mode(pwm_group &group) case MODE_PWM_DSHOT150 ... MODE_PWM_DSHOT1200: { const uint16_t rates[(1 + MODE_PWM_DSHOT1200) - MODE_PWM_DSHOT150] = { 150, 300, 600, 1200 }; uint32_t rate = rates[uint8_t(group.current_mode - MODE_PWM_DSHOT150)] * 1000UL; - const uint32_t bit_period = 19; + const uint32_t bit_period = 20; // configure timer driver for DMAR at requested rate if (!setup_group_DMA(group, rate, bit_period, true)) { @@ -745,13 +745,12 @@ void RCOutput::trigger_groups(void) } osalSysUnlock(); - for (uint8_t i = 0; i < NUM_GROUPS; i++) { - pwm_group &group = pwm_group_list[i]; - if (serial_group == &group) { - continue; - } - if (group.current_mode >= MODE_PWM_DSHOT150 && group.current_mode <= MODE_PWM_DSHOT1200) { - dshot_send(group, false); + if (!serial_group) { + for (uint8_t i = 0; i < NUM_GROUPS; i++) { + pwm_group &group = pwm_group_list[i]; + if (group.current_mode >= MODE_PWM_DSHOT150 && group.current_mode <= MODE_PWM_DSHOT1200) { + dshot_send(group, false); + } } } @@ -775,7 +774,7 @@ void RCOutput::timer_tick(void) uint64_t now = AP_HAL::micros64(); for (uint8_t i = 0; i < NUM_GROUPS; i++ ) { pwm_group &group = pwm_group_list[i]; - if (serial_group != &group && + if (!serial_group && group.current_mode >= MODE_PWM_DSHOT150 && group.current_mode <= MODE_PWM_DSHOT1200 && now - group.last_dshot_send_us > 900) { @@ -991,10 +990,6 @@ bool RCOutput::serial_setup_output(uint8_t chan, uint32_t baudrate) continue; } if (group.ch_mask & (1U<