1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-18 08:54:15 +01:00

Fixes to the overo module where it was thinking the fifo buffer writes failed

This commit is contained in:
James Cotton 2012-07-20 13:45:31 -05:00
parent 5091b16065
commit bcdd5a8bba
4 changed files with 16 additions and 13 deletions

View File

@ -186,7 +186,6 @@ static void overoSyncTask(void *parameters)
// Update stats. This will trigger a local send event too
OveroSyncStatsData syncStats;
syncStats.Send = overosync->sent_bytes;
syncStats.Received = 0;
syncStats.Connected = syncStats.Send > 500 ? OVEROSYNCSTATS_CONNECTED_TRUE : OVEROSYNCSTATS_CONNECTED_FALSE;
syncStats.DroppedUpdates = overosync->failed_objects;
syncStats.Packets = PIOS_OVERO_GetPacketCount(pios_overo_id);
@ -212,9 +211,9 @@ static int32_t packData(uint8_t * data, int32_t length)
{
portTickType tickTime = xTaskGetTickCount();
if( PIOS_COM_SendBufferNonBlocking(pios_com_overo_id, (uint8_t *) &tickTime, sizeof(tickTime)) != 0)
if( PIOS_COM_SendBufferNonBlocking(pios_com_overo_id, (uint8_t *) &tickTime, sizeof(tickTime)) < 0)
goto fail;
if( PIOS_COM_SendBufferNonBlocking(pios_com_overo_id, data, length) != 0)
if( PIOS_COM_SendBufferNonBlocking(pios_com_overo_id, data, length) < 0)
goto fail;
overosync->sent_bytes += length + 4;

View File

@ -171,14 +171,6 @@ void PIOS_OVERO_DMA_irq_handler(uint32_t overo_id)
// Load any pending bytes from TX fifo
PIOS_OVERO_WriteData(overo_dev);
/*if (overo_dev->tx_out_cb) {
bool tx_need_yield = false;
(overo_dev->tx_out_cb)(overo_dev->tx_out_context, &overo_dev->tx_buffer[overo_dev->writing_buffer][0], PACKET_SIZE, NULL, &tx_need_yield);
if (tx_need_yield) {
vPortYieldFromISR();
}
}*/
overo_dev->packets++;
}
@ -193,6 +185,17 @@ int32_t PIOS_OVERO_GetPacketCount(uint32_t overo_id)
return overo_dev->packets;
}
/**
* Debugging information to check how it is runnign
*/
int32_t PIOS_OVERO_GetWrittenBytes(uint32_t overo_id)
{
struct pios_overo_dev * overo_dev = (struct pios_overo_dev *) overo_id;
PIOS_Assert(PIOS_OVERO_validate(overo_dev));
return overo_dev->writing_offset;
}
/**
* Initialise a single Overo device
*/

View File

@ -32,6 +32,7 @@
extern void PIOS_OVERO_DMA_irq_handler(uint32_t overo_id);
extern int32_t PIOS_OVERO_GetPacketCount(uint32_t overo_id);
extern int32_t PIOS_OVERO_GetWrittenBytes(uint32_t overo_id);
#endif /* PIOS_OVERO_H */

View File

@ -795,8 +795,8 @@ void PIOS_Board_Init(void) {
PIOS_Assert(rx_buffer);
PIOS_Assert(tx_buffer);
if (PIOS_COM_Init(&pios_com_overo_id, &pios_overo_com_driver, pios_overo_id,
rx_buffer, PIOS_COM_TELEM_USB_RX_BUF_LEN,
tx_buffer, PIOS_COM_TELEM_USB_TX_BUF_LEN)) {
rx_buffer, PACKET_SIZE,
tx_buffer, PACKET_SIZE)) {
PIOS_Assert(0);
}
}