mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 07:23:34 +08:00
clang-tidy: enable readability-simplify-boolean-expr and fix
This commit is contained in:
@@ -354,8 +354,8 @@ bool FlightTaskAuto::_evaluateGlobalReference()
|
||||
return true;
|
||||
}
|
||||
|
||||
double ref_lat = _sub_vehicle_local_position.get().ref_lat;
|
||||
double ref_lon = _sub_vehicle_local_position.get().ref_lon;
|
||||
double ref_lat = _sub_vehicle_local_position.get().ref_lat;
|
||||
double ref_lon = _sub_vehicle_local_position.get().ref_lon;
|
||||
_reference_altitude = _sub_vehicle_local_position.get().ref_alt;
|
||||
|
||||
if (!_sub_vehicle_local_position.get().z_global) {
|
||||
@@ -372,20 +372,10 @@ bool FlightTaskAuto::_evaluateGlobalReference()
|
||||
}
|
||||
|
||||
// init projection
|
||||
map_projection_init(&_reference_position,
|
||||
ref_lat,
|
||||
ref_lon);
|
||||
map_projection_init(&_reference_position, ref_lat, ref_lon);
|
||||
|
||||
// check if everything is still finite
|
||||
if (PX4_ISFINITE(_reference_altitude)
|
||||
&& PX4_ISFINITE(_sub_vehicle_local_position.get().ref_lat)
|
||||
&& PX4_ISFINITE(_sub_vehicle_local_position.get().ref_lon)) {
|
||||
return true;
|
||||
|
||||
} else {
|
||||
// no valid reference
|
||||
return false;
|
||||
}
|
||||
return PX4_ISFINITE(_reference_altitude) && PX4_ISFINITE(ref_lat) && PX4_ISFINITE(ref_lon);
|
||||
}
|
||||
|
||||
void FlightTaskAuto::_setDefaultConstraints()
|
||||
|
||||
@@ -70,7 +70,7 @@ void ObstacleAvoidance::injectAvoidanceSetpoints(Vector3f &pos_sp, Vector3f &vel
|
||||
const bool avoidance_data_timeout = hrt_elapsed_time((hrt_abstime *)&_sub_vehicle_trajectory_waypoint.get().timestamp)
|
||||
> TRAJECTORY_STREAM_TIMEOUT_US;
|
||||
const bool avoidance_point_valid =
|
||||
_sub_vehicle_trajectory_waypoint.get().waypoints[vehicle_trajectory_waypoint_s::POINT_0].point_valid == true;
|
||||
_sub_vehicle_trajectory_waypoint.get().waypoints[vehicle_trajectory_waypoint_s::POINT_0].point_valid;
|
||||
|
||||
_avoidance_point_not_valid_hysteresis.set_state_and_update(!avoidance_point_valid, hrt_absolute_time());
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace systemlib
|
||||
void
|
||||
Hysteresis::set_hysteresis_time_from(const bool from_state, const hrt_abstime new_hysteresis_time_us)
|
||||
{
|
||||
if (from_state == true) {
|
||||
if (from_state) {
|
||||
_time_from_true_us = new_hysteresis_time_us;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -501,7 +501,7 @@ param_value_is_default(param_t param)
|
||||
param_lock_reader();
|
||||
s = param_find_changed(param);
|
||||
param_unlock_reader();
|
||||
return s ? false : true;
|
||||
return s == nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
+1
-1
@@ -712,7 +712,7 @@ dsm_parse(const uint64_t now, const uint8_t *frame, const unsigned len, uint16_t
|
||||
dsm_partial_frame_count = 0;
|
||||
|
||||
/* if decoding failed, set proto to desync */
|
||||
if (decode_ret == false) {
|
||||
if (!decode_ret) {
|
||||
dsm_decode_state = DSM_DECODE_STATE_DESYNC;
|
||||
dsm_frame_drops++;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ void TerrainEstimator::measurement_update(uint64_t time_ref, const struct vehicl
|
||||
}
|
||||
|
||||
if (reinit) {
|
||||
memset(&_x._data[0], 0, sizeof(_x._data));
|
||||
_x.zero();
|
||||
_P.setZero();
|
||||
_P(0, 0) = _P(1, 1) = _P(2, 2) = 0.1f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user