diff --git a/src/modules/commander/Arming/ArmAuthorization/ArmAuthorization.cpp b/src/modules/commander/Arming/ArmAuthorization/ArmAuthorization.cpp index d3d54c64b4..6541569be5 100644 --- a/src/modules/commander/Arming/ArmAuthorization/ArmAuthorization.cpp +++ b/src/modules/commander/Arming/ArmAuthorization/ArmAuthorization.cpp @@ -238,7 +238,7 @@ void arm_auth_update(hrt_abstime now, bool param_update) case vehicle_command_ack_s::VEHICLE_RESULT_ACCEPTED: mavlink_log_info(mavlink_log_pub, - "Arm auth: Authorized for the next %u seconds", + "Arm auth: Authorized for the next %" PRId32 " seconds", command_ack.result_param2); state = ARM_AUTH_MISSION_APPROVED; auth_timeout = command_ack.timestamp + (command_ack.result_param2 * 1000000); @@ -257,7 +257,8 @@ void arm_auth_update(hrt_abstime now, bool param_update) break; case vehicle_command_ack_s::ARM_AUTH_DENIED_REASON_INVALID_WAYPOINT: - mavlink_log_critical(mavlink_log_pub, "Arm auth: Denied, waypoint %i have a invalid value", command_ack.result_param2); + mavlink_log_critical(mavlink_log_pub, "Arm auth: Denied, waypoint %" PRId32 " have a invalid value", + command_ack.result_param2); break; case vehicle_command_ack_s::ARM_AUTH_DENIED_REASON_TIMEOUT: diff --git a/src/modules/commander/Arming/PreFlightCheck/checks/powerCheck.cpp b/src/modules/commander/Arming/PreFlightCheck/checks/powerCheck.cpp index 5e21e6fc38..66f3f69696 100644 --- a/src/modules/commander/Arming/PreFlightCheck/checks/powerCheck.cpp +++ b/src/modules/commander/Arming/PreFlightCheck/checks/powerCheck.cpp @@ -106,7 +106,7 @@ bool PreFlightCheck::powerCheck(orb_advert_t *mavlink_log_pub, const vehicle_sta success = false; if (report_fail) { - mavlink_log_critical(mavlink_log_pub, "Power redundancy not met: %d instead of %d", + mavlink_log_critical(mavlink_log_pub, "Power redundancy not met: %d instead of %" PRId32, power_module_count, required_power_module_count); } } diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index 10cabc1547..994a6317ce 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -2453,7 +2453,7 @@ Commander::run() if (_cmd_sub.copy(&cmd)) { if (_cmd_sub.get_last_generation() != last_generation + 1) { - PX4_ERR("vehicle_command lost, generation %d -> %d", last_generation, _cmd_sub.get_last_generation()); + PX4_ERR("vehicle_command lost, generation %u -> %u", last_generation, _cmd_sub.get_last_generation()); } if (handle_command(cmd)) { @@ -3460,7 +3460,8 @@ void Commander::mission_init() if (dm_read(DM_KEY_MISSION_STATE, 0, &mission, sizeof(mission_s)) == sizeof(mission_s)) { if (mission.dataman_id == DM_KEY_WAYPOINTS_OFFBOARD_0 || mission.dataman_id == DM_KEY_WAYPOINTS_OFFBOARD_1) { if (mission.count > 0) { - PX4_INFO("Mission #%d loaded, %u WPs, curr: %d", mission.dataman_id, mission.count, mission.current_seq); + PX4_INFO("Mission #%" PRIu8 " loaded, %" PRIu16 " WPs, curr: %" PRId32, mission.dataman_id, mission.count, + mission.current_seq); } } else { diff --git a/src/modules/commander/Commander.hpp b/src/modules/commander/Commander.hpp index 6b696295da..bd21611538 100644 --- a/src/modules/commander/Commander.hpp +++ b/src/modules/commander/Commander.hpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2017 PX4 Development Team. All rights reserved. + * Copyright (c) 2017, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,7 +33,6 @@ #pragma once - /* Helper classes */ #include "Arming/PreFlightCheck/PreFlightCheck.hpp" #include "failure_detector/FailureDetector.hpp" diff --git a/src/modules/commander/calibration_routines.cpp b/src/modules/commander/calibration_routines.cpp index a4f1e6f531..a5e645e315 100644 --- a/src/modules/commander/calibration_routines.cpp +++ b/src/modules/commander/calibration_routines.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012, 2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -345,7 +345,7 @@ bool calibrate_cancel_check(orb_advert_t *mavlink_log_pub, const hrt_abstime &ca } else { command_ack.result = vehicle_command_s::VEHICLE_CMD_RESULT_DENIED; - mavlink_log_critical(mavlink_log_pub, "command denied during calibration: %u", cmd.command); + mavlink_log_critical(mavlink_log_pub, "command denied during calibration: %" PRIu32, cmd.command); tune_negative(true); ret = false; } diff --git a/src/modules/commander/mag_calibration.cpp b/src/modules/commander/mag_calibration.cpp index 810bb4a625..b047a96715 100644 --- a/src/modules/commander/mag_calibration.cpp +++ b/src/modules/commander/mag_calibration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2013-2020 PX4 Development Team. All rights reserved. + * Copyright (c) 2013-2021 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -151,7 +151,7 @@ static bool reject_sample(float sx, float sy, float sz, float x[], float y[], fl float dist = sqrtf(dx * dx + dy * dy + dz * dz); if (dist < min_sample_dist) { - PX4_DEBUG("rejected X: %.3f Y: %.3f Z: %.3f (%.3f < %.3f) (%d/%d) ", (double)sx, (double)sy, (double)sz, (double)dist, + PX4_DEBUG("rejected X: %.3f Y: %.3f Z: %.3f (%.3f < %.3f) (%u/%u) ", (double)sx, (double)sy, (double)sz, (double)dist, (double)min_sample_dist, count, max_count); return true; @@ -188,14 +188,14 @@ static calibrate_return check_calibration_result(float offset_x, float offset_y, for (unsigned i = 0; i < num_finite; ++i) { if (!PX4_ISFINITE(must_be_finite[i])) { - calibration_log_emergency(mavlink_log_pub, "Retry calibration (sphere NaN, %u)", cur_mag); + calibration_log_emergency(mavlink_log_pub, "Retry calibration (sphere NaN, %" PRIu8 ")", cur_mag); return calibrate_return_error; } } // earth field between 0.25 and 0.65 Gauss if (sphere_radius < 0.2f || sphere_radius >= 0.7f) { - calibration_log_emergency(mavlink_log_pub, "Retry calibration (mag %u sphere radius invalid %.3f)", cur_mag, + calibration_log_emergency(mavlink_log_pub, "Retry calibration (mag %" PRIu8 " sphere radius invalid %.3f)", cur_mag, (double)sphere_radius); return calibrate_return_error; } @@ -205,7 +205,7 @@ static calibrate_return check_calibration_result(float offset_x, float offset_y, for (unsigned i = 0; i < num_positive; ++i) { if (should_be_positive[i] <= 0.0f) { - calibration_log_emergency(mavlink_log_pub, "Retry calibration (mag %u with non-positive scale)", cur_mag); + calibration_log_emergency(mavlink_log_pub, "Retry calibration (mag %" PRIu8 " with non-positive scale)", cur_mag); return calibrate_return_error; } } @@ -219,7 +219,7 @@ static calibrate_return check_calibration_result(float offset_x, float offset_y, static constexpr float MAG_MAX_OFFSET_LEN = 1.3f; if (fabsf(should_be_not_huge[i]) > MAG_MAX_OFFSET_LEN) { - calibration_log_critical(mavlink_log_pub, "Warning: mag %u with large offsets", cur_mag); + calibration_log_critical(mavlink_log_pub, "Warning: mag %" PRIu8 " with large offsets", cur_mag); break; } } @@ -440,7 +440,7 @@ static calibrate_return mag_calibration_worker(detect_orientation_return orienta } } - PX4_DEBUG("side counter %d / %d", calibration_counter_side, worker_data->calibration_points_perside); + PX4_DEBUG("side counter %u / %u", calibration_counter_side, worker_data->calibration_points_perside); } else { poll_errcount++; @@ -596,7 +596,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma if (ret == PX4_OK) { sphere_fit_success = true; - PX4_INFO("Mag: %d sphere radius: %.4f", cur_mag, (double)sphere_data.radius); + PX4_INFO("Mag: %" PRIu8 " sphere radius: %.4f", cur_mag, (double)sphere_data.radius); if (!sphere_fit_only) { int ellipsoid_ret = lm_mag_fit(worker_data.x[cur_mag], worker_data.y[cur_mag], worker_data.z[cur_mag], @@ -617,7 +617,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma } if (!sphere_fit_success && !ellipsoid_fit_success) { - calibration_log_emergency(mavlink_log_pub, "Retry calibration (unable to fit mag %u)", cur_mag); + calibration_log_emergency(mavlink_log_pub, "Retry calibration (unable to fit mag %" PRIu8 ")", cur_mag); result = calibrate_return_error; break; } @@ -646,7 +646,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma continue; } - printf("MAG %u with %u samples:\n", cur_mag, worker_data.calibration_counter_total[cur_mag]); + printf("MAG %" PRIu8 " with %u samples:\n", cur_mag, worker_data.calibration_counter_total[cur_mag]); printf("RAW -> CALIBRATED\n"); float scale_data[9] { @@ -811,7 +811,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma switch (worker_data.calibration[cur_mag].rotation_enum()) { case ROTATION_ROLL_90_PITCH_68_YAW_293: - PX4_INFO("[cal] External Mag: %d (%d), keeping manually configured rotation %d", cur_mag, + PX4_INFO("[cal] External Mag: %d (%" PRIu32 "), keeping manually configured rotation %" PRIu8, cur_mag, worker_data.calibration[cur_mag].device_id(), worker_data.calibration[cur_mag].rotation_enum()); continue; @@ -821,25 +821,27 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma if (smallest_check_passed && total_error_check_passed) { if (best_rotation != worker_data.calibration[cur_mag].rotation_enum()) { - calibration_log_info(mavlink_log_pub, "[cal] External Mag: %d (%d), determined rotation: %d", cur_mag, + calibration_log_info(mavlink_log_pub, "[cal] External Mag: %d (%" PRIu32 ")), determined rotation: %" PRIu8, cur_mag, worker_data.calibration[cur_mag].device_id(), best_rotation); worker_data.calibration[cur_mag].set_rotation(best_rotation); } else { - PX4_INFO("[cal] External Mag: %d (%d), no rotation change: %d", cur_mag, + PX4_INFO("[cal] External Mag: %d (%" PRIu32 ")), no rotation change: %d", cur_mag, worker_data.calibration[cur_mag].device_id(), best_rotation); } } else { - PX4_ERR("External Mag: %d (%d), determining rotation failed", cur_mag, worker_data.calibration[cur_mag].device_id()); + PX4_ERR("External Mag: %d (%" PRIu32 ")), determining rotation failed", cur_mag, + worker_data.calibration[cur_mag].device_id()); print_all_mse = true; } } else { // non-primary internal mags, warn if there seems to be a rotation relative to the first primary (internal_index) if (best_rotation != ROTATION_NONE) { - calibration_log_critical(mavlink_log_pub, "[cal] Internal Mag: %d (%d) rotation %d relative to primary %d (%d)", + calibration_log_critical(mavlink_log_pub, + "[cal] Internal Mag: %d (%" PRIu32 ") rotation %d relative to primary %d (%" PRIu32 ")", cur_mag, worker_data.calibration[cur_mag].device_id(), best_rotation, internal_index, worker_data.calibration[internal_index].device_id()); @@ -849,7 +851,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma if (print_all_mse) { for (int r = ROTATION_NONE; r < ROTATION_MAX; r++) { - PX4_ERR("%s Mag: %d (%d), rotation: %d, MSE: %.3f", + PX4_ERR("%s Mag: %d (%" PRIu32 "), rotation: %d, MSE: %.3f", worker_data.calibration[cur_mag].external() ? "External" : "Internal", cur_mag, worker_data.calibration[cur_mag].device_id(), r, (double)MSE[r]); }