I found a bug in libcanard dsdl compiler

Hi
Today I use libcanard dsdl compiler to generate code,
I fill below in my *.uavcan files:

uint8[<=6] command

and I found that in encode,
uavcan_xxx_encode_internal(source, msg_buf, offset, 1);
uavcan_xxx_encode_internal(uavcan_syrius_RobotCommand* source, void* msg_buf, uint32_t offset, uint8_t root_item)

Here is root_item = 1
and here inside uavcan_xxx_encode_internal
if (! root_item)
{
// - Add array length
canardEncodeScalar(msg_buf, offset, 3, (void*)&source->command.len);
offset += 3;
}

I think if (! root_item) need to be if (root_item).
this means that the first 3bits means length of my buffer.

because that in decode, this parameter need it.

Thank you and your team.

Thanks! Could you please open an issue in the Libcanard repo and tag @storola?

1 Like