@@ -244,7 +244,7 @@ static void handleFastLoop(State* const state, const CanardMicrosecond monotonic
244
244
// If there are any hardware or configuration issues, report them here:
245
245
msg .heartbeat .health .value = uavcan_node_Health_1_0_NOMINAL ;
246
246
// Serialize and publish the message:
247
- uint8_t serialized [reg_udral_service_actuator_common_Feedback_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
247
+ uint8_t serialized [reg_udral_service_actuator_common_Feedback_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
248
248
size_t serialized_size = sizeof (serialized );
249
249
const int8_t err =
250
250
reg_udral_service_actuator_common_Feedback_0_1_serialize_ (& msg , & serialized [0 ], & serialized_size );
@@ -275,8 +275,8 @@ static void handleFastLoop(State* const state, const CanardMicrosecond monotonic
275
275
msg .value .kinematics .acceleration .meter_per_second_per_second = state -> servo .acceleration ;
276
276
msg .value .force .newton = state -> servo .force ;
277
277
// Serialize and publish the message:
278
- uint8_t serialized [reg_udral_physics_dynamics_translation_LinearTs_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
279
- size_t serialized_size = sizeof (serialized );
278
+ uint8_t serialized [reg_udral_physics_dynamics_translation_LinearTs_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
279
+ size_t serialized_size = sizeof (serialized );
280
280
const int8_t err =
281
281
reg_udral_physics_dynamics_translation_LinearTs_0_1_serialize_ (& msg , & serialized [0 ], & serialized_size );
282
282
assert (err >= 0 );
@@ -303,8 +303,8 @@ static void handleFastLoop(State* const state, const CanardMicrosecond monotonic
303
303
msg .value .current .ampere = 20.315F ;
304
304
msg .value .voltage .volt = 51.3F ;
305
305
// Serialize and publish the message:
306
- uint8_t serialized [reg_udral_physics_dynamics_translation_LinearTs_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
307
- size_t serialized_size = sizeof (serialized );
306
+ uint8_t serialized [reg_udral_physics_dynamics_translation_LinearTs_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
307
+ size_t serialized_size = sizeof (serialized );
308
308
const int8_t err = reg_udral_physics_electricity_PowerTs_0_1_serialize_ (& msg , & serialized [0 ], & serialized_size );
309
309
assert (err >= 0 );
310
310
if (err >= 0 )
@@ -341,8 +341,8 @@ static void handle1HzLoop(State* const state, const CanardMicrosecond monotonic_
341
341
heartbeat .health .value = uavcan_node_Health_1_0_NOMINAL ;
342
342
}
343
343
344
- uint8_t serialized [uavcan_node_Heartbeat_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
345
- size_t serialized_size = sizeof (serialized );
344
+ uint8_t serialized [uavcan_node_Heartbeat_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
345
+ size_t serialized_size = sizeof (serialized );
346
346
const int8_t err = uavcan_node_Heartbeat_1_0_serialize_ (& heartbeat , & serialized [0 ], & serialized_size );
347
347
assert (err >= 0 );
348
348
if (err >= 0 )
@@ -374,7 +374,7 @@ static void handle1HzLoop(State* const state, const CanardMicrosecond monotonic_
374
374
uavcan_pnp_NodeIDAllocationData_2_0 msg = {0 };
375
375
msg .node_id .value = UINT16_MAX ;
376
376
getUniqueID (msg .unique_id );
377
- uint8_t serialized [uavcan_pnp_NodeIDAllocationData_2_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
377
+ uint8_t serialized [uavcan_pnp_NodeIDAllocationData_2_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
378
378
size_t serialized_size = sizeof (serialized );
379
379
const int8_t err = uavcan_pnp_NodeIDAllocationData_2_0_serialize_ (& msg , & serialized [0 ], & serialized_size );
380
380
assert (err >= 0 );
@@ -403,7 +403,7 @@ static void handle1HzLoop(State* const state, const CanardMicrosecond monotonic_
403
403
// Publish the servo status -- this is a low-rate message with low-severity diagnostics.
404
404
reg_udral_service_actuator_common_Status_0_1 msg = {0 };
405
405
// TODO: POPULATE THE MESSAGE: temperature, errors, etc.
406
- uint8_t serialized [reg_udral_service_actuator_common_Status_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
406
+ uint8_t serialized [reg_udral_service_actuator_common_Status_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
407
407
size_t serialized_size = sizeof (serialized );
408
408
const int8_t err =
409
409
reg_udral_service_actuator_common_Status_0_1_serialize_ (& msg , & serialized [0 ], & serialized_size );
@@ -500,8 +500,8 @@ static void handle01HzLoop(State* const state, const CanardMicrosecond monotonic
500
500
fillServers (state -> canard .rx_subscriptions [CanardTransferKindRequest ], & m .servers );
501
501
fillServers (state -> canard .rx_subscriptions [CanardTransferKindResponse ], & m .clients ); // For regularity.
502
502
503
- // Serialize and publish the message. Use a small buffer because we know that our message is always small.
504
- uint8_t serialized [512 ] = { 0 }; // https://github.com/OpenCyphal/nunavut/issues/191
503
+ // Serialize and publish the message. Use a smaller buffer if you know that message is always small.
504
+ uint8_t serialized [uavcan_node_port_List_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
505
505
size_t serialized_size = uavcan_node_port_List_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ;
506
506
if (uavcan_node_port_List_0_1_serialize_ (& m , & serialized [0 ], & serialized_size ) >= 0 )
507
507
{
@@ -721,7 +721,7 @@ static void processReceivedTransfer(State* const state, const CanardRxTransfer*
721
721
{
722
722
// The request object is empty so we don't bother deserializing it. Just send the response.
723
723
const uavcan_node_GetInfo_Response_1_0 resp = processRequestNodeGetInfo ();
724
- uint8_t serialized [uavcan_node_GetInfo_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
724
+ uint8_t serialized [uavcan_node_GetInfo_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
725
725
size_t serialized_size = sizeof (serialized );
726
726
const int8_t res = uavcan_node_GetInfo_Response_1_0_serialize_ (& resp , & serialized [0 ], & serialized_size );
727
727
if (res >= 0 )
@@ -740,7 +740,7 @@ static void processReceivedTransfer(State* const state, const CanardRxTransfer*
740
740
if (uavcan_register_Access_Request_1_0_deserialize_ (& req , transfer -> payload , & size ) >= 0 )
741
741
{
742
742
const uavcan_register_Access_Response_1_0 resp = processRequestRegisterAccess (& req );
743
- uint8_t serialized [uavcan_register_Access_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
743
+ uint8_t serialized [uavcan_register_Access_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
744
744
size_t serialized_size = sizeof (serialized );
745
745
if (uavcan_register_Access_Response_1_0_serialize_ (& resp , & serialized [0 ], & serialized_size ) >= 0 )
746
746
{
@@ -755,7 +755,7 @@ static void processReceivedTransfer(State* const state, const CanardRxTransfer*
755
755
if (uavcan_register_List_Request_1_0_deserialize_ (& req , transfer -> payload , & size ) >= 0 )
756
756
{
757
757
const uavcan_register_List_Response_1_0 resp = {.name = registerGetNameByIndex (req .index )};
758
- uint8_t serialized [uavcan_register_List_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
758
+ uint8_t serialized [uavcan_register_List_Response_1_0_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
759
759
size_t serialized_size = sizeof (serialized );
760
760
if (uavcan_register_List_Response_1_0_serialize_ (& resp , & serialized [0 ], & serialized_size ) >= 0 )
761
761
{
@@ -770,7 +770,7 @@ static void processReceivedTransfer(State* const state, const CanardRxTransfer*
770
770
if (uavcan_node_ExecuteCommand_Request_1_1_deserialize_ (& req , transfer -> payload , & size ) >= 0 )
771
771
{
772
772
const uavcan_node_ExecuteCommand_Response_1_1 resp = processRequestExecuteCommand (& req );
773
- uint8_t serialized [uavcan_node_ExecuteCommand_Response_1_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ] = { 0 } ;
773
+ uint8_t serialized [uavcan_node_ExecuteCommand_Response_1_1_SERIALIZATION_BUFFER_SIZE_BYTES_ ];
774
774
size_t serialized_size = sizeof (serialized );
775
775
if (uavcan_node_ExecuteCommand_Response_1_1_serialize_ (& resp , & serialized [0 ], & serialized_size ) >= 0 )
776
776
{
0 commit comments