mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-09 17:41:36 +08:00
mavlink: Replace CONFIG_NET with CONFIG_NET_UDP
Allows use of SocketCAN w/o also enabling UDP support in NuttX
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
|
||||
#include <termios.h>
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
#ifdef CONFIG_NET_UDP
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netutils/netlib.h>
|
||||
@@ -70,7 +70,7 @@
|
||||
#error The non-standard CRTSCTS define is incorrect. Fix this in the OS or replace with (CRTS_IFLOW | CCTS_OFLOW)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
#ifdef CONFIG_NET_UDP
|
||||
#define MAVLINK_NET_ADDED_STACK PX4_STACK_ADJUSTED(350)
|
||||
#else
|
||||
#define MAVLINK_NET_ADDED_STACK 0
|
||||
@@ -765,15 +765,15 @@ void Mavlink::send_finish()
|
||||
|
||||
else if (get_protocol() == Protocol::UDP) {
|
||||
|
||||
# if defined(CONFIG_NET)
|
||||
# if defined(CONFIG_NET_UDP)
|
||||
|
||||
if (_src_addr_initialized) {
|
||||
# endif // CONFIG_NET
|
||||
# endif // CONFIG_NET_UDP
|
||||
ret = sendto(_socket_fd, _buf, _buf_fill, 0, (struct sockaddr *)&_src_addr, sizeof(_src_addr));
|
||||
# if defined(CONFIG_NET)
|
||||
# if defined(CONFIG_NET_UDP)
|
||||
}
|
||||
|
||||
# endif // CONFIG_NET
|
||||
# endif // CONFIG_NET_UDP
|
||||
|
||||
if ((_mode != MAVLINK_MODE_ONBOARD) && broadcast_enabled() &&
|
||||
(!get_client_source_initialized() || !is_gcs_connected())) {
|
||||
@@ -1857,7 +1857,7 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
bool err_flag = false;
|
||||
int myoptind = 1;
|
||||
const char *myoptarg = nullptr;
|
||||
#if defined(CONFIG_NET) || defined(__PX4_POSIX)
|
||||
#if defined(CONFIG_NET_UDP) || defined(__PX4_POSIX)
|
||||
int temp_int_arg;
|
||||
#endif
|
||||
|
||||
@@ -3289,7 +3289,7 @@ $ mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('d', "/dev/ttyS1", "<file:dev>", "Select Serial Device", true);
|
||||
PRINT_MODULE_USAGE_PARAM_INT('b', 57600, 9600, 3000000, "Baudrate (can also be p:<param_name>)", true);
|
||||
PRINT_MODULE_USAGE_PARAM_INT('r', 0, 10, 10000000, "Maximum sending data rate in B/s (if 0, use baudrate / 20)", true);
|
||||
#if defined(CONFIG_NET) || defined(__PX4_POSIX)
|
||||
#if defined(CONFIG_NET_UDP) || defined(__PX4_POSIX)
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('p', "Enable Broadcast", true);
|
||||
PRINT_MODULE_USAGE_PARAM_INT('u', 14556, 0, 65536, "Select UDP Network Port (local)", true);
|
||||
PRINT_MODULE_USAGE_PARAM_INT('o', 14550, 0, 65536, "Select UDP Network Port (remote)", true);
|
||||
@@ -3310,7 +3310,7 @@ $ mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("stop-all", "Stop all instances");
|
||||
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("stop", "Stop a running instance");
|
||||
#if defined(CONFIG_NET) || defined(__PX4_POSIX)
|
||||
#if defined(CONFIG_NET_UDP) || defined(__PX4_POSIX)
|
||||
PRINT_MODULE_USAGE_PARAM_INT('u', -1, 0, 65536, "Select Mavlink instance via local Network Port", true);
|
||||
#endif
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('d', nullptr, "<file:dev>", "Select Mavlink instance via Serial Device", true);
|
||||
@@ -3320,7 +3320,7 @@ $ mavlink stream -u 14556 -s HIGHRES_IMU -r 50
|
||||
PRINT_MODULE_USAGE_ARG("streams", "Print all enabled streams", true);
|
||||
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("stream", "Configure the sending rate of a stream for a running instance");
|
||||
#if defined(CONFIG_NET) || defined(__PX4_POSIX)
|
||||
#if defined(CONFIG_NET_UDP) || defined(__PX4_POSIX)
|
||||
PRINT_MODULE_USAGE_PARAM_INT('u', -1, 0, 65536, "Select Mavlink instance via local Network Port", true);
|
||||
#endif
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('d', nullptr, "<file:dev>", "Select Mavlink instance via Serial Device", true);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NET) || !defined(__PX4_NUTTX)
|
||||
#if defined(CONFIG_NET_UDP) || !defined(__PX4_NUTTX)
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
@@ -90,7 +90,7 @@
|
||||
|
||||
#define HASH_PARAM "_HASH_CHECK"
|
||||
|
||||
#if defined(CONFIG_NET) || defined(__PX4_POSIX)
|
||||
#if defined(CONFIG_NET_UDP) || defined(__PX4_POSIX)
|
||||
# define MAVLINK_UDP
|
||||
# define DEFAULT_REMOTE_PORT_UDP 14550 ///< GCS port per MAVLink spec
|
||||
#endif // CONFIG_NET || __PX4_POSIX
|
||||
|
||||
Reference in New Issue
Block a user