AP_CANManager: promote KDECAN to a first-class library

This commit is contained in:
Tom Pittenger 2023-04-10 14:29:30 -07:00 committed by Andrew Tridgell
parent c585b0286d
commit eed3cf3255
3 changed files with 6 additions and 17 deletions

View File

@ -42,11 +42,7 @@ const AP_Param::GroupInfo AP_CANManager::CANDriver_Params::var_info[] = {
AP_SUBGROUPPTR(_uavcan, "UC_", 2, AP_CANManager::CANDriver_Params, AP_DroneCAN),
#endif
#if (APM_BUILD_COPTER_OR_HELI || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_ArduSub))
// @Group: KDE_
// @Path: ../AP_KDECAN/AP_KDECAN.cpp
AP_SUBGROUPPTR(_kdecan, "KDE_", 3, AP_CANManager::CANDriver_Params, AP_KDECAN),
#endif
// index 3 was KDECAN
#if HAL_NUM_CAN_IFACES > 1 && !HAL_MINIMIZE_FEATURES && HAL_ENABLE_CANTESTER
// @Group: TST_

View File

@ -216,16 +216,10 @@ void AP_CANManager::init()
} else
#endif
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))
// To be replaced with macro saying if KDECAN library is included
_drivers[drv_num] = _drv_param[drv_num]._kdecan = new AP_KDECAN;
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);
#if AP_KDECAN_ENABLED
// cache the driver type so we can detect that it is in the params via get_driver_type().
// 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];
#endif
} else if (drv_type[drv_num] == Driver_Type_PiccoloCAN) {
#if HAL_PICCOLO_CAN_ENABLE

View File

@ -157,7 +157,6 @@ private:
AP_Int8 _driver_type;
AP_CANDriver* _testcan;
AP_CANDriver* _uavcan;
AP_CANDriver* _kdecan;
AP_CANDriver* _piccolocan;
};