mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-07 02:41:37 +08:00
Adjust the control mapping from DSM receivers to correspond to the standard PPM control mapping for channels 0-4.
This commit is contained in:
+1
-1
@@ -130,7 +130,7 @@ comms_main(void)
|
|||||||
last_report_time = now;
|
last_report_time = now;
|
||||||
|
|
||||||
/* populate the report */
|
/* populate the report */
|
||||||
for (int i = 0; i < system_state.rc_channels; i++)
|
for (unsigned i = 0; i < system_state.rc_channels; i++)
|
||||||
report.rc_channel[i] = system_state.rc_channel_data[i];
|
report.rc_channel[i] = system_state.rc_channel_data[i];
|
||||||
report.channel_count = system_state.rc_channels;
|
report.channel_count = system_state.rc_channels;
|
||||||
report.armed = system_state.armed;
|
report.armed = system_state.armed;
|
||||||
|
|||||||
+21
-3
@@ -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 */
|
/* convert 0-1024 / 0-2048 values to 1000-2000 ppm encoding in a very sloppy fashion */
|
||||||
if (channel_shift == 11)
|
if (channel_shift == 11)
|
||||||
value /= 2;
|
value /= 2;
|
||||||
|
value += 998;
|
||||||
|
|
||||||
/* stuff the decoded channel into the PPM input buffer */
|
/*
|
||||||
/* XXX check actual values */
|
* Store the decoded channel into the R/C input buffer, taking into
|
||||||
system_state.rc_channel_data[channel] = 988 + value;
|
* 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 */
|
/* and note that we have received data from the R/C controller */
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@ struct sys_state_s
|
|||||||
/*
|
/*
|
||||||
* Data from the remote control input(s)
|
* Data from the remote control input(s)
|
||||||
*/
|
*/
|
||||||
int rc_channels;
|
unsigned rc_channels;
|
||||||
uint16_t rc_channel_data[PX4IO_INPUT_CHANNELS];
|
uint16_t rc_channel_data[PX4IO_INPUT_CHANNELS];
|
||||||
uint64_t rc_channels_timestamp;
|
uint64_t rc_channels_timestamp;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user