diff options
author | px4dev <px4@purgatory.org> | 2012-12-04 22:00:24 -0800 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-12-04 22:00:24 -0800 |
commit | fd771f67f2a2392d5ba2b7dd74100338859af6d7 (patch) | |
tree | fcb3a1cf40e91dfc45ae7e50a7ecf679154efcc8 /apps/px4io/dsm.c | |
parent | 7c3b28d503123121403b4ad68c934bb91b05d878 (diff) | |
download | px4-firmware-fd771f67f2a2392d5ba2b7dd74100338859af6d7.tar.gz px4-firmware-fd771f67f2a2392d5ba2b7dd74100338859af6d7.tar.bz2 px4-firmware-fd771f67f2a2392d5ba2b7dd74100338859af6d7.zip |
Adjust the control mapping from DSM receivers to correspond to the standard PPM control mapping for channels 0-4.
Diffstat (limited to 'apps/px4io/dsm.c')
-rw-r--r-- | apps/px4io/dsm.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/apps/px4io/dsm.c b/apps/px4io/dsm.c index 04aca709b..2611f3a03 100644 --- a/apps/px4io/dsm.c +++ b/apps/px4io/dsm.c @@ -322,10 +322,28 @@ dsm_decode(hrt_abstime frame_time) /* convert 0-1024 / 0-2048 values to 1000-2000 ppm encoding in a very sloppy fashion */ if (channel_shift == 11) value /= 2; - - /* stuff the decoded channel into the PPM input buffer */ - /* XXX check actual values */ - system_state.rc_channel_data[channel] = 988 + value; + value += 998; + + /* + * Store the decoded channel into the R/C input buffer, taking into + * account the different ideas about channel assignement that we have. + * + * Specifically, the first four channels in rc_channel_data are roll, pitch, thrust, yaw, + * but the first four channels from the DSM receiver are thrust, roll, pitch, yaw. + */ + switch (channel) { + case 0: + channel = 2; + break; + case 1: + channel = 0; + break; + case 2: + channel = 1; + default: + break; + } + system_state.rc_channel_data[channel] = value; } /* and note that we have received data from the R/C controller */ |