mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-24 15:40:31 +08:00
Commander: avoid automatic type deduction where neither the type is obvious nor it helps with readability
This commit is contained in:
committed by
Daniel Agar
parent
990811098b
commit
651552c9b8
@@ -1970,7 +1970,7 @@ void Commander::checkForMissionUpdate()
|
||||
if (_mission_result_sub.updated()) {
|
||||
const mission_result_s &mission_result = _mission_result_sub.get();
|
||||
|
||||
const auto prev_mission_mission_id = mission_result.mission_id;
|
||||
const uint32_t prev_mission_mission_id = mission_result.mission_id;
|
||||
_mission_result_sub.update();
|
||||
|
||||
// if mission_result is valid for the current mission
|
||||
@@ -2155,9 +2155,10 @@ void Commander::vtolStatusUpdate()
|
||||
if (_vtol_vehicle_status_sub.update(&_vtol_vehicle_status) && is_vtol(_vehicle_status)) {
|
||||
|
||||
// Check if there has been any change while updating the flags (transition = rotary wing status)
|
||||
const auto new_vehicle_type = _vtol_vehicle_status.vehicle_vtol_state == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW ?
|
||||
vehicle_status_s::VEHICLE_TYPE_FIXED_WING :
|
||||
vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
|
||||
const uint8_t new_vehicle_type =
|
||||
_vtol_vehicle_status.vehicle_vtol_state == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW ?
|
||||
vehicle_status_s::VEHICLE_TYPE_FIXED_WING :
|
||||
vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
|
||||
|
||||
if (new_vehicle_type != _vehicle_status.vehicle_type) {
|
||||
_vehicle_status.vehicle_type = new_vehicle_type;
|
||||
|
||||
@@ -170,7 +170,7 @@ void HomePosition::fillGlobalHomePos(home_position_s &home, double lat, double l
|
||||
|
||||
void HomePosition::setInAirHomePosition()
|
||||
{
|
||||
auto &home = _home_position_pub.get();
|
||||
home_position_s &home = _home_position_pub.get();
|
||||
|
||||
if (home.manual_home || (home.valid_lpos && home.valid_hpos && home.valid_alt)) {
|
||||
return;
|
||||
@@ -251,13 +251,13 @@ void HomePosition::setInAirHomePosition()
|
||||
|
||||
bool HomePosition::setManually(double lat, double lon, float alt, float yaw)
|
||||
{
|
||||
const auto &vehicle_local_position = _local_position_sub.get();
|
||||
const vehicle_local_position_s &vehicle_local_position = _local_position_sub.get();
|
||||
|
||||
if (!vehicle_local_position.xy_global || !vehicle_local_position.z_global) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &home = _home_position_pub.get();
|
||||
home_position_s &home = _home_position_pub.get();
|
||||
home.manual_home = true;
|
||||
|
||||
home.lat = lat;
|
||||
@@ -328,7 +328,7 @@ void HomePosition::update(bool set_automatically, bool check_if_changed)
|
||||
}
|
||||
|
||||
const vehicle_local_position_s &lpos = _local_position_sub.get();
|
||||
const auto &home = _home_position_pub.get();
|
||||
const home_position_s &home = _home_position_pub.get();
|
||||
|
||||
if (lpos.heading_reset_counter != _heading_reset_counter) {
|
||||
if (_valid && set_automatically) {
|
||||
|
||||
@@ -253,7 +253,7 @@ int do_gyro_calibration(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
for (unsigned uorb_index = 0; uorb_index < MAX_GYROS; uorb_index++) {
|
||||
|
||||
auto &calibration = worker_data.calibrations[uorb_index];
|
||||
calibration::Gyroscope &calibration = worker_data.calibrations[uorb_index];
|
||||
|
||||
if (calibration.device_id() != 0) {
|
||||
calibration.set_offset(worker_data.offset[uorb_index]);
|
||||
|
||||
@@ -905,7 +905,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
|
||||
|
||||
for (unsigned cur_mag = 0; cur_mag < MAX_MAGS; cur_mag++) {
|
||||
|
||||
auto ¤t_cal = worker_data.calibration[cur_mag];
|
||||
calibration::Magnetometer ¤t_cal = worker_data.calibration[cur_mag];
|
||||
|
||||
if (current_cal.device_id() != 0) {
|
||||
if (worker_data.append_to_existing_calibration) {
|
||||
|
||||
Reference in New Issue
Block a user