aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2013-08-25 20:17:42 +0200
committerAnton Babushkin <anton.babushkin@me.com>2013-08-25 20:17:42 +0200
commit725bb7697c9fc85ac95fdadc9d2fd2ef5b9848f1 (patch)
treef682d701775080b7081fad4040e848e7511f145d /src/modules
parent7ab129ba9292752753a80ce2af8e9dfee8e8da85 (diff)
downloadpx4-firmware-725bb7697c9fc85ac95fdadc9d2fd2ef5b9848f1.tar.gz
px4-firmware-725bb7697c9fc85ac95fdadc9d2fd2ef5b9848f1.tar.bz2
px4-firmware-725bb7697c9fc85ac95fdadc9d2fd2ef5b9848f1.zip
Minor fix in "set mode" command handling.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/commander/commander.cpp13
-rw-r--r--src/modules/mavlink/mavlink_receiver.cpp2
2 files changed, 7 insertions, 8 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index f7ac24341..74cd5e36a 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -323,11 +323,10 @@ void handle_command(struct vehicle_status_s *status, const struct safety_s *safe
switch (cmd->command) {
case VEHICLE_CMD_DO_SET_MODE: {
uint8_t base_mode = (uint8_t) cmd->param1;
- union px4_custom_mode custom_mode;
- custom_mode.data_float = cmd->param2;
+ uint8_t custom_main_mode = (uint8_t) cmd->param2;
// TODO remove debug code
- mavlink_log_critical(mavlink_fd, "[cmd] command setmode: %d %d", base_mode, custom_mode);
+ mavlink_log_critical(mavlink_fd, "[cmd] command setmode: %d %d", base_mode, custom_main_mode);
/* set arming state */
transition_result_t arming_res = TRANSITION_NOT_CHANGED;
@@ -357,19 +356,19 @@ void handle_command(struct vehicle_status_s *status, const struct safety_s *safe
if (base_mode & MAV_MODE_FLAG_CUSTOM_MODE_ENABLED) {
/* use autopilot-specific mode */
- if (custom_mode.main_mode == PX4_CUSTOM_MAIN_MODE_MANUAL) {
+ if (custom_main_mode == PX4_CUSTOM_MAIN_MODE_MANUAL) {
/* MANUAL */
main_res = main_state_transition(status, MAIN_STATE_MANUAL);
- } else if (custom_mode.main_mode == PX4_CUSTOM_MAIN_MODE_SEATBELT) {
+ } else if (custom_main_mode == PX4_CUSTOM_MAIN_MODE_SEATBELT) {
/* SEATBELT */
main_res = main_state_transition(status, MAIN_STATE_SEATBELT);
- } else if (custom_mode.main_mode == PX4_CUSTOM_MAIN_MODE_EASY) {
+ } else if (custom_main_mode == PX4_CUSTOM_MAIN_MODE_EASY) {
/* EASY */
main_res = main_state_transition(status, MAIN_STATE_EASY);
- } else if (custom_mode.main_mode == PX4_CUSTOM_MAIN_MODE_AUTO) {
+ } else if (custom_main_mode == PX4_CUSTOM_MAIN_MODE_AUTO) {
/* AUTO */
main_res = main_state_transition(status, MAIN_STATE_AUTO);
}
diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp
index eb28af1a1..af43542da 100644
--- a/src/modules/mavlink/mavlink_receiver.cpp
+++ b/src/modules/mavlink/mavlink_receiver.cpp
@@ -201,7 +201,7 @@ handle_message(mavlink_message_t *msg)
custom_mode.data = new_mode.custom_mode;
/* Copy the content of mavlink_command_long_t cmd_mavlink into command_t cmd */
vcmd.param1 = new_mode.base_mode;
- vcmd.param2 = custom_mode.data_float;
+ vcmd.param2 = custom_mode.main_mode;
vcmd.param3 = 0;
vcmd.param4 = 0;
vcmd.param5 = 0;