Rover: AP_Arming: use callback in place of variable reference for home state

This commit is contained in:
Peter Barker 2016-08-17 14:28:16 +10:00 committed by Randy Mackay
parent 362c6e1b9e
commit ddf172c75b
3 changed files with 31 additions and 3 deletions

7
APMrover2/AP_Arming.cpp Normal file
View File

@ -0,0 +1,7 @@
#include "AP_Arming.h"
#include "Rover.h"
enum HomeState AP_Arming_Rover::home_status() const
{
return rover.home_is_set;
}

21
APMrover2/AP_Arming.h Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include <AP_Arming/AP_Arming.h>
/*
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;
};

View File

@ -63,7 +63,7 @@
#include <AP_BoardConfig/AP_BoardConfig.h> #include <AP_BoardConfig/AP_BoardConfig.h>
#include <AP_Frsky_Telem/AP_Frsky_Telem.h> #include <AP_Frsky_Telem/AP_Frsky_Telem.h>
#include <AP_Arming/AP_Arming.h> #include "AP_Arming.h"
#include "compat.h" #include "compat.h"
#include <AP_Notify/AP_Notify.h> // Notify library #include <AP_Notify/AP_Notify.h> // Notify library
@ -93,7 +93,7 @@ public:
friend class GCS_MAVLINK_Rover; friend class GCS_MAVLINK_Rover;
friend class Parameters; friend class Parameters;
friend class ParametersG2; friend class ParametersG2;
friend class AP_Arming; friend class AP_Arming_Rover;
Rover(void); Rover(void);
@ -152,7 +152,7 @@ private:
#endif #endif
// Arming/Disarming management class // 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; AP_L1_Control L1_controller;