SRV_Channel: move AP_KDECAN to a first-class library

This commit is contained in:
Tom Pittenger 2023-04-10 14:49:31 -07:00 committed by Andrew Tridgell
parent 5ef4c8dd09
commit c2e1eeac98

View File

@ -24,15 +24,11 @@
#include "SRV_Channel.h"
#include <AP_Logger/AP_Logger.h>
#include <AP_KDECAN/AP_KDECAN.h>
#if HAL_MAX_CAN_PROTOCOL_DRIVERS
#include <AP_CANManager/AP_CANManager.h>
#include <AP_DroneCAN/AP_DroneCAN.h>
// To be replaced with macro saying if KDECAN library is included
#if APM_BUILD_COPTER_OR_HELI || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_ArduSub)
#include <AP_KDECAN/AP_KDECAN.h>
#endif
#include <AP_PiccoloCAN/AP_PiccoloCAN.h>
#endif
@ -534,6 +530,12 @@ void SRV_Channels::push()
fetteconwire_ptr->update();
#endif
#if AP_KDECAN_ENABLED
if (AP::kdecan() != nullptr) {
AP::kdecan()->update();
}
#endif
#if HAL_ENABLE_DRONECAN_DRIVERS
// push outputs to CAN
uint8_t can_num_drivers = AP::can().get_num_drivers();
@ -547,17 +549,6 @@ void SRV_Channels::push()
ap_dronecan->SRV_push_servos();
break;
}
case AP_CANManager::Driver_Type_KDECAN: {
// To be replaced with macro saying if KDECAN library is included
#if APM_BUILD_COPTER_OR_HELI || APM_BUILD_TYPE(APM_BUILD_ArduPlane) || APM_BUILD_TYPE(APM_BUILD_ArduSub)
AP_KDECAN *ap_kdecan = AP_KDECAN::get_kdecan(i);
if (ap_kdecan == nullptr) {
continue;
}
ap_kdecan->update();
#endif
break;
}
#if HAL_PICCOLO_CAN_ENABLE
case AP_CANManager::Driver_Type_PiccoloCAN: {
AP_PiccoloCAN *ap_pcan = AP_PiccoloCAN::get_pcan(i);