canardv0 nxstyle fix
This commit is contained in:
parent
819c34e975
commit
c026bd824a
@ -99,7 +99,8 @@ static CanardInstance canard;
|
|||||||
|
|
||||||
/* Arena for memory allocation, used by the library */
|
/* Arena for memory allocation, used by the library */
|
||||||
|
|
||||||
static uint8_t canard_memory_pool[CONFIG_EXAMPLES_LIBCANARDV0_NODE_MEM_POOL_SIZE];
|
static uint8_t canard_memory_pool
|
||||||
|
[CONFIG_EXAMPLES_LIBCANARDV0_NODE_MEM_POOL_SIZE];
|
||||||
|
|
||||||
static uint8_t unique_id[UNIQUE_ID_LENGTH_BYTES] =
|
static uint8_t unique_id[UNIQUE_ID_LENGTH_BYTES] =
|
||||||
{ 0x00, 0x00, 0x00, 0x00,
|
{ 0x00, 0x00, 0x00, 0x00,
|
||||||
@ -203,13 +204,17 @@ static void onTransferReceived(CanardInstance *ins,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Image CRC skipped */
|
/* Image CRC skipped */
|
||||||
|
|
||||||
/* HardwareVersion */
|
/* HardwareVersion */
|
||||||
|
|
||||||
/* Major skipped */
|
/* Major skipped */
|
||||||
|
|
||||||
/* Minor skipped */
|
/* Minor skipped */
|
||||||
|
|
||||||
memcpy(&buffer[24], unique_id, UNIQUE_ID_LENGTH_BYTES);
|
memcpy(&buffer[24], unique_id, UNIQUE_ID_LENGTH_BYTES);
|
||||||
|
|
||||||
/* Certificate of authenticity skipped */
|
/* Certificate of authenticity skipped */
|
||||||
|
|
||||||
/* Name */
|
/* Name */
|
||||||
|
|
||||||
const size_t name_len = strlen(APP_NODE_NAME);
|
const size_t name_len = strlen(APP_NODE_NAME);
|
||||||
@ -268,7 +273,8 @@ static bool shouldAcceptTransfer(const CanardInstance * ins,
|
|||||||
if ((transfer_type == CanardTransferTypeRequest) &&
|
if ((transfer_type == CanardTransferTypeRequest) &&
|
||||||
(data_type_id == UAVCAN_GET_NODE_INFO_DATA_TYPE_ID))
|
(data_type_id == UAVCAN_GET_NODE_INFO_DATA_TYPE_ID))
|
||||||
{
|
{
|
||||||
*out_data_type_signature = UAVCAN_GET_NODE_INFO_DATA_TYPE_SIGNATURE;
|
*out_data_type_signature =
|
||||||
|
UAVCAN_GET_NODE_INFO_DATA_TYPE_SIGNATURE;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -301,8 +307,8 @@ void process1HzTasks(uint64_t timestamp_usec)
|
|||||||
100U * stats.peak_usage_blocks / stats.capacity_blocks;
|
100U * stats.peak_usage_blocks / stats.capacity_blocks;
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_CAN
|
#ifdef CONFIG_DEBUG_CAN
|
||||||
printf
|
printf("Memory pool stats: capacity %u blocks, usage %u blocks,"
|
||||||
("Memory pool stats: capacity %u blocks, usage %u blocks, peak usage %u blocks (%u%%)\n",
|
" peak usage %u blocks (%u%%)\n",
|
||||||
stats.capacity_blocks, stats.current_usage_blocks,
|
stats.capacity_blocks, stats.current_usage_blocks,
|
||||||
stats.peak_usage_blocks, peak_percent);
|
stats.peak_usage_blocks, peak_percent);
|
||||||
#endif
|
#endif
|
||||||
@ -345,7 +351,8 @@ void process1HzTasks(uint64_t timestamp_usec)
|
|||||||
const int resp_res =
|
const int resp_res =
|
||||||
canardRequestOrRespond(&canard, dest_id,
|
canardRequestOrRespond(&canard, dest_id,
|
||||||
UAVCAN_GET_NODE_INFO_DATA_TYPE_SIGNATURE,
|
UAVCAN_GET_NODE_INFO_DATA_TYPE_SIGNATURE,
|
||||||
UAVCAN_GET_NODE_INFO_DATA_TYPE_ID, &transfer_id,
|
UAVCAN_GET_NODE_INFO_DATA_TYPE_ID,
|
||||||
|
&transfer_id,
|
||||||
CANARD_TRANSFER_PRIORITY_LOW, CanardRequest,
|
CANARD_TRANSFER_PRIORITY_LOW, CanardRequest,
|
||||||
payload, 0);
|
payload, 0);
|
||||||
if (resp_res <= 0)
|
if (resp_res <= 0)
|
||||||
@ -471,7 +478,8 @@ static int canard_daemon(int argc, char *argv[])
|
|||||||
onTransferReceived, shouldAcceptTransfer, (void *)(12345));
|
onTransferReceived, shouldAcceptTransfer, (void *)(12345));
|
||||||
canardSetLocalNodeID(&canard, CONFIG_EXAMPLES_LIBCANARDV0_NODE_ID);
|
canardSetLocalNodeID(&canard, CONFIG_EXAMPLES_LIBCANARDV0_NODE_ID);
|
||||||
printf("canard_daemon: canard initialized\n");
|
printf("canard_daemon: canard initialized\n");
|
||||||
printf("start node (ID: %d Name: %s)\n", CONFIG_EXAMPLES_LIBCANARDV0_NODE_ID,
|
printf("start node (ID: %d Name: %s)\n",
|
||||||
|
CONFIG_EXAMPLES_LIBCANARDV0_NODE_ID,
|
||||||
APP_NODE_NAME);
|
APP_NODE_NAME);
|
||||||
|
|
||||||
g_canard_daemon_started = true;
|
g_canard_daemon_started = true;
|
||||||
@ -517,7 +525,8 @@ int main(int argc, FAR char *argv[])
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = task_create("canard_daemon", CONFIG_EXAMPLES_LIBCANARDV0_DAEMON_PRIORITY,
|
ret = task_create("canard_daemon",
|
||||||
|
CONFIG_EXAMPLES_LIBCANARDV0_DAEMON_PRIORITY,
|
||||||
CONFIG_EXAMPLES_LIBCANARDV0_STACKSIZE, canard_daemon,
|
CONFIG_EXAMPLES_LIBCANARDV0_STACKSIZE, canard_daemon,
|
||||||
NULL);
|
NULL);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user