mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 20:53:35 +08:00
vehicle_status_flags: cleanup message, move non-failsafe flags to vehicle_status
This commit is contained in:
@@ -58,18 +58,22 @@ void RC_Loss_Alarm::process()
|
||||
return;
|
||||
}
|
||||
|
||||
vehicle_status_flags_s status_flags{};
|
||||
|
||||
_vehicle_status_flags_sub.copy(&status_flags);
|
||||
|
||||
if (!_was_armed &&
|
||||
status.arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
|
||||
|
||||
_was_armed = true; // Once true, impossible to go back to false
|
||||
}
|
||||
|
||||
if (!_had_rc && !status.rc_signal_lost) {
|
||||
if (!_had_rc && !status_flags.rc_signal_lost) {
|
||||
|
||||
_had_rc = true;
|
||||
}
|
||||
|
||||
if (_was_armed && _had_rc && status.rc_signal_lost &&
|
||||
if (_was_armed && _had_rc && status_flags.rc_signal_lost &&
|
||||
status.arming_state != vehicle_status_s::ARMING_STATE_ARMED) {
|
||||
play_tune();
|
||||
_alarm_playing = true;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <uORB/Publication.hpp>
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/topics/vehicle_status.h>
|
||||
#include <uORB/topics/vehicle_status_flags.h>
|
||||
#include <uORB/topics/tune_control.h>
|
||||
|
||||
namespace events
|
||||
@@ -67,6 +68,7 @@ private:
|
||||
|
||||
uORB::Publication<tune_control_s> _tune_control_pub{ORB_ID(tune_control)};
|
||||
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)};
|
||||
uORB::Subscription _vehicle_status_flags_sub{ORB_ID(vehicle_status_flags)};
|
||||
|
||||
bool _was_armed = false;
|
||||
bool _had_rc = false; // Don't trigger alarm for systems without RC
|
||||
|
||||
@@ -54,8 +54,8 @@ namespace status
|
||||
|
||||
void StatusDisplay::set_leds()
|
||||
{
|
||||
bool gps_lock_valid = _vehicle_status_flags_sub.get().global_position_valid;
|
||||
bool home_position_valid = _vehicle_status_flags_sub.get().home_position_valid;
|
||||
bool gps_lock_valid = !_vehicle_status_flags_sub.get().global_position_invalid;
|
||||
bool home_position_valid = !_vehicle_status_flags_sub.get().home_position_invalid;
|
||||
int nav_state = _vehicle_status_sub.get().nav_state;
|
||||
|
||||
#if defined(BOARD_FRONT_LED_MASK)
|
||||
|
||||
Reference in New Issue
Block a user