mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +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();
|
data->lock = xSemaphoreCreateRecursiveMutex();
|
||||||
|
|
||||||
// Initialize the ECC library.
|
// Initialize the ECC library.
|
||||||
initialize_ecc();
|
initialize_ecc();
|
||||||
|
|
||||||
// Return the structure.
|
// Return the structure.
|
||||||
return (PHInstHandle)data;
|
return (PHInstHandle)data;
|
||||||
|
@ -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,7 +320,8 @@ static void comUAVTalkTask(void *parameters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert this byte.
|
// 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.
|
// Keep reading until we receive a completed packet.
|
||||||
UAVTalkRxState state = UAVTalkProcessInputStreamQuiet(data->inUAVTalkCon, rx_byte);
|
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.
|
// Release the packet, since we don't need it.
|
||||||
PHReleaseTXPacket(pios_packet_handler, p);
|
if(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.
|
||||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
if(p)
|
||||||
|
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -425,13 +428,15 @@ static void comUAVTalkTask(void *parameters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Release the packet, since we don't need it.
|
// Release the packet, since we don't need it.
|
||||||
PHReleaseTXPacket(pios_packet_handler, p);
|
if(p)
|
||||||
|
PHReleaseTXPacket(pios_packet_handler, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Queue the packet for transmission.
|
// Queue the packet for transmission if we're using UAVTalk comms.
|
||||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
if(p)
|
||||||
|
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||||
}
|
}
|
||||||
p = NULL;
|
p = NULL;
|
||||||
|
|
||||||
@ -449,12 +454,14 @@ 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.
|
||||||
PHReleaseTXPacket(pios_packet_handler, p);
|
if(p)
|
||||||
|
PHReleaseTXPacket(pios_packet_handler, p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Transmit the packet anyway...
|
// Transmit the packet anyway...
|
||||||
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
if(p)
|
||||||
|
xQueueSend(data->sendPacketQueue, &p, MAX_PORT_DELAY);
|
||||||
}
|
}
|
||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
@ -630,7 +637,7 @@ static void transparentCommTask(void * parameters)
|
|||||||
|
|
||||||
// Receive data from the com port
|
// Receive data from the com port
|
||||||
uint32_t cur_rx_bytes = PIOS_COM_ReceiveBuffer(PIOS_COM_TRANS_COM, p->data + p->header.data_size,
|
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?
|
// Do we have an data to send?
|
||||||
p->header.data_size += cur_rx_bytes;
|
p->header.data_size += cur_rx_bytes;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user