From 2d2548e714505b1a9d1074c0f9a78c44c8363314 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Mon, 27 Aug 2012 22:57:20 +0200 Subject: Final parameter interface cleanup - removed last bit of old cruft, fixed a bug on parameter update notification, cleaned up API slightly in naming --- apps/commander/state_machine_helper.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'apps/commander/state_machine_helper.c') 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 -#include "state_machine_helper.h" +#include #include #include @@ -47,6 +47,8 @@ #include #include +#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) { -- cgit v1.2.3