aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/commander.cpp
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/commander/commander.cpp
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/commander/commander.cpp')
-rw-r--r--src/modules/commander/commander.cpp13
1 files changed, 6 insertions, 7 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);
}