diff --git a/kocherga/kocherga_can.hpp b/kocherga/kocherga_can.hpp index 880db71..b940580 100644 --- a/kocherga/kocherga_can.hpp +++ b/kocherga/kocherga_can.hpp @@ -8,6 +8,23 @@ #include #include + +#ifndef DRONECAN_DNA_ENABLE + #define DRONECAN_DNA_ENABLE 1 +#endif + +#ifndef CYPHAL_CAN_DNA_ENABLE + #define CYPHAL_CAN_DNA_ENABLE 1 +#endif + +#ifndef VERSION_DETECTION_ENABLE + #define VERSION_DETECTION_ENABLE 1 +#endif + +#ifndef BITRATE_DETECTION_ENABLE + #define BITRATE_DETECTION_ENABLE 1 +#endif + namespace kocherga::can { static constexpr std::uint8_t MaxNodeID = 127U; @@ -2199,6 +2216,8 @@ class CANNode : public kocherga::INode static_cast(*local_node_id)); } } + +#if DRONECAN_DNA_ENABLE if ((activity_ == nullptr) && can_bitrate && protocol_version && (*protocol_version == 0)) { if (const auto bus_mode = driver.configure(*can_bitrate, false, detail::makeAcceptanceFilter<0>({}))) @@ -2210,6 +2229,9 @@ class CANNode : public kocherga::INode *can_bitrate); } } +#endif // DRONECAN_DNA_ENABLE + +#if CYPHAL_CAN_DNA_ENABLE if ((activity_ == nullptr) && can_bitrate && protocol_version && (*protocol_version == 1)) { if (const auto bus_mode = driver.configure(*can_bitrate, false, detail::makeAcceptanceFilter<1>({}))) @@ -2221,6 +2243,9 @@ class CANNode : public kocherga::INode *bus_mode); } } +#endif // CYPHAL_CAN_DNA_ENABLE + +#if VERSION_DETECTION_ENABLE if ((activity_ == nullptr) && can_bitrate) { if (const auto bus_mode = @@ -2233,12 +2258,16 @@ class CANNode : public kocherga::INode *can_bitrate); } } +#endif // VERSION_DETECTION_ENABLE + +#if BITRATE_DETECTION_ENABLE if (activity_ == nullptr) { activity_ = activity_allocator_.construct(activity_allocator_, driver, local_unique_id); } +#endif // BITRATE_DETECTION_ENABLE KOCHERGA_ASSERT(activity_ != nullptr); }