mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 04:33:34 +08:00
Introduced new actuator_safety topic
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
#include <systemlib/err.h>
|
||||
#include <uORB/uORB.h>
|
||||
#include <uORB/topics/vehicle_status.h>
|
||||
#include <uORB/topics/actuator_safety.h>
|
||||
#include <poll.h>
|
||||
#include <drivers/drv_gpio.h>
|
||||
|
||||
@@ -60,6 +61,8 @@ struct gpio_led_s {
|
||||
int pin;
|
||||
struct vehicle_status_s status;
|
||||
int vehicle_status_sub;
|
||||
struct actuator_safety_s safety;
|
||||
int actuator_safety_sub;
|
||||
bool led_state;
|
||||
int counter;
|
||||
};
|
||||
@@ -168,11 +171,15 @@ void gpio_led_cycle(FAR void *arg)
|
||||
if (status_updated)
|
||||
orb_copy(ORB_ID(vehicle_status), priv->vehicle_status_sub, &priv->status);
|
||||
|
||||
orb_check(priv->vehicle_status_sub, &status_updated);
|
||||
|
||||
if (status_updated)
|
||||
orb_copy(ORB_ID(actuator_safety), priv->actuator_safety_sub, &priv->safety);
|
||||
|
||||
/* select pattern for current status */
|
||||
int pattern = 0;
|
||||
|
||||
/* XXX fmu armed correct? */
|
||||
if (priv->status.flag_fmu_armed) {
|
||||
if (priv->safety.armed) {
|
||||
if (priv->status.battery_warning == VEHICLE_BATTERY_WARNING_NONE) {
|
||||
pattern = 0x3f; // ****** solid (armed)
|
||||
|
||||
@@ -181,11 +188,10 @@ void gpio_led_cycle(FAR void *arg)
|
||||
}
|
||||
|
||||
} else {
|
||||
if (priv->status.arming_state == ARMING_STATE_STANDBY) {
|
||||
if (priv->safety.ready_to_arm) {
|
||||
pattern = 0x00; // ______ off (disarmed, preflight check)
|
||||
|
||||
} else if (priv->status.arming_state == ARMING_STATE_STANDBY &&
|
||||
priv->status.battery_warning == VEHICLE_BATTERY_WARNING_NONE) {
|
||||
} else if (priv->safety.ready_to_arm && priv->status.battery_warning == VEHICLE_BATTERY_WARNING_NONE) {
|
||||
pattern = 0x38; // ***___ slow blink (disarmed, ready)
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user