Browse Source

distance_sensor: Use inttypes

release/1.12
David Sidrane 4 years ago committed by Julian Oes
parent
commit
810e9e174f
  1. 6
      src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp
  2. 5
      src/drivers/distance_sensor/lightware_laser_serial/lightware_laser_serial.cpp
  3. 20
      src/drivers/distance_sensor/ll40ls/LidarLiteI2C.cpp
  4. 4
      src/drivers/distance_sensor/ll40ls_pwm/LidarLitePWM.cpp
  5. 2
      src/drivers/distance_sensor/ll40ls_pwm/LidarLitePWM.h
  6. 2
      src/drivers/distance_sensor/srf05/SRF05.cpp
  7. 9
      src/drivers/distance_sensor/teraranger/TERARANGER.cpp
  8. 2
      src/drivers/distance_sensor/teraranger/TERARANGER.hpp
  9. 4
      src/drivers/distance_sensor/tfmini/TFMINI.cpp
  10. 2
      src/drivers/distance_sensor/tfmini/TFMINI.hpp

6
src/drivers/distance_sensor/lightware_laser_i2c/lightware_laser_i2c.cpp

@ -200,7 +200,7 @@ int LightwareLaser::init() @@ -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() @@ -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() @@ -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);

5
src/drivers/distance_sensor/lightware_laser_serial/lightware_laser_serial.cpp

@ -1,6 +1,6 @@ @@ -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 @@ @@ -33,6 +33,7 @@
#include "lightware_laser_serial.hpp"
#include <inttypes.h>
#include <fcntl.h>
#include <termios.h>
@ -127,7 +128,7 @@ LightwareLaserSerial::init() @@ -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;
}

20
src/drivers/distance_sensor/ll40ls/LidarLiteI2C.cpp

@ -1,6 +1,6 @@ @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -273,10 +271,10 @@ LidarLiteI2C::print_registers()
int ret = lidar_transfer(&reg, 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) {

4
src/drivers/distance_sensor/ll40ls_pwm/LidarLitePWM.cpp

@ -1,6 +1,6 @@ @@ -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() @@ -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

2
src/drivers/distance_sensor/ll40ls_pwm/LidarLitePWM.h

@ -1,6 +1,6 @@ @@ -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

2
src/drivers/distance_sensor/srf05/SRF05.cpp

@ -245,7 +245,7 @@ SRF05::print_status() @@ -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;
}

9
src/drivers/distance_sensor/teraranger/TERARANGER.cpp

@ -1,6 +1,6 @@ @@ -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() @@ -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() @@ -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;

2
src/drivers/distance_sensor/teraranger/TERARANGER.hpp

@ -1,6 +1,6 @@ @@ -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

4
src/drivers/distance_sensor/tfmini/TFMINI.cpp

@ -1,6 +1,6 @@ @@ -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() @@ -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;
}

2
src/drivers/distance_sensor/tfmini/TFMINI.hpp

@ -1,6 +1,6 @@ @@ -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

Loading…
Cancel
Save