mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
Plane: add QuadPlane singleton
This commit is contained in:
parent
7de14f2e2f
commit
e4fbe64616
@ -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;
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user