Skip to content

Commit

Permalink
test_msg: remove redundant packet buffer initialization
Browse files Browse the repository at this point in the history
The <msg>_encode function always zeros the buffer up to <msg>_MAX_SIZE
bytes so there is no need to do it beforehand.

Avoids encouraging poor habits.
  • Loading branch information
tpwrules committed Aug 4, 2024
1 parent 43d8a9e commit bc4de55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/test_msg.cpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main() {
// Create a UAVCAN message
@(msg_underscored_name) _msg = sample_@(msg_underscored_name)_msg();

uint8_t buffer[@(msg_define_name.upper())_MAX_SIZE] {};
uint8_t buffer[@(msg_define_name.upper())_MAX_SIZE];

// encode the message
uint32_t data_len = @(msg_underscored_name)_encode(&_msg, buffer);
Expand Down

0 comments on commit bc4de55

Please sign in to comment.