Skip to content

Commit d402c41

Browse files
committed
AP_IOMCU: allow up to 16 channels of servo data to be sent to the iomcu
1 parent 338f492 commit d402c41

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

libraries/AP_IOMCU/AP_IOMCU.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ bool AP_IOMCU::modify_register(uint8_t page, uint8_t offset, uint16_t clearbits,
791791

792792
void AP_IOMCU::write_channel(uint8_t chan, uint16_t pwm)
793793
{
794-
if (chan >= IOMCU_MAX_CHANNELS) {
794+
if (chan >= IOMCU_MAX_RC_CHANNELS) { // could be SBUS out
795795
return;
796796
}
797797
if (chan >= pwm_out.num_channels) {
@@ -1112,7 +1112,7 @@ bool AP_IOMCU::check_crc(void)
11121112
void AP_IOMCU::set_failsafe_pwm(uint16_t chmask, uint16_t period_us)
11131113
{
11141114
bool changed = false;
1115-
for (uint8_t i=0; i<IOMCU_MAX_CHANNELS; i++) {
1115+
for (uint8_t i=0; i<IOMCU_MAX_RC_CHANNELS; i++) {
11161116
if (chmask & (1U<<i)) {
11171117
if (pwm_out.failsafe_pwm[i] != period_us) {
11181118
pwm_out.failsafe_pwm[i] = period_us;

libraries/AP_IOMCU/AP_IOMCU.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,17 @@ class AP_IOMCU
243243
// output pwm values
244244
struct {
245245
uint8_t num_channels;
246-
uint16_t pwm[IOMCU_MAX_CHANNELS];
246+
uint16_t pwm[IOMCU_MAX_RC_CHANNELS];
247247
uint16_t safety_mask;
248-
uint16_t failsafe_pwm[IOMCU_MAX_CHANNELS];
248+
uint16_t failsafe_pwm[IOMCU_MAX_RC_CHANNELS];
249249
uint8_t failsafe_pwm_set;
250250
uint8_t failsafe_pwm_sent;
251251
uint16_t channel_mask;
252252
} pwm_out;
253253

254254
// read back pwm values
255255
struct {
256-
uint16_t pwm[IOMCU_MAX_CHANNELS];
256+
uint16_t pwm[IOMCU_MAX_RC_CHANNELS];
257257
} pwm_in;
258258

259259
// output rates

0 commit comments

Comments
 (0)