mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Add the portTickTime into the OveroSync stream
This commit is contained in:
parent
dbcb499d7f
commit
ae01936808
@ -241,12 +241,15 @@ int32_t transactionsStarted = 0;
|
|||||||
static int32_t packData(uint8_t * data, int32_t length)
|
static int32_t packData(uint8_t * data, int32_t length)
|
||||||
{
|
{
|
||||||
uint8_t *tx_buffer;
|
uint8_t *tx_buffer;
|
||||||
|
|
||||||
|
portTickType tickTime = xTaskGetTickCount();
|
||||||
|
|
||||||
// Get the lock for manipulating the buffer
|
// Get the lock for manipulating the buffer
|
||||||
xSemaphoreTake(overosync->buffer_lock, portMAX_DELAY);
|
xSemaphoreTake(overosync->buffer_lock, portMAX_DELAY);
|
||||||
|
|
||||||
// Check this packet will fit
|
// Check this packet will fit
|
||||||
if ((overosync->write_pointer + length) > sizeof(overosync->transactions[overosync->loading_transaction_id].tx_buffer)) {
|
if ((overosync->write_pointer + length + sizeof(tickTime)) >
|
||||||
|
sizeof(overosync->transactions[overosync->loading_transaction_id].tx_buffer)) {
|
||||||
overosync->failed_objects ++;
|
overosync->failed_objects ++;
|
||||||
xSemaphoreGive(overosync->buffer_lock);
|
xSemaphoreGive(overosync->buffer_lock);
|
||||||
return -1;
|
return -1;
|
||||||
@ -255,7 +258,8 @@ static int32_t packData(uint8_t * data, int32_t length)
|
|||||||
// Get offset into buffer and copy contents
|
// Get offset into buffer and copy contents
|
||||||
tx_buffer = overosync->transactions[overosync->loading_transaction_id].tx_buffer +
|
tx_buffer = overosync->transactions[overosync->loading_transaction_id].tx_buffer +
|
||||||
overosync->write_pointer;
|
overosync->write_pointer;
|
||||||
memcpy(tx_buffer,data,length);
|
memcpy(tx_buffer, &tickTime, sizeof(tickTime));
|
||||||
|
memcpy(tx_buffer + sizeof(tickTime),data,length);
|
||||||
overosync->write_pointer += length;
|
overosync->write_pointer += length;
|
||||||
overosync->sent_bytes += length;
|
overosync->sent_bytes += length;
|
||||||
overosync->sent_objects++;
|
overosync->sent_objects++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user