Plane: add QuadPlane singleton

This commit is contained in:
Iampete1 2020-11-06 16:20:02 +00:00 committed by Andrew Tridgell
parent 7de14f2e2f
commit e4fbe64616
2 changed files with 13 additions and 0 deletions

View File

@ -597,6 +597,11 @@ QuadPlane::QuadPlane(AP_AHRS_NavEKF &_ahrs) :
{
AP_Param::setup_object_defaults(this, var_info);
AP_Param::setup_object_defaults(this, var_info2);
if (_singleton != nullptr) {
AP_HAL::panic("Can only be one Quadplane");
}
_singleton = this;
}
@ -3573,3 +3578,5 @@ bool QuadPlane::show_vtol_view() const
return show_vtol;
}
QuadPlane *QuadPlane::_singleton = nullptr;

View File

@ -43,6 +43,10 @@ public:
QuadPlane(AP_AHRS_NavEKF &_ahrs);
static QuadPlane *get_singleton() {
return _singleton;
}
// var_info for holding Parameter information
static const struct AP_Param::GroupInfo var_info[];
static const struct AP_Param::GroupInfo var_info2[];
@ -652,4 +656,6 @@ public:
uint8_t motor_count);
private:
void motor_test_stop();
static QuadPlane *_singleton;
};