Closed emrainey closed 1 year ago
This was found during Service transfers but I would imagine it's happening all the time?
Hey Erik, thanks for pointing this out.
Looks like there a couple of things we need to change.
We are incorrectly setting the frame index to 1 instead of 0 when we call txMakeFrameHeader
for both single frame transfers and multiframe transfers:
txMakeFrameHeader
: https://github.com/OpenCyphal-Garage/libudpard/blob/main/libudpard/udpard.c#L560(frame->start_of_transfer && frame->frame_index != 1U)
to (frame->start_of_transfer && frame->frame_index != 0U)
: https://github.com/OpenCyphal-Garage/libudpard/blob/main/libudpard/udpard.c#L994I think there might be a few other places we need to update the logic as well.
start of transfer is indicated by a zero, not a 1.
out->start_of_transfer = (((frame->udp_cyphal_header.frame_index_eot) & (UDPARD_MAX_FRAME_INDEX)) == 1);
Should be
out->start_of_transfer = (((frame->udp_cyphal_header.frame_index_eot) & (UDPARD_MAX_FRAME_INDEX)) == 0);