rc_loss_alarm: addressing review comments (#9769)

This commit is contained in:
Alessandro Simovic 2018-06-27 08:40:09 +02:00 committed by Beat Küng
parent 701d87912e
commit 9a4b26cd32
3 changed files with 6 additions and 14 deletions

View File

@ -36,7 +36,6 @@ px4_add_module(
MAIN rc_loss_alarm
STACK_MAIN 512
COMPILE_FLAGS
-Wno-sign-compare # TODO: fix all sign-compare
SRCS
rc_loss_alarm.cpp
DEPENDS

View File

@ -38,7 +38,6 @@
#include <px4_defines.h>
#include <drivers/drv_hrt.h>
#include <errno.h>
#include <stdint.h>
#include <uORB/topics/tune_control.h>
@ -50,10 +49,6 @@ bool RC_Loss_Alarm::_had_rc = false;
orb_advert_t RC_Loss_Alarm::_tune_control_pub = nullptr;
RC_Loss_Alarm::RC_Loss_Alarm()
{
}
RC_Loss_Alarm::~RC_Loss_Alarm()
{
work_cancel(LPWORK, &_work);
@ -162,6 +157,7 @@ void RC_Loss_Alarm::cycle()
orb_check(_vehicle_status_sub, &updated);
if(updated){
struct vehicle_status_s _vehicle_status = {};
orb_copy(ORB_ID(vehicle_status), _vehicle_status_sub, &_vehicle_status);
if (!_was_armed &&

View File

@ -46,8 +46,12 @@
class RC_Loss_Alarm: public ModuleBase<RC_Loss_Alarm>
{
public:
RC_Loss_Alarm();
RC_Loss_Alarm() = default;
~RC_Loss_Alarm();
RC_Loss_Alarm(const RC_Loss_Alarm &other) = delete;
RC_Loss_Alarm(const RC_Loss_Alarm &&other) = delete;
RC_Loss_Alarm &operator= (const RC_Loss_Alarm &other) = delete;
RC_Loss_Alarm &operator= (const RC_Loss_Alarm &&other) = delete;
/** @see ModuleBase */
static int task_spawn(int argc, char *argv[]);
@ -61,7 +65,6 @@ public:
private:
static struct work_s _work;
int _vehicle_status_sub = -1;
struct vehicle_status_s _vehicle_status = {};
static orb_advert_t _tune_control_pub;
static bool _was_armed;
static bool _had_rc; // Don't trigger alarm for systems without RC
@ -71,10 +74,4 @@ private:
static void pub_tune();
static void stop_tune();
static int reset_module();
// Hide all but the default constructor
RC_Loss_Alarm(const RC_Loss_Alarm &other);
RC_Loss_Alarm(const RC_Loss_Alarm &&other);
RC_Loss_Alarm &operator= (const RC_Loss_Alarm &other);
RC_Loss_Alarm &operator= (const RC_Loss_Alarm &&other);
};