mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
Need to tell UAVTalk to expect a longer packet when it includes a timestamp
This commit is contained in:
parent
ea5c3be026
commit
4809d569c0
@ -64,6 +64,7 @@ typedef struct {
|
|||||||
uint16_t instId;
|
uint16_t instId;
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
uint8_t instanceLength;
|
uint8_t instanceLength;
|
||||||
|
uint8_t timestampLength;
|
||||||
uint8_t cs;
|
uint8_t cs;
|
||||||
uint16_t timestamp;
|
uint16_t timestamp;
|
||||||
int32_t rxCount;
|
int32_t rxCount;
|
||||||
|
@ -390,6 +390,7 @@ UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connectionHandle
|
|||||||
{
|
{
|
||||||
iproc->length = UAVObjGetNumBytes(iproc->obj);
|
iproc->length = UAVObjGetNumBytes(iproc->obj);
|
||||||
iproc->instanceLength = (UAVObjIsSingleInstance(iproc->obj) ? 0 : 2);
|
iproc->instanceLength = (UAVObjIsSingleInstance(iproc->obj) ? 0 : 2);
|
||||||
|
iproc->timestampLength = (iproc->type & UAVTALK_TIMESTAMPED) ? 2 : 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -408,7 +409,7 @@ UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connectionHandle
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check the lengths match
|
// Check the lengths match
|
||||||
if ((iproc->rxPacketLength + iproc->instanceLength + iproc->length) != iproc->packet_size)
|
if ((iproc->rxPacketLength + iproc->instanceLength + iproc->timestampLength + iproc->length) != iproc->packet_size)
|
||||||
{ // packet error - mismatched packet size
|
{ // packet error - mismatched packet size
|
||||||
connection->stats.rxErrors++;
|
connection->stats.rxErrors++;
|
||||||
iproc->state = UAVTALK_STATE_ERROR;
|
iproc->state = UAVTALK_STATE_ERROR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user