mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 18:43:33 +08:00
commander: internalize system status bools
Most condition bools in the commander are not used anywhere but in the commander. It therefore makes sense to move them to a different internal struct and remove them from the vehicle_status message. Also, the land_detected should be used by all the modules instead of getting it through the commander and system_status.
This commit is contained in:
@@ -574,12 +574,13 @@ protected:
|
||||
struct vehicle_status_s status;
|
||||
struct battery_status_s battery_status;
|
||||
|
||||
bool updated = _status_sub->update(&status);
|
||||
updated = (updated || _battery_status_sub->update(&battery_status));
|
||||
const bool updated_status = _status_sub->update(&status);
|
||||
const bool updated_battery = _battery_status_sub->update(&battery_status);
|
||||
|
||||
if (updated) {
|
||||
if (updated_status || updated_battery) {
|
||||
mavlink_sys_status_t msg;
|
||||
|
||||
|
||||
msg.onboard_control_sensors_present = status.onboard_control_sensors_present;
|
||||
msg.onboard_control_sensors_enabled = status.onboard_control_sensors_enabled;
|
||||
msg.onboard_control_sensors_health = status.onboard_control_sensors_health;
|
||||
@@ -595,6 +596,8 @@ protected:
|
||||
msg.errors_count3 = 0;
|
||||
msg.errors_count4 = 0;
|
||||
|
||||
PX4_INFO("send sys status: voltage: %d", msg.voltage_battery);
|
||||
|
||||
_mavlink->send_message(MAVLINK_MSG_ID_SYS_STATUS, &msg);
|
||||
|
||||
/* battery status message with higher resolution */
|
||||
|
||||
Reference in New Issue
Block a user