1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Clean up some cruft from Overo module and add a packet counter

This commit is contained in:
James Cotton 2012-07-17 16:17:56 -05:00
parent db27653859
commit 9c91436428
2 changed files with 5 additions and 8 deletions

View File

@ -67,9 +67,8 @@ struct overosync {
struct dma_transaction transactions[2];
uint32_t active_transaction_id;
uint32_t loading_transaction_id;
xSemaphoreHandle transaction_lock;
xSemaphoreHandle buffer_lock;
volatile bool transaction_done;
uint32_t packets;
uint32_t sent_bytes;
uint32_t write_pointer;
uint32_t sent_objects;
@ -132,10 +131,6 @@ int32_t OveroSyncStart(void)
if(overosync == NULL)
return -1;
overosync->transaction_lock = xSemaphoreCreateMutex();
if(overosync->transaction_lock == NULL)
return -1;
overosync->buffer_lock = xSemaphoreCreateMutex();
if(overosync->buffer_lock == NULL)
return -1;
@ -145,6 +140,7 @@ int32_t OveroSyncStart(void)
overosync->write_pointer = 0;
overosync->sent_bytes = 0;
overosync->framesync_error = 0;
overosync->packets = 0;
// Process all registered objects and connect queue for updates
UAVObjIterate(&registerObject);
@ -188,7 +184,6 @@ static void overoSyncTask(void *parameters)
UAVObjEvent ev;
// Kick off SPI transfers (once one is completed another will automatically transmit)
overosync->transaction_done = true;
overosync->sent_objects = 0;
overosync->failed_objects = 0;
overosync->received_objects = 0;
@ -222,6 +217,7 @@ static void overoSyncTask(void *parameters)
syncStats.Connected = syncStats.Send > 500 ? OVEROSYNCSTATS_CONNECTED_TRUE : OVEROSYNCSTATS_CONNECTED_FALSE;
syncStats.DroppedUpdates = overosync->failed_objects;
syncStats.FramesyncErrors = overosync->framesync_error;
syncStats.Packets = overosync->packets;
OveroSyncStatsSet(&syncStats);
overosync->failed_objects = 0;
overosync->sent_bytes = 0;
@ -281,7 +277,7 @@ static void transmitDataDone()
return;
}
overosync->transaction_done = false;
overosync->packets++;
// Swap buffers
overosync->active_transaction_id = overosync->loading_transaction_id;

View File

@ -6,6 +6,7 @@
<field name="Received" units="B/s" type="uint32" elements="1"/>
<field name="FramesyncErrors" units="count" type="uint32" elements="1"/>
<field name="DroppedUpdates" units="" type="uint32" elements="1"/>
<field name="Packets" units="" type="uint32" elements="1"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="false" updatemode="manual" period="0"/>
<telemetryflight acked="false" updatemode="periodic" period="1000"/>