mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Fixed processing of UAVTalk packets when in transparent com mode.
This commit is contained in:
parent
14bbd09c87
commit
6fbc3339d5
@ -91,7 +91,7 @@ PHInstHandle PHInitialize(PacketHandlerConfig *cfg)
|
||||
data->lock = xSemaphoreCreateRecursiveMutex();
|
||||
|
||||
// Initialize the ECC library.
|
||||
initialize_ecc();
|
||||
initialize_ecc();
|
||||
|
||||
// Return the structure.
|
||||
return (PHInstHandle)data;
|
||||
|
@ -291,7 +291,7 @@ static void comUAVTalkTask(void *parameters)
|
||||
data->txBytes++;
|
||||
|
||||
// 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.
|
||||
@ -320,7 +320,8 @@ static void comUAVTalkTask(void *parameters)
|
||||
}
|
||||
|
||||
// Insert this byte.
|
||||
p->data[p->header.data_size++] = rx_byte;
|
||||
if(p)
|
||||
p->data[p->header.data_size++] = rx_byte;
|
||||
|
||||
// Keep reading until we receive a completed packet.
|
||||
UAVTalkRxState state = UAVTalkProcessInputStreamQuiet(data->inUAVTalkCon, rx_byte);
|
||||
@ -390,12 +391,14 @@ static void comUAVTalkTask(void *parameters)
|
||||
}
|
||||
|
||||
// Release the packet, since we don't need it.
|
||||
PHReleaseTXPacket(pios_packet_handler, p);
|
||||
if(p)
|
||||
PHReleaseTXPacket(pios_packet_handler, p);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, queue the packet for transmission.
|
||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||
// Otherwise, queue the packet for transmission if we're using UAVTalk comms.
|
||||
if(p)
|
||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -425,13 +428,15 @@ static void comUAVTalkTask(void *parameters)
|
||||
}
|
||||
|
||||
// Release the packet, since we don't need it.
|
||||
PHReleaseTXPacket(pios_packet_handler, p);
|
||||
if(p)
|
||||
PHReleaseTXPacket(pios_packet_handler, p);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Queue the packet for transmission.
|
||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||
// Queue the packet for transmission if we're using UAVTalk comms.
|
||||
if(p)
|
||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||
}
|
||||
p = NULL;
|
||||
|
||||
@ -449,12 +454,14 @@ static void comUAVTalkTask(void *parameters)
|
||||
xQueueSend(data->objEventQueue, &ev, MAX_PORT_DELAY);
|
||||
|
||||
// Release the packet and start over again.
|
||||
PHReleaseTXPacket(pios_packet_handler, p);
|
||||
if(p)
|
||||
PHReleaseTXPacket(pios_packet_handler, p);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Transmit the packet anyway...
|
||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||
if(p)
|
||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||
}
|
||||
p = NULL;
|
||||
}
|
||||
@ -630,7 +637,7 @@ static void transparentCommTask(void * parameters)
|
||||
|
||||
// Receive data from the com port
|
||||
uint32_t cur_rx_bytes = PIOS_COM_ReceiveBuffer(PIOS_COM_TRANS_COM, p->data + p->header.data_size,
|
||||
PH_MAX_DATA - p->header.data_size, timeout);
|
||||
PH_MAX_DATA - p->header.data_size, timeout);
|
||||
|
||||
// Do we have an data to send?
|
||||
p->header.data_size += cur_rx_bytes;
|
||||
|
Loading…
Reference in New Issue
Block a user