Merge pull request #1819 from PX4/chan16

Support 16 channels on IO via S.BUS
This commit is contained in:
Lorenz Meier
2015-04-07 19:04:19 +02:00
5 changed files with 20 additions and 11 deletions
+4 -2
View File
@@ -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)
+2 -1
View File
@@ -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
+1 -1
View File
@@ -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) {
+2 -2
View File
@@ -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