diff options
author | Lorenz Meier <lorenz@px4.io> | 2015-04-07 19:04:19 +0200 |
---|---|---|
committer | Lorenz Meier <lorenz@px4.io> | 2015-04-07 19:04:19 +0200 |
commit | f8c8876642857520e85ec8ca027146c11b4301e3 (patch) | |
tree | efb4bd4841e185e982df683e3810889faf5c4ab0 /src/modules | |
parent | de3888bed75347eb8aefdc6cb7dbeeedff749988 (diff) | |
parent | 6bd94f15a89c8252e1d04350e043c764483647b7 (diff) | |
download | px4-firmware-f8c8876642857520e85ec8ca027146c11b4301e3.tar.gz px4-firmware-f8c8876642857520e85ec8ca027146c11b4301e3.tar.bz2 px4-firmware-f8c8876642857520e85ec8ca027146c11b4301e3.zip |
Merge pull request #1819 from PX4/chan16
Support 16 channels on IO via S.BUS
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/px4iofirmware/mixer.cpp | 6 | ||||
-rw-r--r-- | src/modules/px4iofirmware/px4io.h | 3 | ||||
-rw-r--r-- | src/modules/px4iofirmware/registers.c | 2 | ||||
-rw-r--r-- | src/modules/px4iofirmware/sbus.c | 4 |
4 files changed, 9 insertions, 6 deletions
diff --git a/src/modules/px4iofirmware/mixer.cpp b/src/modules/px4iofirmware/mixer.cpp index 66f0969de..835dfc0f5 100644 --- a/src/modules/px4iofirmware/mixer.cpp +++ b/src/modules/px4iofirmware/mixer.cpp @@ -272,8 +272,9 @@ mixer_tick(void) if (mixer_servos_armed && should_arm) { /* update the servo outputs. */ - for (unsigned i = 0; i < PX4IO_SERVO_COUNT; i++) + for (unsigned i = 0; i < PX4IO_SERVO_HARDWARE_COUNT; i++) { up_pwm_servo_set(i, r_page_servos[i]); + } /* set S.BUS1 or S.BUS2 outputs */ @@ -285,8 +286,9 @@ mixer_tick(void) } else if (mixer_servos_armed && should_always_enable_pwm) { /* set the disarmed servo outputs. */ - for (unsigned i = 0; i < PX4IO_SERVO_COUNT; i++) + for (unsigned i = 0; i < PX4IO_SERVO_HARDWARE_COUNT; i++) { up_pwm_servo_set(i, r_page_servo_disarmed[i]); + } /* set S.BUS1 or S.BUS2 outputs */ if (r_setup_features & PX4IO_P_SETUP_FEATURES_SBUS1_OUT) diff --git a/src/modules/px4iofirmware/px4io.h b/src/modules/px4iofirmware/px4io.h index 8192c5b50..17699b7c0 100644 --- a/src/modules/px4iofirmware/px4io.h +++ b/src/modules/px4iofirmware/px4io.h @@ -51,7 +51,8 @@ /* * Constants and limits. */ -#define PX4IO_SERVO_COUNT 8 +#define PX4IO_SERVO_COUNT 16 +#define PX4IO_SERVO_HARDWARE_COUNT 8 #define PX4IO_CONTROL_CHANNELS 8 #define PX4IO_CONTROL_GROUPS 4 #define PX4IO_RC_INPUT_CHANNELS 18 diff --git a/src/modules/px4iofirmware/registers.c b/src/modules/px4iofirmware/registers.c index f0c2cfd26..ae7aec34e 100644 --- a/src/modules/px4iofirmware/registers.c +++ b/src/modules/px4iofirmware/registers.c @@ -284,7 +284,7 @@ registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num case PX4IO_PAGE_DIRECT_PWM: /* copy channel data */ - while ((offset < PX4IO_CONTROL_CHANNELS) && (num_values > 0)) { + while ((offset < PX4IO_SERVO_COUNT) && (num_values > 0)) { /* XXX range-check value? */ if (*values != PWM_IGNORE_THIS_CHANNEL) { diff --git a/src/modules/px4iofirmware/sbus.c b/src/modules/px4iofirmware/sbus.c index 9d2849090..14d8ccca2 100644 --- a/src/modules/px4iofirmware/sbus.c +++ b/src/modules/px4iofirmware/sbus.c @@ -163,8 +163,8 @@ sbus1_output(uint16_t *values, uint16_t num_values) void sbus2_output(uint16_t *values, uint16_t num_values) { - char b = 'B'; - write(sbus_fd, &b, 1); + // XXX S.BUS2 is not implemented, fall back to S.BUS1 + sbus1_output(values, num_values); } bool |