mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-31 07:11:36 +08:00
Final parameter interface cleanup - removed last bit of old cruft, fixed a bug on parameter update notification, cleaned up API slightly in naming
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user