forked from Archive/PX4-Autopilot
Updated code style to fix confusing if conditions
This commit is contained in:
parent
a134da6e12
commit
714c90b9db
|
@ -66,8 +66,7 @@ uint8 system_type # system type, contains mavlink MAV_TYPE
|
|||
uint8 system_id # system id, contains MAVLink's system ID field
|
||||
uint8 component_id # subsystem / component id, contains MAVLink's component ID field
|
||||
|
||||
#bool is_rotary_wing # True if system is in rotary wing configuration, so for a VTOL this is only true while flying as a multicopter
|
||||
uint8 vehicle_type
|
||||
uint8 vehicle_type # Type of vehicle (fixed-wing, rotary wing, ground)
|
||||
|
||||
bool is_vtol # True if the system is VTOL capable
|
||||
bool vtol_fw_permanent_stab # True if VTOL should stabilize attitude for fw in manual mode
|
||||
|
|
|
@ -1407,14 +1407,18 @@ Commander::run()
|
|||
status.system_type = (uint8_t)system_type;
|
||||
}
|
||||
|
||||
bool is_rotary = is_rotary_wing(&status) || (is_vtol(&status) && vtol_status.vtol_in_rw_mode);
|
||||
bool is_fixed = is_fixed_wing(&status) || (is_vtol(&status) && !vtol_status.vtol_in_rw_mode);
|
||||
bool is_ground = is_ground_rover(&status);
|
||||
|
||||
/* disable manual override for all systems that rely on electronic stabilization */
|
||||
if (is_rotary_wing(&status) || (is_vtol(&status) && vtol_status.vtol_in_rw_mode)) {
|
||||
if (is_rotary) {
|
||||
status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
|
||||
|
||||
} else if (is_fixed_wing(&status) || is_vtol(&status)) {
|
||||
} else if (is_fixed) {
|
||||
status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_FIXED_WING;
|
||||
|
||||
} else if (is_ground_rover(&status)) {
|
||||
} else if (is_ground) {
|
||||
status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_GROUND;
|
||||
}
|
||||
|
||||
|
@ -1638,7 +1642,9 @@ Commander::run()
|
|||
if (is_vtol(&status)) {
|
||||
|
||||
// Check if there has been any change while updating the flags
|
||||
if ((status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) != vtol_status.vtol_in_rw_mode) {
|
||||
bool is_rotary = status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
|
||||
|
||||
if (is_rotary != vtol_status.vtol_in_rw_mode) {
|
||||
status.vehicle_type = vtol_status.vtol_in_rw_mode ?
|
||||
vehicle_status_s::VEHICLE_TYPE_ROTARY_WING :
|
||||
vehicle_status_s::VEHICLE_TYPE_FIXED_WING;
|
||||
|
@ -1660,7 +1666,9 @@ Commander::run()
|
|||
status_changed = true;
|
||||
}
|
||||
|
||||
if (armed.soft_stop != (status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING)) {
|
||||
const bool is_not_rotary_wing = (status.vehicle_type != vehicle_status_s::VEHICLE_TYPE_ROTARY_WING);
|
||||
|
||||
if (armed.soft_stop != is_not_rotary_wing) {
|
||||
armed.soft_stop = status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING;
|
||||
status_changed = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue