mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 11:23:33 +08:00
mavlink:Use inttypes
This commit is contained in:
committed by
Julian Oes
parent
5faa116681
commit
65d026d45c
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2012-2020 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
|
||||
@@ -1024,7 +1024,7 @@ Mavlink::compute_broadcast_addr(const in_addr &host_addr, const in_addr &netmask
|
||||
void
|
||||
Mavlink::init_udp()
|
||||
{
|
||||
PX4_DEBUG("Setting up UDP with port %d", _network_port);
|
||||
PX4_DEBUG("Setting up UDP with port %hu", _network_port);
|
||||
|
||||
_myaddr.sin_family = AF_INET;
|
||||
_myaddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
@@ -2139,7 +2139,7 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
|
||||
else if (get_protocol() == Protocol::UDP) {
|
||||
if (Mavlink::get_instance_for_network_port(_network_port) != nullptr) {
|
||||
PX4_ERR("port %d already occupied", _network_port);
|
||||
PX4_ERR("port %hu already occupied", _network_port);
|
||||
return PX4_ERROR;
|
||||
}
|
||||
|
||||
@@ -2315,7 +2315,7 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
|
||||
if (_vehicle_command_sub.update(&vehicle_cmd)) {
|
||||
if (_vehicle_command_sub.get_last_generation() != last_generation + 1) {
|
||||
PX4_ERR("vehicle_command lost, generation %d -> %d", last_generation, _vehicle_command_sub.get_last_generation());
|
||||
PX4_ERR("vehicle_command lost, generation %u -> %u", last_generation, _vehicle_command_sub.get_last_generation());
|
||||
}
|
||||
|
||||
if ((vehicle_cmd.command == vehicle_command_s::VEHICLE_CMD_CONTROL_HIGH_LATENCY) &&
|
||||
@@ -2366,7 +2366,7 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
|
||||
if (_vehicle_command_ack_sub.update(&command_ack)) {
|
||||
if (_vehicle_command_ack_sub.get_last_generation() != last_generation + 1) {
|
||||
PX4_ERR("vehicle_command_ack lost, generation %d -> %d", last_generation,
|
||||
PX4_ERR("vehicle_command_ack lost, generation %u -> %u", last_generation,
|
||||
_vehicle_command_ack_sub.get_last_generation());
|
||||
}
|
||||
|
||||
@@ -2573,7 +2573,7 @@ void Mavlink::check_requested_subscriptions()
|
||||
#if defined(MAVLINK_UDP)
|
||||
|
||||
else if (get_protocol() == Protocol::UDP) {
|
||||
PX4_DEBUG("stream %s on UDP port %d set to default rate", _subscribe_to_stream, _network_port);
|
||||
PX4_DEBUG("stream %s on UDP port %hu set to default rate", _subscribe_to_stream, _network_port);
|
||||
}
|
||||
|
||||
#endif // MAVLINK_UDP
|
||||
@@ -2593,7 +2593,7 @@ void Mavlink::check_requested_subscriptions()
|
||||
#if defined(MAVLINK_UDP)
|
||||
|
||||
else if (get_protocol() == Protocol::UDP) {
|
||||
PX4_DEBUG("stream %s on UDP port %d enabled with rate %.1f Hz", _subscribe_to_stream, _network_port,
|
||||
PX4_DEBUG("stream %s on UDP port %hu enabled with rate %.1f Hz", _subscribe_to_stream, _network_port,
|
||||
(double)_subscribe_to_stream_rate);
|
||||
}
|
||||
|
||||
@@ -2608,7 +2608,7 @@ void Mavlink::check_requested_subscriptions()
|
||||
#if defined(MAVLINK_UDP)
|
||||
|
||||
else if (get_protocol() == Protocol::UDP) {
|
||||
PX4_DEBUG("stream %s on UDP port %d disabled", _subscribe_to_stream, _network_port);
|
||||
PX4_DEBUG("stream %s on UDP port %hu disabled", _subscribe_to_stream, _network_port);
|
||||
}
|
||||
|
||||
#endif // MAVLINK_UDP
|
||||
@@ -2623,7 +2623,7 @@ void Mavlink::check_requested_subscriptions()
|
||||
#if defined(MAVLINK_UDP)
|
||||
|
||||
else if (get_protocol() == Protocol::UDP) {
|
||||
PX4_ERR("stream %s on UDP port %d not found", _subscribe_to_stream, _network_port);
|
||||
PX4_ERR("stream %s on UDP port %hu not found", _subscribe_to_stream, _network_port);
|
||||
}
|
||||
|
||||
#endif // MAVLINK_UDP
|
||||
@@ -2668,7 +2668,7 @@ void Mavlink::configure_sik_radio()
|
||||
|
||||
if (_param_sik_radio_id.get() > 0) {
|
||||
/* set channel */
|
||||
fprintf(fs, "ATS3=%u\n", _param_sik_radio_id.get());
|
||||
fprintf(fs, "ATS3=%" PRIu32 "\n", _param_sik_radio_id.get());
|
||||
px4_usleep(200000);
|
||||
|
||||
} else {
|
||||
@@ -2792,7 +2792,7 @@ Mavlink::display_status()
|
||||
printf("\tGCS heartbeat valid\n");
|
||||
}
|
||||
|
||||
printf("\tmavlink chan: #%u\n", _channel);
|
||||
printf("\tmavlink chan: #%u\n", static_cast<unsigned>(_channel));
|
||||
|
||||
if (_tstatus.timestamp > 0) {
|
||||
|
||||
@@ -2800,13 +2800,13 @@ Mavlink::display_status()
|
||||
|
||||
if (_radio_status_available) {
|
||||
printf("RADIO Link\n");
|
||||
printf("\t rssi:\t\t%d\n", _rstatus.rssi);
|
||||
printf("\t remote rssi:\t%u\n", _rstatus.remote_rssi);
|
||||
printf("\t txbuf:\t%u\n", _rstatus.txbuf);
|
||||
printf("\t noise:\t%d\n", _rstatus.noise);
|
||||
printf("\t remote noise:\t%u\n", _rstatus.remote_noise);
|
||||
printf("\t rx errors:\t%u\n", _rstatus.rxerrors);
|
||||
printf("\t fixed:\t%u\n", _rstatus.fix);
|
||||
printf("\t rssi:\t\t%" PRIu8 "\n", _rstatus.rssi);
|
||||
printf("\t remote rssi:\t%" PRIu8 "\n", _rstatus.remote_rssi);
|
||||
printf("\t txbuf:\t%" PRIu8 "\n", _rstatus.txbuf);
|
||||
printf("\t noise:\t%" PRIu8 "\n", _rstatus.noise);
|
||||
printf("\t remote noise:\t%" PRIu8 "\n", _rstatus.remote_noise);
|
||||
printf("\t rx errors:\t%" PRIu16 "\n", _rstatus.rxerrors);
|
||||
printf("\t fixed:\t%" PRIu16 "\n", _rstatus.fix);
|
||||
|
||||
} else if (_is_usb_uart) {
|
||||
printf("USB CDC\n");
|
||||
@@ -2838,7 +2838,7 @@ Mavlink::display_status()
|
||||
_ftp_on ? "YES" : "NO",
|
||||
_transmitting_enabled ? "YES" : "NO");
|
||||
printf("\tmode: %s\n", mavlink_mode_str(_mode));
|
||||
printf("\tMAVLink version: %i\n", _protocol_version);
|
||||
printf("\tMAVLink version: %" PRId32 "\n", _protocol_version);
|
||||
|
||||
printf("\ttransport protocol: ");
|
||||
|
||||
@@ -2846,7 +2846,7 @@ Mavlink::display_status()
|
||||
#if defined(MAVLINK_UDP)
|
||||
|
||||
case Protocol::UDP:
|
||||
printf("UDP (%i, remote port: %i)\n", _network_port, _remote_port);
|
||||
printf("UDP (%hu, remote port: %hu)\n", _network_port, _remote_port);
|
||||
printf("\tBroadcast enabled: %s\n",
|
||||
broadcast_enabled() ? "YES" : "NO");
|
||||
#if defined(CONFIG_NET_IGMP) && defined(CONFIG_NET_ROUTE)
|
||||
@@ -2874,7 +2874,7 @@ Mavlink::display_status()
|
||||
printf("\t mean: %0.2f ms\n", (double)_ping_stats.mean_rtt);
|
||||
printf("\t max: %0.2f ms\n", (double)_ping_stats.max_rtt);
|
||||
printf("\t min: %0.2f ms\n", (double)_ping_stats.min_rtt);
|
||||
printf("\t dropped packets: %u\n", _ping_stats.dropped_packets);
|
||||
printf("\t dropped packets: %" PRIi32 "\n", _ping_stats.dropped_packets);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2904,7 +2904,7 @@ Mavlink::display_status_streams()
|
||||
printf("\t%-30s%-16s", stream->get_name(), rate_str);
|
||||
|
||||
if (size > 0) {
|
||||
printf(" %3i\n", size);
|
||||
printf(" %3u\n", size);
|
||||
|
||||
} else {
|
||||
printf("\n");
|
||||
|
||||
Reference in New Issue
Block a user