From dd4be8aecfb1c22793b086d2e8b7859dda37768e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Thu, 24 Aug 2017 13:51:09 +0200 Subject: [PATCH] mavlink: only enable FTP if -x flag is provided --- src/modules/mavlink/mavlink_main.cpp | 2 +- src/modules/mavlink/mavlink_main.h | 2 ++ src/modules/mavlink/mavlink_receiver.cpp | 12 +++++++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index 889da7f77c..bb28a62b17 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -2604,7 +2604,7 @@ Mavlink::display_status() (double)_mavlink_ulog->maximum_data_rate() * 100.); } - printf("\taccepting commands: %s\n", (accepting_commands()) ? "YES" : "NO"); + printf("\taccepting commands: %s, FTP enabled: %s\n", accepting_commands() ? "YES" : "NO", _ftp_on ? "YES" : "NO"); printf("\tMAVLink version: %i\n", _protocol_version); printf("\ttransport protocol: "); diff --git a/src/modules/mavlink/mavlink_main.h b/src/modules/mavlink/mavlink_main.h index 29710a89f8..8db741b93b 100644 --- a/src/modules/mavlink/mavlink_main.h +++ b/src/modules/mavlink/mavlink_main.h @@ -476,6 +476,8 @@ public: void set_uorb_main_fd(int fd, unsigned int interval); + bool ftp_enabled() const { return _ftp_on; } + protected: Mavlink *next; diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 036aaf726c..aa8e9ca27e 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -2483,8 +2483,10 @@ MavlinkReceiver::receive_thread(void *arg) /* handle packet with parameter component */ _parameters_manager.handle_message(&msg); - /* handle packet with ftp component */ - _mavlink_ftp.handle_message(&msg); + if (_mavlink->ftp_enabled()) { + /* handle packet with ftp component */ + _mavlink_ftp.handle_message(&msg); + } /* handle packet with log component */ _mavlink_log_handler.handle_message(&msg); @@ -2507,7 +2509,11 @@ MavlinkReceiver::receive_thread(void *arg) _mission_manager.check_active_mission(); _mission_manager.send(t); _parameters_manager.send(t); - _mavlink_ftp.send(t); + + if (_mavlink->ftp_enabled()) { + _mavlink_ftp.send(t); + } + _mavlink_log_handler.send(t); last_send_update = t;