mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_CANManager: promote KDECAN to a first-class library
This commit is contained in:
parent
c585b0286d
commit
eed3cf3255
@ -42,12 +42,8 @@ const AP_Param::GroupInfo AP_CANManager::CANDriver_Params::var_info[] = {
|
|||||||
AP_SUBGROUPPTR(_uavcan, "UC_", 2, AP_CANManager::CANDriver_Params, AP_DroneCAN),
|
AP_SUBGROUPPTR(_uavcan, "UC_", 2, AP_CANManager::CANDriver_Params, AP_DroneCAN),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (APM_BUILD_COPTER_OR_HELI || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_ArduSub))
|
// index 3 was KDECAN
|
||||||
// @Group: KDE_
|
|
||||||
// @Path: ../AP_KDECAN/AP_KDECAN.cpp
|
|
||||||
AP_SUBGROUPPTR(_kdecan, "KDE_", 3, AP_CANManager::CANDriver_Params, AP_KDECAN),
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAL_NUM_CAN_IFACES > 1 && !HAL_MINIMIZE_FEATURES && HAL_ENABLE_CANTESTER
|
#if HAL_NUM_CAN_IFACES > 1 && !HAL_MINIMIZE_FEATURES && HAL_ENABLE_CANTESTER
|
||||||
// @Group: TST_
|
// @Group: TST_
|
||||||
// @Path: ../AP_CANManager/AP_CANTester.cpp
|
// @Path: ../AP_CANManager/AP_CANTester.cpp
|
||||||
|
@ -216,16 +216,10 @@ void AP_CANManager::init()
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
if (drv_type[drv_num] == Driver_Type_KDECAN) {
|
if (drv_type[drv_num] == Driver_Type_KDECAN) {
|
||||||
#if (APM_BUILD_COPTER_OR_HELI || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_ArduSub))
|
#if AP_KDECAN_ENABLED
|
||||||
// To be replaced with macro saying if KDECAN library is included
|
// cache the driver type so we can detect that it is in the params via get_driver_type().
|
||||||
_drivers[drv_num] = _drv_param[drv_num]._kdecan = new AP_KDECAN;
|
// Normally it is cached after init but this driver's init is handled by CANSensor later on
|
||||||
|
_driver_type_cache[drv_num] = drv_type[drv_num];
|
||||||
if (_drivers[drv_num] == nullptr) {
|
|
||||||
AP_BoardConfig::allocation_error("KDECAN %d", drv_num + 1);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
AP_Param::load_object_from_eeprom((AP_KDECAN*)_drivers[drv_num], AP_KDECAN::var_info);
|
|
||||||
#endif
|
#endif
|
||||||
} else if (drv_type[drv_num] == Driver_Type_PiccoloCAN) {
|
} else if (drv_type[drv_num] == Driver_Type_PiccoloCAN) {
|
||||||
#if HAL_PICCOLO_CAN_ENABLE
|
#if HAL_PICCOLO_CAN_ENABLE
|
||||||
|
@ -157,7 +157,6 @@ private:
|
|||||||
AP_Int8 _driver_type;
|
AP_Int8 _driver_type;
|
||||||
AP_CANDriver* _testcan;
|
AP_CANDriver* _testcan;
|
||||||
AP_CANDriver* _uavcan;
|
AP_CANDriver* _uavcan;
|
||||||
AP_CANDriver* _kdecan;
|
|
||||||
AP_CANDriver* _piccolocan;
|
AP_CANDriver* _piccolocan;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user