mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 02:01:36 +08:00
rc_loss_alarm: addressing review comments (#9769)
This commit is contained in:
committed by
Beat Küng
parent
701d87912e
commit
9a4b26cd32
@@ -36,7 +36,6 @@ px4_add_module(
|
|||||||
MAIN rc_loss_alarm
|
MAIN rc_loss_alarm
|
||||||
STACK_MAIN 512
|
STACK_MAIN 512
|
||||||
COMPILE_FLAGS
|
COMPILE_FLAGS
|
||||||
-Wno-sign-compare # TODO: fix all sign-compare
|
|
||||||
SRCS
|
SRCS
|
||||||
rc_loss_alarm.cpp
|
rc_loss_alarm.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include <px4_defines.h>
|
#include <px4_defines.h>
|
||||||
|
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
#include <errno.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <uORB/topics/tune_control.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;
|
orb_advert_t RC_Loss_Alarm::_tune_control_pub = nullptr;
|
||||||
|
|
||||||
|
|
||||||
RC_Loss_Alarm::RC_Loss_Alarm()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RC_Loss_Alarm::~RC_Loss_Alarm()
|
RC_Loss_Alarm::~RC_Loss_Alarm()
|
||||||
{
|
{
|
||||||
work_cancel(LPWORK, &_work);
|
work_cancel(LPWORK, &_work);
|
||||||
@@ -162,6 +157,7 @@ void RC_Loss_Alarm::cycle()
|
|||||||
|
|
||||||
orb_check(_vehicle_status_sub, &updated);
|
orb_check(_vehicle_status_sub, &updated);
|
||||||
if(updated){
|
if(updated){
|
||||||
|
struct vehicle_status_s _vehicle_status = {};
|
||||||
orb_copy(ORB_ID(vehicle_status), _vehicle_status_sub, &_vehicle_status);
|
orb_copy(ORB_ID(vehicle_status), _vehicle_status_sub, &_vehicle_status);
|
||||||
|
|
||||||
if (!_was_armed &&
|
if (!_was_armed &&
|
||||||
|
|||||||
@@ -46,8 +46,12 @@
|
|||||||
class RC_Loss_Alarm: public ModuleBase<RC_Loss_Alarm>
|
class RC_Loss_Alarm: public ModuleBase<RC_Loss_Alarm>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RC_Loss_Alarm();
|
RC_Loss_Alarm() = default;
|
||||||
~RC_Loss_Alarm();
|
~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 */
|
/** @see ModuleBase */
|
||||||
static int task_spawn(int argc, char *argv[]);
|
static int task_spawn(int argc, char *argv[]);
|
||||||
@@ -61,7 +65,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
static struct work_s _work;
|
static struct work_s _work;
|
||||||
int _vehicle_status_sub = -1;
|
int _vehicle_status_sub = -1;
|
||||||
struct vehicle_status_s _vehicle_status = {};
|
|
||||||
static orb_advert_t _tune_control_pub;
|
static orb_advert_t _tune_control_pub;
|
||||||
static bool _was_armed;
|
static bool _was_armed;
|
||||||
static bool _had_rc; // Don't trigger alarm for systems without RC
|
static bool _had_rc; // Don't trigger alarm for systems without RC
|
||||||
@@ -71,10 +74,4 @@ private:
|
|||||||
static void pub_tune();
|
static void pub_tune();
|
||||||
static void stop_tune();
|
static void stop_tune();
|
||||||
static int reset_module();
|
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);
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user