From eeb8562c6e5dadc36e23b114dfe032635d258e6c Mon Sep 17 00:00:00 2001 From: Johan Jansen Date: Tue, 24 Mar 2015 10:10:11 +0100 Subject: [PATCH] LidarLite: Compile with weffc++ and fix all warnings --- src/drivers/ll40ls/LidarLiteI2C.cpp | 2 ++ src/drivers/ll40ls/LidarLiteI2C.h | 45 +++++++++++++++++++++++++++++ src/drivers/ll40ls/module.mk | 4 +-- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/drivers/ll40ls/LidarLiteI2C.cpp b/src/drivers/ll40ls/LidarLiteI2C.cpp index ce674293e8..244135a4a7 100644 --- a/src/drivers/ll40ls/LidarLiteI2C.cpp +++ b/src/drivers/ll40ls/LidarLiteI2C.cpp @@ -60,6 +60,7 @@ LidarLiteI2C::LidarLiteI2C(int bus, const char *path, int address) : I2C("LL40LS", path, bus, address, 100000), _min_distance(LL40LS_MIN_DISTANCE), _max_distance(LL40LS_MAX_DISTANCE), + _work(), _reports(nullptr), _sensor_ok(false), _measure_ticks(0), @@ -73,6 +74,7 @@ LidarLiteI2C::LidarLiteI2C(int bus, const char *path, int address) : _sensor_zero_resets(perf_alloc(PC_COUNT, "ll40ls_zero_resets")), _last_distance(0), _zero_counter(0), + _acquire_time_usec(0), _pause_measurements(false), _bus(bus) { diff --git a/src/drivers/ll40ls/LidarLiteI2C.h b/src/drivers/ll40ls/LidarLiteI2C.h index 6dec1a8825..c0e9d4ce4a 100644 --- a/src/drivers/ll40ls/LidarLiteI2C.h +++ b/src/drivers/ll40ls/LidarLiteI2C.h @@ -1,3 +1,44 @@ +/**************************************************************************** + * + * Copyright (c) 2014, 2015 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 + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name PX4 nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + + +/** + * @file LidarLiteI2C.h + * @author Allyson Kreft + * + * Driver for the PulsedLight Lidar-Lite range finders connected via I2C. + */ + #pragma once //Forward declaration @@ -139,4 +180,8 @@ private: * @param arg Instance pointer for the driver that is polling. */ static void cycle_trampoline(void *arg); + +private: + LidarLiteI2C(const LidarLiteI2C ©) = delete; + LidarLiteI2C operator=(const LidarLiteI2C &assignment) = delete; }; diff --git a/src/drivers/ll40ls/module.mk b/src/drivers/ll40ls/module.mk index d9a43940c1..a3a0ead55a 100644 --- a/src/drivers/ll40ls/module.mk +++ b/src/drivers/ll40ls/module.mk @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2013 PX4 Development Team. All rights reserved. +# Copyright (c) 2013-2015 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 @@ -40,4 +40,4 @@ MODULE_COMMAND = ll40ls SRCS = ll40ls.cpp \ LidarLiteI2C.cpp -MAXOPTIMIZATION = -Os +MAXOPTIMIZATION = -Os -Weffc++