CRTP Protocol - Syslink packet dispatching
Posted: Fri Apr 10, 2015 2:55 pm
Hi everyone,
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:
This line is the one that troubles me:
As the 'crtpPacketDelivery' queue is defined as a queue containing 'CRTPPacket' structs (32-Byte), if 'xQueueSend' read 32 Bytes at the specified address (&slp->length), it seems to me that there is still one byte of 'slp->data' that is not read.
Am I misunderstanding something?
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?