aboutsummaryrefslogtreecommitdiff
path: root/src/modules/px4iofirmware/controls.c
diff options
context:
space:
mode:
authorJean Cyr <jcyr@dillobits.com>2013-07-05 20:51:29 -0400
committerJean Cyr <jcyr@dillobits.com>2013-07-05 20:51:29 -0400
commit3f9f2018e20f4be23e7d62571ec0a3678d960108 (patch)
tree59f0a2cf6c7bc802d95fcc31143caa26353190a3 /src/modules/px4iofirmware/controls.c
parent697c0a1a1d7fb1043786533da3570f28acd661dc (diff)
downloadpx4-firmware-3f9f2018e20f4be23e7d62571ec0a3678d960108.tar.gz
px4-firmware-3f9f2018e20f4be23e7d62571ec0a3678d960108.tar.bz2
px4-firmware-3f9f2018e20f4be23e7d62571ec0a3678d960108.zip
Support binding DSM2 and DSMX satellite receivers
The px4io bind command allows you to put a DSM satellite receiver into bind mode. Since this feature requires that the dsm VCC line (red wire) be cut and routed through relay one, it is not enabled by default in order not to affect those not using a DSM satellite receiver or wising to use relay one for other purposes. NOTE: Binding DSM2 satellites in 11-bit mode is not supported due to potential bug in some DSM2 receiver streams when in 11-bit mode. Furthermore the px4io software folds 11 bit data down to 10 bits so there is no resolution advantage to to 11-bit mode. To enable the feature the RC_RL1_DSM_VCC parameter must be set to a non zero value from the console, or using QGroundControl: param set RC_RL1_DSM_VCC 1 From the console you can initiate DSM bind mode with: uorb start param set RC_RL1_DSM_VCC 1 px4io start px4io bind dsm2 For binding a DSMX satellite to a DSMX transmitter you would instead use: px4io bind dsmx Your receiver module should start a rapid flash and you can follow the normal binding sequence of your transmitter. Note: The value of parameter RC_RL1_DSM_VCC defaults to 0, so none of this will have any effect on an unmodified DSM receiver connection. For this feature to work, the power wire (red) must be cut and each side connected to a terminal on relay1 of the px4io board. This has been tested using Spektrum as well as Hobby King 'Orange' DSM satellite receivers. Both px4fmu and px4io images are updated.
Diffstat (limited to 'src/modules/px4iofirmware/controls.c')
-rw-r--r--src/modules/px4iofirmware/controls.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/modules/px4iofirmware/controls.c b/src/modules/px4iofirmware/controls.c
index 3cf9ca149..9561c9b1e 100644
--- a/src/modules/px4iofirmware/controls.c
+++ b/src/modules/px4iofirmware/controls.c
@@ -95,9 +95,16 @@ controls_tick() {
*/
perf_begin(c_gather_dsm);
- bool dsm_updated = dsm_input(r_raw_rc_values, &r_raw_rc_count);
- if (dsm_updated)
+ uint16_t temp_count = r_raw_rc_count;
+ bool dsm_updated = dsm_input(r_raw_rc_values, &temp_count);
+ if (dsm_updated) {
r_status_flags |= PX4IO_P_STATUS_FLAGS_RC_DSM;
+ r_raw_rc_count = temp_count & 0x7fff;
+ if (temp_count & 0x8000)
+ r_status_flags |= PX4IO_P_STATUS_FLAGS_RC_DSM11;
+ else
+ r_status_flags &= ~PX4IO_P_STATUS_FLAGS_RC_DSM11;
+ }
perf_end(c_gather_dsm);
perf_begin(c_gather_sbus);
@@ -138,7 +145,7 @@ controls_tick() {
/* map raw inputs to mapped inputs */
/* XXX mapping should be atomic relative to protocol */
- for (unsigned i = 0; i < r_raw_rc_count; i++) {
+ for (unsigned i = 0; i < (r_raw_rc_count & 0x7fff); i++) {
/* map the input channel */
uint16_t *conf = &r_page_rc_input_config[i * PX4IO_P_RC_CONFIG_STRIDE];