aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorAnton Babushkin <rk3dov@gmail.com>2013-04-20 09:14:26 +0400
committerAnton Babushkin <anton.babushkin@me.com>2013-06-29 20:43:44 +0400
commitd3eb86d0ea000add6e2747fda58f77a88b05314c (patch)
tree13732e8068aad5e3c4d4edb29320eb6a6ecfeac3 /src/modules
parent8191130bbc8f2cbd53e69a7bcd1a4d4b1b2d68bb (diff)
downloadpx4-firmware-d3eb86d0ea000add6e2747fda58f77a88b05314c.tar.gz
px4-firmware-d3eb86d0ea000add6e2747fda58f77a88b05314c.tar.bz2
px4-firmware-d3eb86d0ea000add6e2747fda58f77a88b05314c.zip
Publish manual_sas_mode immediately, SAS modes switch order changed to more safe
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/commander/commander.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/modules/commander/commander.c b/src/modules/commander/commander.c
index aab8f3e04..bb8580328 100644
--- a/src/modules/commander/commander.c
+++ b/src/modules/commander/commander.c
@@ -1389,6 +1389,7 @@ int commander_thread_main(int argc, char *argv[])
uint64_t start_time = hrt_absolute_time();
uint64_t failsave_ll_start_time = 0;
+ enum VEHICLE_MANUAL_SAS_MODE manual_sas_mode;
bool state_changed = true;
bool param_init_forced = true;
@@ -1828,8 +1829,9 @@ int commander_thread_main(int argc, char *argv[])
} else if (sp_man.manual_sas_switch < -STICK_ON_OFF_LIMIT) {
- /* bottom stick position, set altitude hold */
- current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_ALTITUDE;
+ /* bottom stick position, set default */
+ /* this MUST be mapped to extremal position to switch easy in case of emergency */
+ current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_ROLL_PITCH_ABS_YAW_ABS;
} else if (sp_man.manual_sas_switch > STICK_ON_OFF_LIMIT) {
@@ -1837,8 +1839,14 @@ int commander_thread_main(int argc, char *argv[])
current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_SIMPLE;
} else {
- /* center stick position, set default */
- current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_ROLL_PITCH_ABS_YAW_ABS;
+ /* center stick position, set altitude hold */
+ current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_ALTITUDE;
+ }
+
+ if (current_status.manual_sas_mode != manual_sas_mode) {
+ /* publish SAS mode changes immediately */
+ manual_sas_mode = current_status.manual_sas_mode;
+ state_changed = true;
}
/*