mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-08 03:10:36 +08:00
commander: initialize gps & baro as failure state
This avoids error messages on startup.
This commit is contained in:
@@ -1314,6 +1314,11 @@ int commander_thread_main(int argc, char *argv[])
|
||||
status_flags.offboard_control_signal_found_once = false;
|
||||
status_flags.rc_signal_found_once = false;
|
||||
|
||||
/* assume we don't have a valid GPS & baro on startup */
|
||||
status_flags.gps_failure = true;
|
||||
status_flags.barometer_failure = true;
|
||||
status_flags.ever_had_barometer_data = false;
|
||||
|
||||
/* mark all signals lost as long as they haven't been found */
|
||||
status.rc_signal_lost = true;
|
||||
status_flags.offboard_control_signal_lost = true;
|
||||
@@ -1833,7 +1838,10 @@ int commander_thread_main(int argc, char *argv[])
|
||||
if (status_flags.barometer_failure) {
|
||||
status_flags.barometer_failure = false;
|
||||
status_changed = true;
|
||||
mavlink_log_critical(&mavlink_log_pub, "baro healthy");
|
||||
if (status_flags.ever_had_barometer_data) {
|
||||
mavlink_log_critical(&mavlink_log_pub, "baro healthy");
|
||||
}
|
||||
status_flags.ever_had_barometer_data = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -92,6 +92,7 @@ struct status_flags_s {
|
||||
bool gps_failure; // Set to true if a gps failure is detected
|
||||
bool gps_failure_cmd; // Set to true if a gps failure mode is commanded
|
||||
bool barometer_failure; // Set to true if a barometer failure is detected
|
||||
bool ever_had_barometer_data; // Set to true if ever had valid barometer data before
|
||||
};
|
||||
|
||||
bool is_safe(const struct vehicle_status_s *current_state, const struct safety_s *safety, const struct actuator_armed_s *armed);
|
||||
|
||||
Reference in New Issue
Block a user