Browse Source

AP_UAVCAN: add config for enabling/disabling can filters

master
Siddharth Purohit 6 years ago committed by Andrew Tridgell
parent
commit
7a871a8843
  1. 7
      libraries/AP_UAVCAN/AP_UAVCAN.cpp
  2. 2
      libraries/AP_UAVCAN/AP_UAVCAN.h

7
libraries/AP_UAVCAN/AP_UAVCAN.cpp

@ -123,7 +123,7 @@ AP_UAVCAN *AP_UAVCAN::get_uavcan(uint8_t driver_index)
return static_cast<AP_UAVCAN*>(AP::can().get_driver(driver_index)); return static_cast<AP_UAVCAN*>(AP::can().get_driver(driver_index));
} }
void AP_UAVCAN::init(uint8_t driver_index) void AP_UAVCAN::init(uint8_t driver_index, bool enable_filters)
{ {
if (_initialized) { if (_initialized) {
debug_uavcan(2, "UAVCAN: init called more than once\n\r"); debug_uavcan(2, "UAVCAN: init called more than once\n\r");
@ -219,8 +219,9 @@ void AP_UAVCAN::init(uint8_t driver_index)
rgb_led[driver_index]->setPriority(uavcan::TransferPriority::OneHigherThanLowest); rgb_led[driver_index]->setPriority(uavcan::TransferPriority::OneHigherThanLowest);
_led_conf.devices_count = 0; _led_conf.devices_count = 0;
if (enable_filters) {
configureCanAcceptanceFilters(*_node); configureCanAcceptanceFilters(*_node);
}
/* /*
* Informing other nodes that we're ready to work. * Informing other nodes that we're ready to work.

2
libraries/AP_UAVCAN/AP_UAVCAN.h

@ -68,7 +68,7 @@ public:
// Return uavcan from @driver_index or nullptr if it's not ready or doesn't exist // Return uavcan from @driver_index or nullptr if it's not ready or doesn't exist
static AP_UAVCAN *get_uavcan(uint8_t driver_index); static AP_UAVCAN *get_uavcan(uint8_t driver_index);
void init(uint8_t driver_index) override; void init(uint8_t driver_index, bool enable_filters) override;
uavcan::Node<0>* get_node() { return _node; } uavcan::Node<0>* get_node() { return _node; }
uint8_t get_driver_index() { return _driver_index; } uint8_t get_driver_index() { return _driver_index; }

Loading…
Cancel
Save