Skip to content

Commit

Permalink
AP_IOMCU: allow up to 16 channels of servo data to be sent to the iomcu
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Apr 27, 2024
1 parent 338f492 commit d402c41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions libraries/AP_IOMCU/AP_IOMCU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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<IOMCU_MAX_CHANNELS; i++) {
for (uint8_t i=0; i<IOMCU_MAX_RC_CHANNELS; i++) {
if (chmask & (1U<<i)) {
if (pwm_out.failsafe_pwm[i] != period_us) {
pwm_out.failsafe_pwm[i] = period_us;
Expand Down
6 changes: 3 additions & 3 deletions libraries/AP_IOMCU/AP_IOMCU.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,17 @@ class AP_IOMCU
// output pwm values
struct {
uint8_t num_channels;
uint16_t pwm[IOMCU_MAX_CHANNELS];
uint16_t pwm[IOMCU_MAX_RC_CHANNELS];
uint16_t safety_mask;
uint16_t failsafe_pwm[IOMCU_MAX_CHANNELS];
uint16_t failsafe_pwm[IOMCU_MAX_RC_CHANNELS];
uint8_t failsafe_pwm_set;
uint8_t failsafe_pwm_sent;
uint16_t channel_mask;
} pwm_out;

// read back pwm values
struct {
uint16_t pwm[IOMCU_MAX_CHANNELS];
uint16_t pwm[IOMCU_MAX_RC_CHANNELS];
} pwm_in;

// output rates
Expand Down

0 comments on commit d402c41

Please sign in to comment.