Skip to content

Commit

Permalink
examples: fixed DNA alloc error
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Jun 4, 2023
1 parent e4a7814 commit 38bb651
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/ESCNode/esc_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ static struct {
*/
static void handle_DNA_Allocation(CanardInstance *ins, CanardRxTransfer *transfer)
{
if (canardGetLocalNodeID(&canard) != CANARD_BROADCAST_NODE_ID) {
// already allocated
return;
}

// Rule C - updating the randomized time interval
DNA.send_next_node_id_allocation_request_at_ms =
millis32() + UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_ALLOCATION_MIN_REQUEST_PERIOD_MS +
Expand Down
5 changes: 5 additions & 0 deletions examples/ServoNode/servo_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ static struct {
*/
static void handle_DNA_Allocation(CanardInstance *ins, CanardRxTransfer *transfer)
{
if (canardGetLocalNodeID(&canard) != CANARD_BROADCAST_NODE_ID) {
// already allocated
return;
}

// Rule C - updating the randomized time interval
DNA.send_next_node_id_allocation_request_at_ms =
millis32() + UAVCAN_PROTOCOL_DYNAMIC_NODE_ID_ALLOCATION_MIN_REQUEST_PERIOD_MS +
Expand Down

0 comments on commit 38bb651

Please sign in to comment.