[mavlink] configurable device

This commit is contained in:
Felix Ruess
2014-12-08 14:59:37 +01:00
parent b8ac2ef752
commit d93591f439
3 changed files with 17 additions and 3 deletions
+3 -2
View File
@@ -102,7 +102,7 @@ void mavlink_event(void)
case MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE: {
mavlink_rc_channels_override_t cmd;
mavlink_msg_rc_channels_override_decode(&msg, &cmd);
#if defined RADIO_CONTROL && defined RADIO_CONTROL_TYPE_DATALINK
uint8_t thrust = (cmd.chan3_raw - 950) * 127 / 1100;
int8_t roll = -(cmd.chan1_raw - 1500) * 255 / 1100 / 2;
int8_t pitch = -(cmd.chan2_raw - 1500) * 255 / 1100 / 2;
@@ -110,6 +110,7 @@ void mavlink_event(void)
parse_rc_4ch_datalink(0, thrust, roll, pitch, yaw);
//printf("RECEIVED: RC Channel Override for: %d/%d: throttle: %d; roll: %d; pitch: %d; yaw: %d;\r\n",
// cmd.target_system, cmd.target_component, thrust, roll, pitch, yaw);
#endif
break;
}
@@ -159,7 +160,7 @@ void mavlink_event(void)
default:
//Do nothing
printf("Received message with id: %d\r\n", msg.msgid);
//printf("Received message with id: %d\r\n", msg.msgid);
break;
}
}
+3 -1
View File
@@ -42,7 +42,9 @@
*/
extern mavlink_system_t mavlink_system;
#ifndef MAVLINK_DEV
#define MAVLINK_DEV UDP0
#endif
/*
* The MAVLink link description
@@ -70,4 +72,4 @@ static inline void comm_send_ch(mavlink_channel_t chan, uint8_t ch)
MAVLink(Transmit(ch));
}
#endif // DATALINK_MAVLINK_H
#endif // DATALINK_MAVLINK_H