Revert "Merge pull request #1819 from PX4/chan16" because of #2113

This reverts commit f8c8876642, reversing
changes made to de3888bed7.
This commit is contained in:
Andreas Antener 2015-05-05 14:41:53 +02:00
parent 577bdf3a0d
commit cd4154d805
5 changed files with 11 additions and 20 deletions

View File

@ -1743,20 +1743,14 @@ PX4IO::io_publish_pwm_outputs()
uint16_t ctl[_max_actuators];
int ret = io_reg_get(PX4IO_PAGE_SERVOS, 0, ctl, _max_actuators);
if (ret != OK){
if (ret != OK)
return ret;
}
unsigned maxouts = sizeof(outputs.output) / sizeof(outputs.output[0]);
unsigned actuator_max = (_max_actuators > maxouts) ? maxouts : _max_actuators;
/* convert from register format to float */
for (unsigned i = 0; i < actuator_max; i++){
for (unsigned i = 0; i < _max_actuators; i++)
outputs.output[i] = ctl[i];
}
outputs.noutputs = actuator_max;
outputs.noutputs = _max_actuators;
/* lazily advertise on first publication */
if (_to_outputs == 0) {
@ -2087,13 +2081,13 @@ PX4IO::print_status(bool extended_status)
printf("vrssi %u\n", io_reg_get(PX4IO_PAGE_STATUS, PX4IO_P_STATUS_VRSSI));
}
printf("actuators (including S.BUS)");
printf("actuators");
for (unsigned i = 0; i < _max_actuators; i++)
printf(" %hi", int16_t(io_reg_get(PX4IO_PAGE_ACTUATORS, i)));
printf("\n");
printf("hardware servo ports");
printf("servos");
for (unsigned i = 0; i < _max_actuators; i++)
printf(" %u", io_reg_get(PX4IO_PAGE_SERVOS, i));

View File

@ -272,9 +272,8 @@ mixer_tick(void)
if (mixer_servos_armed && should_arm) {
/* update the servo outputs. */
for (unsigned i = 0; i < PX4IO_SERVO_HARDWARE_COUNT; i++) {
for (unsigned i = 0; i < PX4IO_SERVO_COUNT; i++)
up_pwm_servo_set(i, r_page_servos[i]);
}
/* set S.BUS1 or S.BUS2 outputs */
@ -286,9 +285,8 @@ mixer_tick(void)
} else if (mixer_servos_armed && should_always_enable_pwm) {
/* set the disarmed servo outputs. */
for (unsigned i = 0; i < PX4IO_SERVO_HARDWARE_COUNT; i++) {
for (unsigned i = 0; i < PX4IO_SERVO_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)

View File

@ -51,8 +51,7 @@
/*
* Constants and limits.
*/
#define PX4IO_SERVO_COUNT 16
#define PX4IO_SERVO_HARDWARE_COUNT 8
#define PX4IO_SERVO_COUNT 8
#define PX4IO_CONTROL_CHANNELS 8
#define PX4IO_CONTROL_GROUPS 4
#define PX4IO_RC_INPUT_CHANNELS 18

View File

@ -285,7 +285,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_SERVO_COUNT) && (num_values > 0)) {
while ((offset < PX4IO_CONTROL_CHANNELS) && (num_values > 0)) {
/* XXX range-check value? */
if (*values != PWM_IGNORE_THIS_CHANNEL) {

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)
{
// XXX S.BUS2 is not implemented, fall back to S.BUS1
sbus1_output(values, num_values);
char b = 'B';
write(sbus_fd, &b, 1);
}
bool