diff options
author | px4dev <px4@purgatory.org> | 2013-07-06 23:59:35 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2013-07-06 23:59:35 -0700 |
commit | 8fa226c909d5d34606e8f28bb0b54aeda8f91010 (patch) | |
tree | 58549c9596aa5568057f8844a111c4e596ee77f7 /src/modules/px4iofirmware/controls.c | |
parent | a65a1237f05c885245237e9ffecd79dee9de4dbc (diff) | |
download | px4-firmware-8fa226c909d5d34606e8f28bb0b54aeda8f91010.tar.gz px4-firmware-8fa226c909d5d34606e8f28bb0b54aeda8f91010.tar.bz2 px4-firmware-8fa226c909d5d34606e8f28bb0b54aeda8f91010.zip |
Tweak protocol register assignments and add new registers to accommodate differences in IOv2.
Diffstat (limited to 'src/modules/px4iofirmware/controls.c')
-rw-r--r-- | src/modules/px4iofirmware/controls.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/px4iofirmware/controls.c b/src/modules/px4iofirmware/controls.c index 95103964e..5a95a8aa9 100644 --- a/src/modules/px4iofirmware/controls.c +++ b/src/modules/px4iofirmware/controls.c @@ -66,7 +66,7 @@ controls_init(void) sbus_init("/dev/ttyS2"); /* default to a 1:1 input map, all enabled */ - for (unsigned i = 0; i < MAX_CONTROL_CHANNELS; i++) { + for (unsigned i = 0; i < PX4IO_CONTROL_CHANNELS; i++) { unsigned base = PX4IO_P_RC_CONFIG_STRIDE * i; r_page_rc_input_config[base + PX4IO_P_RC_CONFIG_OPTIONS] = 0; @@ -117,7 +117,7 @@ controls_tick() { r_status_flags |= PX4IO_P_STATUS_FLAGS_RC_PPM; perf_end(c_gather_ppm); - ASSERT(r_raw_rc_count <= MAX_CONTROL_CHANNELS); + ASSERT(r_raw_rc_count <= PX4IO_CONTROL_CHANNELS); /* * In some cases we may have received a frame, but input has still @@ -190,7 +190,7 @@ controls_tick() { /* and update the scaled/mapped version */ unsigned mapped = conf[PX4IO_P_RC_CONFIG_ASSIGNMENT]; - ASSERT(mapped < MAX_CONTROL_CHANNELS); + ASSERT(mapped < PX4IO_CONTROL_CHANNELS); /* invert channel if pitch - pulling the lever down means pitching up by convention */ if (mapped == 1) /* roll, pitch, yaw, throttle, override is the standard order */ @@ -202,7 +202,7 @@ controls_tick() { } /* set un-assigned controls to zero */ - for (unsigned i = 0; i < MAX_CONTROL_CHANNELS; i++) { + for (unsigned i = 0; i < PX4IO_CONTROL_CHANNELS; i++) { if (!(assigned_channels & (1 << i))) r_rc_values[i] = 0; } @@ -312,8 +312,8 @@ ppm_input(uint16_t *values, uint16_t *num_values) /* PPM data exists, copy it */ *num_values = ppm_decoded_channels; - if (*num_values > MAX_CONTROL_CHANNELS) - *num_values = MAX_CONTROL_CHANNELS; + if (*num_values > PX4IO_CONTROL_CHANNELS) + *num_values = PX4IO_CONTROL_CHANNELS; for (unsigned i = 0; i < *num_values; i++) values[i] = ppm_buffer[i]; |