diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-02-21 08:12:04 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-02-21 08:12:04 +0100 |
commit | cfb4f76bad2836b44c2dc4baaef3ce1e0462ce22 (patch) | |
tree | 76d4725adadec2fe92f2834cb680432f05d522c9 /src/modules | |
parent | 4cfaf928e12ac8927b3980506f31c05a1ab899ce (diff) | |
parent | 9828d5ede474723d83b189c394397d78c7050b7a (diff) | |
download | px4-firmware-cfb4f76bad2836b44c2dc4baaef3ce1e0462ce22.tar.gz px4-firmware-cfb4f76bad2836b44c2dc4baaef3ce1e0462ce22.tar.bz2 px4-firmware-cfb4f76bad2836b44c2dc4baaef3ce1e0462ce22.zip |
Merge pull request #684 from PX4/dsm_fix
Dsm support for DX10t
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/px4iofirmware/dsm.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/modules/px4iofirmware/dsm.c b/src/modules/px4iofirmware/dsm.c index 60eda2319..0d3eb2606 100644 --- a/src/modules/px4iofirmware/dsm.c +++ b/src/modules/px4iofirmware/dsm.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -162,6 +162,7 @@ dsm_guess_format(bool reset) 0xff, /* 8 channels (DX8) */ 0x1ff, /* 9 channels (DX9, etc.) */ 0x3ff, /* 10 channels (DX10) */ + 0x1fff, /* 13 channels (DX10t) */ 0x3fff /* 18 channels (DX10) */ }; unsigned votes10 = 0; @@ -400,6 +401,15 @@ dsm_decode(hrt_abstime frame_time, uint16_t *values, uint16_t *num_values) values[channel] = value; } + /* + * Spektrum likes to send junk in higher channel numbers to fill + * their packets. We don't know about a 13 channel model in their TX + * lines, so if we get a channel count of 13, we'll return 12 (the last + * data index that is stable). + */ + if (*num_values == 13) + *num_values = 12; + if (dsm_channel_shift == 11) { /* Set the 11-bit data indicator */ *num_values |= 0x8000; |