some printf format and conversion fixes

This commit is contained in:
rfu
2020-03-31 15:14:45 +02:00
committed by Beat Küng
parent 90c3819df5
commit 8787780de4
8 changed files with 15 additions and 20 deletions

View File

@@ -51,7 +51,7 @@ ADC::ADC(uint32_t base_address, uint32_t channels) :
}
if (_channel_count > PX4_MAX_ADC_CHANNELS) {
PX4_ERR("PX4_MAX_ADC_CHANNELS is too small:is %d needed:%d", PX4_MAX_ADC_CHANNELS, _channel_count);
PX4_ERR("PX4_MAX_ADC_CHANNELS is too small (%d, %d)", (unsigned)PX4_MAX_ADC_CHANNELS, _channel_count);
}
_samples = new px4_adc_msg_t[_channel_count];

View File

@@ -180,7 +180,7 @@ private:
/**
* Sends an i2c measure command to check for presence of a sensor.
*/
int probe();
int probe() override;
/**
* Collects the most recent sensor measurement data from the i2c bus.
@@ -195,7 +195,7 @@ private:
px4::Array<uint8_t, RANGE_FINDER_MAX_SENSORS> _sensor_addresses {};
px4::Array<uint8_t, RANGE_FINDER_MAX_SENSORS> _sensor_rotations {};
size_t _sensor_count{0};
int _sensor_count{0};
orb_advert_t _distance_sensor_topic{nullptr};
@@ -245,7 +245,7 @@ MappyDot::collect()
perf_begin(_sample_perf);
// Increment the sensor index, (limited to the number of sensors connected).
for (size_t index = 0; index < _sensor_count; index++) {
for (int index = 0; index < _sensor_count; index++) {
// Set address of the current sensor to collect data from.
set_device_address(_sensor_addresses[index]);
@@ -332,7 +332,7 @@ MappyDot::init()
// Check for connected rangefinders on each i2c port,
// starting from the base address 0x08 and incrementing
for (size_t i = 0; i <= RANGE_FINDER_MAX_SENSORS; i++) {
for (int i = 0; i <= RANGE_FINDER_MAX_SENSORS; i++) {
set_device_address(MAPPYDOT_BASE_ADDR + i);
// Check if a sensor is present.

View File

@@ -149,11 +149,10 @@ private:
px4::Array<uint8_t, RANGE_FINDER_MAX_SENSORS> _sensor_rotations {};
int _measure_interval{MB12XX_MEASURE_INTERVAL}; // Initialize the measure interval for a single sensor.
int _orb_class_instance{-1};
size_t _sensor_index{0}; // Initialize counter for cycling i2c adresses to zero.
int _sensor_index{0}; // Initialize counter for cycling i2c adresses to zero.
size_t _sensor_count{0};
int _sensor_count{0};
orb_advert_t _distance_sensor_topic{nullptr};
@@ -347,8 +346,8 @@ MB12XX::print_status()
perf_print_counter(_comms_error);
PX4_INFO("poll interval: %ums", _measure_interval / 1000);
for (size_t i = 0; i < _sensor_count; i++) {
PX4_INFO("sensor: %u, address %u", i, _sensor_addresses[i]);
for (int i = 0; i < _sensor_count; i++) {
PX4_INFO("sensor: %i, address %u", i, _sensor_addresses[i]);
}
}

View File

@@ -113,9 +113,6 @@ private:
int _file_descriptor{-1};
unsigned int _head{0};
unsigned int _tail{0};
uint8_t _buffer[ULANDING_BUFFER_LENGTH] {};
perf_counter_t _comms_errors{perf_alloc(PC_COUNT, MODULE_NAME": com_err")};

View File

@@ -337,7 +337,7 @@ void RCInput::Run()
constexpr hrt_abstime rc_scan_max = 300_ms;
bool sbus_failsafe, sbus_frame_drop;
unsigned frame_drops;
unsigned frame_drops = 0;
bool dsm_11_bit;
if (_report_lock && _rc_scan_locked) {

View File

@@ -1087,8 +1087,7 @@ param_export(int fd, bool only_unsaved)
case PARAM_TYPE_INT32: {
const int32_t i = s->val.i;
PX4_DEBUG("exporting: %s (%d) size: %d val: %d", name, s->param, size, i);
PX4_DEBUG("exporting: %s (%d) size: %lu val: %d", name, s->param, (long unsigned int)size, i);
if (bson_encoder_append_int(&encoder, name, i)) {
PX4_ERR("BSON append failed for '%s'", name);
@@ -1099,8 +1098,7 @@ param_export(int fd, bool only_unsaved)
case PARAM_TYPE_FLOAT: {
const double f = (double)s->val.f;
PX4_DEBUG("exporting: %s (%d) size: %d val: %.3f", name, s->param, size, (double)f);
PX4_DEBUG("exporting: %s (%d) size: %lu val: %.3f", name, s->param, (long unsigned int)size, (double)f);
if (bson_encoder_append_double(&encoder, name, f)) {
PX4_ERR("BSON append failed for '%s'", name);

View File

@@ -44,7 +44,8 @@
void set_health_flags(uint64_t subsystem_type, bool present, bool enabled, bool ok, vehicle_status_s &status)
{
PX4_DEBUG("set_health_flags: Type %llu pres=%u enabl=%u ok=%u", subsystem_type, present, enabled, ok);
PX4_DEBUG("set_health_flags: Type %llu pres=%u enabl=%u ok=%u", (long long unsigned int)subsystem_type, present,
enabled, ok);
if (present) {
status.onboard_control_sensors_present |= (uint32_t)subsystem_type;

View File

@@ -198,7 +198,7 @@ void Sih::parameters_updated()
_LAT0 = (double)_sih_lat0.get() * 1.0e-7;
_LON0 = (double)_sih_lon0.get() * 1.0e-7;
_COS_LAT0 = cosl(radians(_LAT0));
_COS_LAT0 = cosl((long double)radians(_LAT0));
_MASS = _sih_mass.get();