1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

Fixed processing of UAVTalk packets when in transparent com mode.

This commit is contained in:
Brian Webb 2012-05-17 18:37:45 -07:00
parent 14bbd09c87
commit 6fbc3339d5
2 changed files with 19 additions and 12 deletions

View File

@ -291,7 +291,7 @@ static void comUAVTalkTask(void *parameters)
data->txBytes++; data->txBytes++;
// Get a TX packet from the packet handler if required. // Get a TX packet from the packet handler if required.
if (p == NULL) if ((p == NULL) && !PIOS_COM_TRANS_COM)
{ {
// Wait until we receive a sync. // Wait until we receive a sync.
@ -320,6 +320,7 @@ static void comUAVTalkTask(void *parameters)
} }
// Insert this byte. // Insert this byte.
if(p)
p->data[p->header.data_size++] = rx_byte; p->data[p->header.data_size++] = rx_byte;
// Keep reading until we receive a completed packet. // Keep reading until we receive a completed packet.
@ -390,11 +391,13 @@ static void comUAVTalkTask(void *parameters)
} }
// Release the packet, since we don't need it. // Release the packet, since we don't need it.
if(p)
PHReleaseTXPacket(pios_packet_handler, p); PHReleaseTXPacket(pios_packet_handler, p);
} }
else else
{ {
// Otherwise, queue the packet for transmission. // Otherwise, queue the packet for transmission if we're using UAVTalk comms.
if(p)
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY); xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
} }
} }
@ -425,12 +428,14 @@ static void comUAVTalkTask(void *parameters)
} }
// Release the packet, since we don't need it. // Release the packet, since we don't need it.
if(p)
PHReleaseTXPacket(pios_packet_handler, p); PHReleaseTXPacket(pios_packet_handler, p);
} }
} }
else else
{ {
// Queue the packet for transmission. // Queue the packet for transmission if we're using UAVTalk comms.
if(p)
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY); xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
} }
p = NULL; p = NULL;
@ -449,11 +454,13 @@ static void comUAVTalkTask(void *parameters)
xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY); xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY);
// Release the packet and start over again. // Release the packet and start over again.
if(p)
PHReleaseTXPacket(pios_packet_handler, p); PHReleaseTXPacket(pios_packet_handler, p);
} }
else else
{ {
// Transmit the packet anyway... // Transmit the packet anyway...
if(p)
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY); xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
} }
p = NULL; p = NULL;