mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 14:58:53 +08:00
distance_sensor: Use inttypes
This commit is contained in:
committed by
Julian Oes
parent
c12a3330b8
commit
810e9e174f
@@ -200,7 +200,7 @@ int LightwareLaser::init()
|
||||
break;
|
||||
|
||||
default:
|
||||
PX4_ERR("invalid HW model %d.", hw_model);
|
||||
PX4_ERR("invalid HW model %" PRId32 ".", hw_model);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ int LightwareLaser::enableI2CBinaryProtocol()
|
||||
return ret;
|
||||
}
|
||||
|
||||
PX4_DEBUG("protocol values: 0x%x 0x%x", value[0], value[1]);
|
||||
PX4_DEBUG("protocol values: 0x%" PRIx8 " 0x%" PRIx8, value[0], value[1]);
|
||||
|
||||
return (value[0] == 0xcc && value[1] == 0x00) ? 0 : -1;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ int LightwareLaser::collect()
|
||||
perf_end(_sample_perf);
|
||||
|
||||
// compare different outputs (median filter adds about 25ms delay)
|
||||
PX4_DEBUG("fm: %4i, fs: %2i%%, lm: %4i, lr: %4i, fs: %2i%%, n: %i",
|
||||
PX4_DEBUG("fm: %4" PRIi16 ", fs: %2" PRIi16 "%%, lm: %4" PRIi16 ", lr: %4" PRIi16 ", fs: %2" PRIi16 "%%, n: %" PRIi16,
|
||||
data.first_return_median, data.first_return_strength, data.last_return_median, data.last_return_raw,
|
||||
data.last_return_strength, data.background_noise);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2014-2019 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2014-2019, 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,6 +33,7 @@
|
||||
|
||||
#include "lightware_laser_serial.hpp"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
|
||||
@@ -127,7 +128,7 @@ LightwareLaserSerial::init()
|
||||
break;
|
||||
|
||||
default:
|
||||
PX4_ERR("invalid HW model %d.", hw_model);
|
||||
PX4_ERR("invalid HW model %" PRIi32 ".", hw_model);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2014-2019 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2014-2019, 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
|
||||
@@ -83,7 +83,7 @@ LidarLiteI2C::print_status()
|
||||
perf_print_counter(_comms_errors);
|
||||
perf_print_counter(_sensor_resets);
|
||||
perf_print_counter(_sensor_zero_resets);
|
||||
printf("poll interval: %u \n", get_measure_interval());
|
||||
printf("poll interval: %" PRIu32 "\n", get_measure_interval());
|
||||
}
|
||||
|
||||
int
|
||||
@@ -152,12 +152,12 @@ LidarLiteI2C::probe()
|
||||
|
||||
if (_unit_id > 0) {
|
||||
// v2
|
||||
PX4_INFO("probe success - hw: %u, sw:%u, id: %u", _hw_version, _sw_version, _unit_id);
|
||||
PX4_INFO("probe success - hw: %" PRIu8 ", sw:%" PRIu8 ", id: %" PRIu16, _hw_version, _sw_version, _unit_id);
|
||||
_px4_rangefinder.set_max_distance(LL40LS_MAX_DISTANCE_V2);
|
||||
|
||||
} else {
|
||||
// v1 and v3
|
||||
PX4_INFO("probe success - hw: %u, sw:%u", _hw_version, _sw_version);
|
||||
PX4_INFO("probe success - hw: %" PRIu8 ", sw:%" PRIu8, _hw_version, _sw_version);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -165,7 +165,7 @@ LidarLiteI2C::probe()
|
||||
if (_unit_id > 0) {
|
||||
// v3hp
|
||||
_is_v3hp = true;
|
||||
PX4_INFO("probe success - id: %u", _unit_id);
|
||||
PX4_INFO("probe success - id: %" PRIu16, _unit_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,10 +173,8 @@ LidarLiteI2C::probe()
|
||||
return OK;
|
||||
}
|
||||
|
||||
PX4_DEBUG("probe failed unit_id=0x%02x hw_version=0x%02x sw_version=0x%02x",
|
||||
(unsigned)_unit_id,
|
||||
(unsigned)_hw_version,
|
||||
(unsigned)_sw_version);
|
||||
PX4_DEBUG("probe failed unit_id=0x%02" PRIx16 " hw_version=0x%02" PRIu8 " sw_version=0x%02" PRIu8,
|
||||
_unit_id, _hw_version, _sw_version);
|
||||
|
||||
}
|
||||
|
||||
@@ -273,10 +271,10 @@ LidarLiteI2C::print_registers()
|
||||
int ret = lidar_transfer(®, 1, &val, 1);
|
||||
|
||||
if (ret != OK) {
|
||||
printf("%02x:XX ", (unsigned)reg);
|
||||
printf("%02" PRIx8 ":XX ", reg);
|
||||
|
||||
} else {
|
||||
printf("%02x:%02x ", (unsigned)reg, (unsigned)val);
|
||||
printf("%02" PRIx8 ":%02" PRIu8, reg, val);
|
||||
}
|
||||
|
||||
if (reg % 16 == 15) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2014-2019 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2014-2019, 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
|
||||
@@ -145,7 +145,7 @@ LidarLitePWM::print_info()
|
||||
perf_print_counter(_comms_errors);
|
||||
perf_print_counter(_sensor_resets);
|
||||
perf_print_counter(_sensor_zero_resets);
|
||||
printf("poll interval: %u \n", get_measure_interval());
|
||||
printf("poll interval: %" PRIu32 " \n", get_measure_interval());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2014-2019 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2014-2019, 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
|
||||
|
||||
@@ -245,7 +245,7 @@ SRF05::print_status()
|
||||
perf_print_counter(_sample_perf);
|
||||
perf_print_counter(_comms_errors);
|
||||
perf_print_counter(_sensor_resets);
|
||||
printf("poll interval: %u \n", get_measure_interval());
|
||||
printf("poll interval: %" PRIu32 " \n", get_measure_interval());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -208,7 +208,7 @@ int TERARANGER::init()
|
||||
break;
|
||||
|
||||
default:
|
||||
PX4_ERR("invalid HW model %d.", hw_model);
|
||||
PX4_ERR("invalid HW model %" PRId32 ".", hw_model);
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
@@ -244,9 +244,8 @@ int TERARANGER::probe()
|
||||
}
|
||||
}
|
||||
|
||||
PX4_DEBUG("WHO_AM_I byte mismatch 0x%02x should be 0x%02x\n",
|
||||
(unsigned)who_am_i,
|
||||
TERARANGER_WHO_AM_I_REG_VAL);
|
||||
PX4_DEBUG("WHO_AM_I byte mismatch 0x%02" PRIx8 " should be 0x%02" PRIx8 "\n",
|
||||
who_am_i, TERARANGER_WHO_AM_I_REG_VAL);
|
||||
|
||||
// Not found on any address.
|
||||
return -EIO;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2017-2019 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2017-2019, 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
|
||||
@@ -88,7 +88,7 @@ TFMINI::init()
|
||||
break;
|
||||
|
||||
default:
|
||||
PX4_ERR("invalid HW model %d.", hw_model);
|
||||
PX4_ERR("invalid HW model %" PRId32 ".", hw_model);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2017-2019 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2017-2019, 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
|
||||
|
||||
Reference in New Issue
Block a user