AC_Fence: add static create method

This commit is contained in:
Lucas De Marchi 2017-08-29 16:06:10 -07:00 committed by Francisco Ferreira
parent 18aa88b329
commit 52686ec838
1 changed files with 9 additions and 2 deletions

View File

@ -35,9 +35,15 @@
class AC_Fence class AC_Fence
{ {
public: public:
static AC_Fence create(const AP_AHRS &ahrs, const AP_InertialNav &inav) {
return AC_Fence{ahrs, inav};
}
/// Constructor constexpr AC_Fence(AC_Fence &&other) = default;
AC_Fence(const AP_AHRS& ahrs, const AP_InertialNav& inav);
/* Do not allow copies */
AC_Fence(const AC_Fence &other) = delete;
AC_Fence &operator=(const AC_Fence&) = delete;
/// enable - allows fence to be enabled/disabled. Note: this does not update the eeprom saved value /// enable - allows fence to be enabled/disabled. Note: this does not update the eeprom saved value
void enable(bool value); void enable(bool value);
@ -117,6 +123,7 @@ public:
static const struct AP_Param::GroupInfo var_info[]; static const struct AP_Param::GroupInfo var_info[];
private: private:
AC_Fence(const AP_AHRS &ahrs, const AP_InertialNav &inav);
/// record_breach - update breach bitmask, time and count /// record_breach - update breach bitmask, time and count
void record_breach(uint8_t fence_type); void record_breach(uint8_t fence_type);