ArduPlane: use static method to construct AP_Arming_Plane

This commit is contained in:
Lucas De Marchi 2017-08-30 12:48:12 -07:00 committed by Francisco Ferreira
parent 5ec1430726
commit 2d2876a226
2 changed files with 17 additions and 5 deletions

View File

@ -14,11 +14,16 @@ public:
ARMING_RUDDER_ARMDISARM = 2
};
AP_Arming_Plane(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass,
const AP_BattMonitor &battery) :
AP_Arming(ahrs_ref, baro, compass, battery) {
AP_Param::setup_object_defaults(this, var_info);
static AP_Arming_Plane create(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass, const AP_BattMonitor &battery) {
return AP_Arming_Plane{ahrs_ref, baro, compass, battery};
}
constexpr AP_Arming_Plane(AP_Arming_Plane &&other) = default;
/* Do not allow copies */
AP_Arming_Plane(const AP_Arming_Plane &other) = delete;
AP_Arming_Plane &operator=(const AP_Baro&) = delete;
bool pre_arm_checks(bool report);
ArmingRudder rudder_arming() const { return (ArmingRudder)rudder_arming_value.get(); }
@ -27,6 +32,13 @@ public:
static const struct AP_Param::GroupInfo var_info[];
protected:
AP_Arming_Plane(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass,
const AP_BattMonitor &battery)
: AP_Arming(ahrs_ref, baro, compass, battery)
{
AP_Param::setup_object_defaults(this, var_info);
}
bool ins_checks(bool report);
enum HomeState home_status() const override;

View File

@ -772,7 +772,7 @@ private:
#endif
// Arming/Disarming mangement class
AP_Arming_Plane arming {ahrs, barometer, compass, battery};
AP_Arming_Plane arming = AP_Arming_Plane::create(ahrs, barometer, compass, battery);
AP_Param param_loader {var_info};