From ddf172c75bcd74ac2195ec7bbcc63836b32dbfad Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 17 Aug 2016 14:28:16 +1000 Subject: [PATCH] Rover: AP_Arming: use callback in place of variable reference for home state --- APMrover2/AP_Arming.cpp | 7 +++++++ APMrover2/AP_Arming.h | 21 +++++++++++++++++++++ APMrover2/Rover.h | 6 +++--- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 APMrover2/AP_Arming.cpp create mode 100644 APMrover2/AP_Arming.h diff --git a/APMrover2/AP_Arming.cpp b/APMrover2/AP_Arming.cpp new file mode 100644 index 0000000000..c786548131 --- /dev/null +++ b/APMrover2/AP_Arming.cpp @@ -0,0 +1,7 @@ +#include "AP_Arming.h" +#include "Rover.h" + +enum HomeState AP_Arming_Rover::home_status() const +{ + return rover.home_is_set; +} diff --git a/APMrover2/AP_Arming.h b/APMrover2/AP_Arming.h new file mode 100644 index 0000000000..8037252359 --- /dev/null +++ b/APMrover2/AP_Arming.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +/* + a rover-specific arming class + */ +class AP_Arming_Rover : public AP_Arming +{ +public: + + AP_Arming_Rover(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass, + const AP_BattMonitor &battery) : + AP_Arming(ahrs_ref, baro, compass, battery) { + } + +protected: + + enum HomeState home_status() const override; +}; + diff --git a/APMrover2/Rover.h b/APMrover2/Rover.h index 36e5c35b3f..e07168d5ba 100644 --- a/APMrover2/Rover.h +++ b/APMrover2/Rover.h @@ -63,7 +63,7 @@ #include #include -#include +#include "AP_Arming.h" #include "compat.h" #include // Notify library @@ -93,7 +93,7 @@ public: friend class GCS_MAVLINK_Rover; friend class Parameters; friend class ParametersG2; - friend class AP_Arming; + friend class AP_Arming_Rover; Rover(void); @@ -152,7 +152,7 @@ private: #endif // Arming/Disarming management class - AP_Arming arming {ahrs, barometer, compass, battery, home_is_set}; + AP_Arming_Rover arming {ahrs, barometer, compass, battery}; AP_L1_Control L1_controller;