In readme.md an example described on how to use libcanard, however in this segment
for (const CanardFrame* txf = NULL; (txf = canardTxPeek(&ins)) != NULL;) // Look at the top of the TX queue.
{
if (txf->timestamp_usec < getCurrentMicroseconds()) // Check if the frame has timed out.
{
if (!pleaseTransmit(&txf)) // Send the frame. Redundant interfaces may be used here.
{
break; // If the driver is busy, break and retry later.
}
}
canardTxPop(&ins); // Remove the frame from the queue after it's transmitted.
ins.memory_free(&ins, (CanardFrame*)txf); // Deallocate the dynamic memory afterwards.
}
There are two bugs, I suppose we want to drop frames when the frame has timed out e.g:
if (txf->timestamp_usec > getCurrentMicroseconds()) // Check if the frame has timed out.
And I suppose we want to have a pointer here instead of a reference.
if (!pleaseTransmit(txf)) // Send the frame. Redundant interfaces may be used here.
Furthermore the example doesn't describe on how to subscribe to the uavcan.node.Heartbeat messages, If that could be added that would be nice.
In readme.md an example described on how to use libcanard, however in this segment
There are two bugs, I suppose we want to drop frames when the frame has timed out e.g:
And I suppose we want to have a pointer here instead of a reference.
Furthermore the example doesn't describe on how to subscribe to the uavcan.node.Heartbeat messages, If that could be added that would be nice.