aboutsummaryrefslogtreecommitdiff
path: root/apps/commander/state_machine_helper.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2012-08-27 22:57:20 +0200
committerLorenz Meier <lm@inf.ethz.ch>2012-08-27 22:57:20 +0200
commit2d2548e714505b1a9d1074c0f9a78c44c8363314 (patch)
treedf4b20758f361f00d40268a4fae4137c77067d0d /apps/commander/state_machine_helper.c
parent2a6a151342905377c60711c1cade166ffa058e86 (diff)
downloadpx4-firmware-2d2548e714505b1a9d1074c0f9a78c44c8363314.tar.gz
px4-firmware-2d2548e714505b1a9d1074c0f9a78c44c8363314.tar.bz2
px4-firmware-2d2548e714505b1a9d1074c0f9a78c44c8363314.zip
Final parameter interface cleanup - removed last bit of old cruft, fixed a bug on parameter update notification, cleaned up API slightly in naming
Diffstat (limited to 'apps/commander/state_machine_helper.c')
-rw-r--r--apps/commander/state_machine_helper.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/apps/commander/state_machine_helper.c b/apps/commander/state_machine_helper.c
index 8abf427f7..462406648 100644
--- a/apps/commander/state_machine_helper.c
+++ b/apps/commander/state_machine_helper.c
@@ -39,7 +39,7 @@
*/
#include <stdio.h>
-#include "state_machine_helper.h"
+#include <unistd.h>
#include <uORB/uORB.h>
#include <uORB/topics/vehicle_status.h>
@@ -47,6 +47,8 @@
#include <arch/board/up_hrt.h>
#include <mavlink/mavlink_log.h>
+#include "state_machine_helper.h"
+
static const char* system_state_txt[] = {
"SYSTEM_STATE_PREFLIGHT",
"SYSTEM_STATE_STANDBY",
@@ -75,14 +77,12 @@ int do_state_update(int status_pub, struct vehicle_status_s *current_status, con
switch (new_state) {
case SYSTEM_STATE_MISSION_ABORT: {
/* Indoor or outdoor */
- uint8_t flight_environment_parameter = (uint8_t)(global_data_parameter_storage->pm.param_values[PARAM_FLIGHT_ENV]);
-
- if (flight_environment_parameter == PX4_FLIGHT_ENVIRONMENT_OUTDOOR) {
+ // if (flight_environment_parameter == PX4_FLIGHT_ENVIRONMENT_OUTDOOR) {
ret = do_state_update(status_pub, current_status, mavlink_fd, (commander_state_machine_t)SYSTEM_STATE_EMCY_LANDING);
- } else {
- ret = do_state_update(status_pub, current_status, mavlink_fd, (commander_state_machine_t)SYSTEM_STATE_EMCY_CUTOFF);
- }
+ // } else {
+ // ret = do_state_update(status_pub, current_status, mavlink_fd, (commander_state_machine_t)SYSTEM_STATE_EMCY_CUTOFF);
+ // }
}
break;
@@ -198,10 +198,13 @@ int do_state_update(int status_pub, struct vehicle_status_s *current_status, con
if (invalid_state == false || old_state != new_state) {
current_status->state_machine = new_state;
state_machine_publish(status_pub, current_status, mavlink_fd);
+ ret = OK;
}
if (invalid_state) {
mavlink_log_critical(mavlink_fd, "[commander] REJECTING invalid state transition");
+ ret = ERROR;
}
+ return ret;
}
void state_machine_publish(int status_pub, struct vehicle_status_s *current_status, const int mavlink_fd) {