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

Need to tell UAVTalk to expect a longer packet when it includes a timestamp

This commit is contained in:
James Cotton 2012-07-24 03:44:03 -05:00
parent ea5c3be026
commit 4809d569c0
2 changed files with 3 additions and 1 deletions

View File

@ -64,6 +64,7 @@ typedef struct {
uint16_t instId;
uint32_t length;
uint8_t instanceLength;
uint8_t timestampLength;
uint8_t cs;
uint16_t timestamp;
int32_t rxCount;

View File

@ -390,6 +390,7 @@ UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connectionHandle
{
iproc->length = UAVObjGetNumBytes(iproc->obj);
iproc->instanceLength = (UAVObjIsSingleInstance(iproc->obj) ? 0 : 2);
iproc->timestampLength = (iproc->type & UAVTALK_TIMESTAMPED) ? 2 : 0;
}
else
{
@ -408,7 +409,7 @@ UAVTalkRxState UAVTalkProcessInputStreamQuiet(UAVTalkConnection connectionHandle
}
// 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
connection->stats.rxErrors++;
iproc->state = UAVTALK_STATE_ERROR;