From 41fd7c726e5b0051bee4ea911788721f9e5a64d8 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Sat, 27 Apr 2024 08:44:31 +0100 Subject: [PATCH] AP_IOMCU: allow up to 16 channels of servo data to be sent to the iomcu --- libraries/AP_IOMCU/AP_IOMCU.cpp | 6 +++--- libraries/AP_IOMCU/AP_IOMCU.h | 6 +++--- libraries/AP_IOMCU/iofirmware/iofirmware.cpp | 2 +- libraries/AP_IOMCU/iofirmware/ioprotocol.h | 14 ++++++++------ libraries/AP_IOMCU/iofirmware/mixer.cpp | 4 ++-- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/libraries/AP_IOMCU/AP_IOMCU.cpp b/libraries/AP_IOMCU/AP_IOMCU.cpp index 73f283532f..83ebd6e01a 100644 --- a/libraries/AP_IOMCU/AP_IOMCU.cpp +++ b/libraries/AP_IOMCU/AP_IOMCU.cpp @@ -791,7 +791,7 @@ bool AP_IOMCU::modify_register(uint8_t page, uint8_t offset, uint16_t clearbits, void AP_IOMCU::write_channel(uint8_t chan, uint16_t pwm) { - if (chan >= IOMCU_MAX_CHANNELS) { + if (chan >= IOMCU_MAX_RC_CHANNELS) { // could be SBUS out return; } if (chan >= pwm_out.num_channels) { @@ -1112,7 +1112,7 @@ bool AP_IOMCU::check_crc(void) void AP_IOMCU::set_failsafe_pwm(uint16_t chmask, uint16_t period_us) { bool changed = false; - for (uint8_t i=0; i 0 && mixing.rc_channel[i] <= IOMCU_MAX_CHANNELS) { + if (mixing.rc_channel[i] > 0 && mixing.rc_channel[i] <= IOMCU_MAX_RC_CHANNELS) { uint8_t chan = mixing.rc_channel[i]-1; if (i == 2 && !mixing.throttle_is_angle) { rcin[i] = mix_input_range(i, rc_input.pwm[chan]); @@ -141,7 +141,7 @@ void AP_IOMCU_FW::run_mixer(void) } } - for (uint8_t i=0; i