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

OP-567 Modules/GPS: Block in PIOS_COM, not in TaskDelay - or we will miss updates!

This commit is contained in:
Corvus Corax 2011-08-25 12:20:19 +02:00
parent 838149b53f
commit 697ac6067e

View File

@ -199,14 +199,12 @@ static void gpsTask(void *parameters)
// Loop forever
while (1)
{
uint8_t c;
#ifdef ENABLE_GPS_BINARY_GTOP
// GTOP BINARY GPS mode
while (PIOS_COM_ReceiveBufferUsed(gpsPort) > 0)
while (PIOS_COM_ReceiveBuffer(gpsPort, &c, 1, xDelay) > 0)
{
uint8_t c;
PIOS_COM_ReceiveBuffer(gpsPort, &c, 1, 0);
if (GTOP_BIN_update_position(c, &numChecksumErrors, &numParsingErrors) >= 0)
{
numUpdates++;
@ -221,10 +219,8 @@ static void gpsTask(void *parameters)
// NMEA or SINGLE-SENTENCE GPS mode
// This blocks the task until there is something on the buffer
while (PIOS_COM_ReceiveBufferUsed(gpsPort) > 0)
while (PIOS_COM_ReceiveBuffer(gpsPort, &c, 1, xDelay) > 0)
{
uint8_t c;
PIOS_COM_ReceiveBuffer(gpsPort, &c, 1, 0);
// detect start while acquiring stream
if (!start_flag && (c == '$'))
@ -362,8 +358,6 @@ static void gpsTask(void *parameters)
AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_CRITICAL);
}
// Block task until next update
vTaskDelay(xDelay);
}
}