diff --git a/sw/airborne/modules/uavcan/uavcan_allocator.c b/sw/airborne/modules/uavcan/uavcan_allocator.c index f5ec093b6e..8589cee16a 100644 --- a/sw/airborne/modules/uavcan/uavcan_allocator.c +++ b/sw/airborne/modules/uavcan/uavcan_allocator.c @@ -1,3 +1,12 @@ + /* + * Copyright (C) 2025 Fabien-B + * This file is part of paparazzi. See LICENCE file. + */ + + /** + * Dynamic node ID allocation. + * See https://dronecan.github.io/Specification/6._Application_level_functions/#dynamic-node-id-allocation + */ #include "uavcan/uavcan.h" #include "uavcan/uavcan_allocator.h" @@ -7,14 +16,8 @@ #include "mcu_periph/gpio.h" -/** - * Dynamic node ID allocation. - * See https://dronecan.github.io/Specification/6._Application_level_functions/#dynamic-node-id-allocation - */ - - -#ifndef UAVCAN_DYN_NODE_NB -#define UAVCAN_DYN_NODE_NB 10 +#ifndef UAVCAN_MAX_NODES +#define UAVCAN_MAX_NODES 50 #endif #define INVALID_STAGE -1 @@ -32,7 +35,7 @@ static uavcan_event node_info_ev; // keep the correspondance between node id and unique IDs. (even or the fixed ids) -static struct uavcan_node_mapping_t uavcan_node_ids[UAVCAN_DYN_NODE_NB] = {0}; +static struct uavcan_node_mapping_t uavcan_node_ids[UAVCAN_MAX_NODES] = {0}; @@ -41,7 +44,7 @@ uint32_t last_message_timestamp = 0; struct uavcan_node_mapping_t* uavcan_get_node_id_mapping(const uint8_t id) { - for(int i=0; i + * This file is part of paparazzi. See LICENCE file. + */ + /** * Dynamic node ID allocation. * See https://dronecan.github.io/Specification/6._Application_level_functions/#dynamic-node-id-allocation */ +#pragma once +#include "inttypes.h" + struct uavcan_iface_t; struct uavcan_unique_id_t {