mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
Merge branch 'OP-567 GPS com layer fix' into next
This commit is contained in:
commit
8b7fea0d19
@ -46,6 +46,7 @@
|
|||||||
#include "gpsposition.h"
|
#include "gpsposition.h"
|
||||||
#include "homelocation.h"
|
#include "homelocation.h"
|
||||||
#include "gpstime.h"
|
#include "gpstime.h"
|
||||||
|
#include "gpssatellites.h"
|
||||||
#include "WorldMagModel.h"
|
#include "WorldMagModel.h"
|
||||||
#include "CoordinateConversions.h"
|
#include "CoordinateConversions.h"
|
||||||
|
|
||||||
@ -126,7 +127,10 @@ int32_t GPSInitialize(void)
|
|||||||
{
|
{
|
||||||
GPSPositionInitialize();
|
GPSPositionInitialize();
|
||||||
GPSTimeInitialize();
|
GPSTimeInitialize();
|
||||||
|
GPSSatellitesInitialize();
|
||||||
|
#ifdef PIOS_GPS_SETS_HOMELOCATION
|
||||||
HomeLocationInitialize();
|
HomeLocationInitialize();
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: Get gps settings object
|
// TODO: Get gps settings object
|
||||||
gpsPort = PIOS_COM_GPS;
|
gpsPort = PIOS_COM_GPS;
|
||||||
@ -195,14 +199,12 @@ static void gpsTask(void *parameters)
|
|||||||
// Loop forever
|
// Loop forever
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
uint8_t c;
|
||||||
#ifdef ENABLE_GPS_BINARY_GTOP
|
#ifdef ENABLE_GPS_BINARY_GTOP
|
||||||
// GTOP BINARY GPS mode
|
// 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)
|
if (GTOP_BIN_update_position(c, &numChecksumErrors, &numParsingErrors) >= 0)
|
||||||
{
|
{
|
||||||
numUpdates++;
|
numUpdates++;
|
||||||
@ -217,10 +219,8 @@ static void gpsTask(void *parameters)
|
|||||||
// NMEA or SINGLE-SENTENCE GPS mode
|
// NMEA or SINGLE-SENTENCE GPS mode
|
||||||
|
|
||||||
// This blocks the task until there is something on the buffer
|
// 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
|
// detect start while acquiring stream
|
||||||
if (!start_flag && (c == '$'))
|
if (!start_flag && (c == '$'))
|
||||||
@ -358,8 +358,6 @@ static void gpsTask(void *parameters)
|
|||||||
AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_CRITICAL);
|
AlarmsSet(SYSTEMALARMS_ALARM_GPS, SYSTEMALARMS_ALARM_CRITICAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block task until next update
|
|
||||||
vTaskDelay(xDelay);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user