diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-27 22:57:20 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-08-27 22:57:20 +0200 |
commit | 2d2548e714505b1a9d1074c0f9a78c44c8363314 (patch) | |
tree | df4b20758f361f00d40268a4fae4137c77067d0d /apps/commander | |
parent | 2a6a151342905377c60711c1cade166ffa058e86 (diff) | |
download | px4-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')
-rw-r--r-- | apps/commander/commander.c | 18 | ||||
-rw-r--r-- | apps/commander/state_machine_helper.c | 17 |
2 files changed, 19 insertions, 16 deletions
diff --git a/apps/commander/commander.c b/apps/commander/commander.c index e2d197648..352cf68f6 100644 --- a/apps/commander/commander.c +++ b/apps/commander/commander.c @@ -125,8 +125,8 @@ static void led_deinit(void); static int led_toggle(int led); static int led_on(int led); static int led_off(int led); -static void do_gyro_calibration(int status_pub, struct vehicle_status_s *current_status); -static void do_mag_calibration(int status_pub, struct vehicle_status_s *current_status); +static void do_gyro_calibration(int status_pub, struct vehicle_status_s *status); +static void do_mag_calibration(int status_pub, struct vehicle_status_s *status); static void handle_command(int status_pub, struct vehicle_status_s *current_status, struct vehicle_command_s *cmd); int trigger_audio_alarm(uint8_t old_mode, uint8_t old_state, uint8_t new_mode, uint8_t new_state); @@ -444,7 +444,7 @@ void do_mag_calibration(int status_pub, struct vehicle_status_s *status) close(sub_sensor_combined); } -void do_gyro_calibration(int status_pub, struct vehicle_status_s *current_status) +void do_gyro_calibration(int status_pub, struct vehicle_status_s *status) { const int calibration_count = 3000; @@ -942,13 +942,13 @@ int commander_thread_main(int argc, char *argv[]) led_toggle(LED_AMBER); } else { - /* Constant error indication in standby mode without GPS */ - if (flight_env == PX4_FLIGHT_ENVIRONMENT_OUTDOOR && !current_status.gps_valid) { - led_on(LED_AMBER); + // /* Constant error indication in standby mode without GPS */ + // if (!current_status.gps_valid) { + // led_on(LED_AMBER); - } else { - led_off(LED_AMBER); - } + // } else { + // led_off(LED_AMBER); + // } } if (counter % (1000000 / COMMANDER_MONITORING_INTERVAL) == 0) { 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) { |