I'm currently translating all the communication system of the Crazyflie into Ada.
Looking deeper in the code, It seems to me that the last byte of a received Syslink packet can be lost. Here is the discussed code:
Code: Select all
void radiolinkSyslinkDispatch(SyslinkPacket *slp)
{
static SyslinkPacket txPacket;
if (slp->type == SYSLINK_RADIO_RAW)
{
slp->length--; // Decrease to get CRTP size.
xQueueSend(crtpPacketDelivery, &slp->length, 0);
ledseqRun(LINK_LED, seq_linkup);
// If a radio packet is received, one can be sent
if (xQueueReceive(txQueue, &txPacket, 0) == pdTRUE)
{
ledseqRun(LINK_DOWN_LED, seq_linkup);
syslinkSendPacket(&txPacket);
}
} else if (slp->type == SYSLINK_RADIO_RSSI)
{
//Extract RSSI sample sent from radio
memcpy(&rssi, slp->data, sizeof(uint8_t));
}
}
Code: Select all
xQueueSend(crtpPacketDelivery, &slp->length, 0);
Am I misunderstanding something?