diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-16 08:20:48 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-16 08:20:48 +0200 |
commit | 9470ac4e0f7ce9171789f1fed1a8c052db014773 (patch) | |
tree | a1bddf72a6b84e944348dbbf9f9c7c4de99b9dbf | |
parent | 5b38b5e37170ffb079ef228f117f7e8b594353c8 (diff) | |
parent | c67f76e0c7049b408c918702e09307747e02642f (diff) | |
download | px4-firmware-9470ac4e0f7ce9171789f1fed1a8c052db014773.tar.gz px4-firmware-9470ac4e0f7ce9171789f1fed1a8c052db014773.tar.bz2 px4-firmware-9470ac4e0f7ce9171789f1fed1a8c052db014773.zip |
Merge branch 'master' of github.com:PX4/Firmware into sensor_startup_cleanup
-rw-r--r-- | src/drivers/device/device.h | 5 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_commands.cpp | 7 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_ftp.cpp | 16 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_main.cpp | 10 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_main.h | 4 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_mission.h | 4 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_orb_subscription.h | 4 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_receiver.cpp | 12 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_receiver.h | 4 | ||||
-rw-r--r-- | src/modules/mavlink/mavlink_stream.h | 4 | ||||
-rw-r--r-- | src/modules/mavlink/module.mk | 2 |
11 files changed, 57 insertions, 15 deletions
diff --git a/src/drivers/device/device.h b/src/drivers/device/device.h index 7df234cab..2d105bb79 100644 --- a/src/drivers/device/device.h +++ b/src/drivers/device/device.h @@ -240,6 +240,7 @@ private: * @param context Pointer to the interrupted context. */ static void dev_interrupt(int irq, void *context); + }; /** @@ -469,6 +470,10 @@ private: * @return OK, or -errno on error. */ int remove_poll_waiter(struct pollfd *fds); + + /* do not allow copying this class */ + CDev(const CDev&); + CDev operator=(const CDev&); }; /** diff --git a/src/modules/mavlink/mavlink_commands.cpp b/src/modules/mavlink/mavlink_commands.cpp index fccd4d9a5..b502c3c86 100644 --- a/src/modules/mavlink/mavlink_commands.cpp +++ b/src/modules/mavlink/mavlink_commands.cpp @@ -40,9 +40,12 @@ #include "mavlink_commands.h" -MavlinkCommandsStream::MavlinkCommandsStream(Mavlink *mavlink, mavlink_channel_t channel) : _channel(channel), _cmd_time(0) +MavlinkCommandsStream::MavlinkCommandsStream(Mavlink *mavlink, mavlink_channel_t channel) : + _cmd_sub(mavlink->add_orb_subscription(ORB_ID(vehicle_command))), + _cmd{}, + _channel(channel), + _cmd_time(0) { - _cmd_sub = mavlink->add_orb_subscription(ORB_ID(vehicle_command)); } void diff --git a/src/modules/mavlink/mavlink_ftp.cpp b/src/modules/mavlink/mavlink_ftp.cpp index 675a6870e..6a2c900af 100644 --- a/src/modules/mavlink/mavlink_ftp.cpp +++ b/src/modules/mavlink/mavlink_ftp.cpp @@ -50,16 +50,20 @@ MavlinkFTP::getServer() return _server; } -MavlinkFTP::MavlinkFTP() +MavlinkFTP::MavlinkFTP() : + _session_fds{}, + _workBufs{}, + _workFree{}, + _lock{} { // initialise the request freelist dq_init(&_workFree); sem_init(&_lock, 0, 1); - - // initialize session list - for (size_t i=0; i<kMaxSession; i++) { - _session_fds[i] = -1; - } + + // initialize session list + for (size_t i=0; i<kMaxSession; i++) { + _session_fds[i] = -1; + } // drop work entries onto the free list for (unsigned i = 0; i < kRequestQueueSize; i++) { diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp index cd0581af4..76b5459a3 100644 --- a/src/modules/mavlink/mavlink_main.cpp +++ b/src/modules/mavlink/mavlink_main.cpp @@ -216,6 +216,7 @@ Mavlink::Mavlink() : _device_name(DEFAULT_DEVICE_NAME), _task_should_exit(false), next(nullptr), + _instance_id(0), _mavlink_fd(-1), _task_running(false), _hil_enabled(false), @@ -230,17 +231,24 @@ Mavlink::Mavlink() : _mission_pub(-1), _mission_result_sub(-1), _mode(MAVLINK_MODE_NORMAL), + _channel(MAVLINK_COMM_0), + _logbuffer{}, _total_counter(0), + _receive_thread{}, _verbose(false), _forwarding_on(false), _passing_on(false), _ftp_on(false), _uart_fd(-1), + _baudrate(57600), + _datarate(10000), _mavlink_param_queue_index(0), + mavlink_link_termination_allowed(false), _subscribe_to_stream(nullptr), _subscribe_to_stream_rate(0.0f), _flow_control_enabled(true), - _message_buffer({}), + _message_buffer{}, + _message_buffer_mutex{}, _param_initialized(false), _param_system_id(0), _param_component_id(0), diff --git a/src/modules/mavlink/mavlink_main.h b/src/modules/mavlink/mavlink_main.h index acfc8b90e..da989d6c5 100644 --- a/src/modules/mavlink/mavlink_main.h +++ b/src/modules/mavlink/mavlink_main.h @@ -372,4 +372,8 @@ private: * Main mavlink task. */ int task_main(int argc, char *argv[]); + + /* do not allow copying this class */ + Mavlink(const Mavlink&); + Mavlink operator=(const Mavlink&); }; diff --git a/src/modules/mavlink/mavlink_mission.h b/src/modules/mavlink/mavlink_mission.h index f63c32f24..b792b9aaf 100644 --- a/src/modules/mavlink/mavlink_mission.h +++ b/src/modules/mavlink/mavlink_mission.h @@ -174,4 +174,8 @@ private: mavlink_channel_t _channel; uint8_t _comp_id; + + /* do not allow copying this class */ + MavlinkMissionManager(const MavlinkMissionManager&); + MavlinkMissionManager operator=(const MavlinkMissionManager&); }; diff --git a/src/modules/mavlink/mavlink_orb_subscription.h b/src/modules/mavlink/mavlink_orb_subscription.h index 71efb43af..7af454df6 100644 --- a/src/modules/mavlink/mavlink_orb_subscription.h +++ b/src/modules/mavlink/mavlink_orb_subscription.h @@ -82,6 +82,10 @@ private: const orb_id_t _topic; ///< topic metadata int _fd; ///< subscription handle bool _published; ///< topic was ever published + + /* do not allow copying this class */ + MavlinkOrbSubscription(const MavlinkOrbSubscription&); + MavlinkOrbSubscription operator=(const MavlinkOrbSubscription&); }; diff --git a/src/modules/mavlink/mavlink_receiver.cpp b/src/modules/mavlink/mavlink_receiver.cpp index 99ec98ee9..4740f674d 100644 --- a/src/modules/mavlink/mavlink_receiver.cpp +++ b/src/modules/mavlink/mavlink_receiver.cpp @@ -86,7 +86,9 @@ static const float mg2ms2 = CONSTANTS_ONE_G / 1000.0f; MavlinkReceiver::MavlinkReceiver(Mavlink *parent) : _mavlink(parent), - + status{}, + hil_local_pos{}, + _control_mode{}, _global_pos_pub(-1), _local_pos_pub(-1), _attitude_pub(-1), @@ -111,15 +113,13 @@ MavlinkReceiver::MavlinkReceiver(Mavlink *parent) : _manual_pub(-1), _telemetry_heartbeat_time(0), _radio_status_available(false), - _control_mode_sub(-1), + _control_mode_sub(orb_subscribe(ORB_ID(vehicle_control_mode))), _hil_frames(0), _old_timestamp(0), _hil_local_proj_inited(0), - _hil_local_alt0(0.0) + _hil_local_alt0(0.0f), + _hil_local_proj_ref{} { - _control_mode_sub = orb_subscribe(ORB_ID(vehicle_control_mode)); - memset(&hil_local_pos, 0, sizeof(hil_local_pos)); - memset(&_control_mode, 0, sizeof(_control_mode)); // make sure the FTP server is started (void)MavlinkFTP::getServer(); diff --git a/src/modules/mavlink/mavlink_receiver.h b/src/modules/mavlink/mavlink_receiver.h index 8d38b9973..b64a060e3 100644 --- a/src/modules/mavlink/mavlink_receiver.h +++ b/src/modules/mavlink/mavlink_receiver.h @@ -156,4 +156,8 @@ private: bool _hil_local_proj_inited; float _hil_local_alt0; struct map_projection_reference_s _hil_local_proj_ref; + + /* do not allow copying this class */ + MavlinkReceiver(const MavlinkReceiver&); + MavlinkReceiver operator=(const MavlinkReceiver&); }; diff --git a/src/modules/mavlink/mavlink_stream.h b/src/modules/mavlink/mavlink_stream.h index 69809a386..20e1c7c44 100644 --- a/src/modules/mavlink/mavlink_stream.h +++ b/src/modules/mavlink/mavlink_stream.h @@ -77,6 +77,10 @@ protected: private: hrt_abstime _last_sent; + + /* do not allow top copying this class */ + MavlinkStream(const MavlinkStream&); + MavlinkStream& operator=(const MavlinkStream&); }; diff --git a/src/modules/mavlink/module.mk b/src/modules/mavlink/module.mk index d49bbb7f7..1986ae3c8 100644 --- a/src/modules/mavlink/module.mk +++ b/src/modules/mavlink/module.mk @@ -52,3 +52,5 @@ INCLUDE_DIRS += $(MAVLINK_SRC)/include/mavlink MAXOPTIMIZATION = -Os MODULE_STACKSIZE = 1024 + +EXTRACXXFLAGS = -Weffc++ |