From 4809d569c028d3a75950c889cf6ddc6e332a1ac5 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Tue, 24 Jul 2012 03:44:03 -0500 Subject: [PATCH] Need to tell UAVTalk to expect a longer packet when it includes a timestamp --- flight/UAVTalk/inc/uavtalk_priv.h | 1 + flight/UAVTalk/uavtalk.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/flight/UAVTalk/inc/uavtalk_priv.h b/flight/UAVTalk/inc/uavtalk_priv.h index 5ed872e1e..e12df0fcf 100644 --- a/flight/UAVTalk/inc/uavtalk_priv.h +++ b/flight/UAVTalk/inc/uavtalk_priv.h @@ -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; diff --git a/flight/UAVTalk/uavtalk.c b/flight/UAVTalk/uavtalk.c index 9ed0ef2bb..135b41e55 100644 --- a/flight/UAVTalk/uavtalk.c +++ b/flight/UAVTalk/uavtalk.c @@ -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;