mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Airspeed: move setting of first backend defualts to constructor to avoid race
This commit is contained in:
parent
f5320f1691
commit
3299976eae
@ -186,6 +186,13 @@ AP_Airspeed::AP_Airspeed()
|
|||||||
{
|
{
|
||||||
AP_Param::setup_object_defaults(this, var_info);
|
AP_Param::setup_object_defaults(this, var_info);
|
||||||
|
|
||||||
|
// Setup defaults that only apply to first sensor
|
||||||
|
param[0].type.set_default(ARSPD_DEFAULT_TYPE);
|
||||||
|
param[0].bus.set_default(HAL_AIRSPEED_BUS_DEFAULT);
|
||||||
|
#ifndef HAL_BUILD_AP_PERIPH
|
||||||
|
param[0].pin.set_default(ARSPD_DEFAULT_PIN);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (_singleton != nullptr) {
|
if (_singleton != nullptr) {
|
||||||
AP_HAL::panic("AP_Airspeed must be singleton");
|
AP_HAL::panic("AP_Airspeed must be singleton");
|
||||||
}
|
}
|
||||||
@ -298,13 +305,6 @@ void AP_Airspeed::convert_per_instance()
|
|||||||
void AP_Airspeed::init()
|
void AP_Airspeed::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Setup defaults that only apply to first sensor
|
|
||||||
param[0].type.set_default(ARSPD_DEFAULT_TYPE);
|
|
||||||
param[0].bus.set_default(HAL_AIRSPEED_BUS_DEFAULT);
|
|
||||||
#ifndef HAL_BUILD_AP_PERIPH
|
|
||||||
param[0].pin.set_default(ARSPD_DEFAULT_PIN);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
convert_per_instance();
|
convert_per_instance();
|
||||||
|
|
||||||
#if ENABLE_PARAMETER
|
#if ENABLE_PARAMETER
|
||||||
|
Loading…
Reference in New Issue
Block a user