1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

Simplified the binary code a little, added a 300ms delay after sending a FULL COLD RESTART to the GPS (IF we do that is), fixed some spelling mistakes.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2843 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2011-02-22 12:15:25 +00:00 committed by pip
parent 9d14723dcc
commit 3881c652c1
3 changed files with 17 additions and 18 deletions

View File

@ -139,6 +139,12 @@ static void gpsTask(void *parameters)
#ifdef FULL_COLD_RESTART
// tell the GPS to do a FULL COLD restart
PIOS_COM_SendStringNonBlocking(gpsPort, "$PMTK104*37\r\n");
timeOfLastCommandMs = timeNowMs;
while (timeNowMs - timeOfLastCommandMs < 300) // delay for 300ms to let the GPS sort itself out
{
vTaskDelay(xDelay); // Block task until next update
timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS;;
}
#endif
#ifdef DISABLE_GPS_TRESHOLD
@ -151,7 +157,7 @@ static void gpsTask(void *parameters)
#endif
#ifdef ENABLE_GPS_ONESENTENCE_GTOP
// switch to single sentance mode
// switch to single sentence mode
PIOS_COM_SendStringNonBlocking(gpsPort, "$PGCMD,21,2*6C\r\n");
#endif
@ -187,7 +193,7 @@ static void gpsTask(void *parameters)
}
#else
// NMEA or SINGLE-SENTANCE GPS mode
// NMEA or SINGLE-SENTENCE GPS mode
// This blocks the task until there is something on the buffer
while (PIOS_COM_ReceiveBufferUsed(gpsPort) > 0)
@ -281,7 +287,7 @@ static void gpsTask(void *parameters)
#endif
#ifdef ENABLE_GPS_ONESENTENCE_GTOP
// switch to single sentance mode
// switch to single sentence mode
PIOS_COM_SendStringNonBlocking(gpsPort,"$PGCMD,21,2*6C\r\n");
#endif

View File

@ -152,8 +152,12 @@ int GTOP_BIN_update_position(uint8_t b, volatile uint32_t *chksum_errors, volati
if (rx_packet->header != 0x2404 ||
rx_packet->end_word != 0x0A0D ||
rx_packet->asterisk != 0x2A)
{ // no valid packet found - yet
rx_packet->asterisk != 0x2A ||
(rx_packet->data.ns_indicator != 1 && rx_packet->data.ns_indicator != 2) ||
(rx_packet->data.ew_indicator != 1 && rx_packet->data.ew_indicator != 2) ||
(rx_packet->data.fix_quality > 2) ||
(rx_packet->data.fix_type < 1 || rx_packet->data.fix_type > 3) )
{ // invalid packet
if (parsing_errors) *parsing_errors++;
memmove(gps_rx_buffer, gps_rx_buffer + 1, gps_rx_buffer_wr - 1);
gps_rx_buffer_wr--;
@ -176,18 +180,7 @@ int GTOP_BIN_update_position(uint8_t b, volatile uint32_t *chksum_errors, volati
}
// checksum appears correct
if ( (rx_packet->data.ns_indicator != 1 && rx_packet->data.ns_indicator != 2) ||
(rx_packet->data.ew_indicator != 1 && rx_packet->data.ew_indicator != 2) ||
(rx_packet->data.fix_quality > 2) ||
(rx_packet->data.fix_type < 1 || rx_packet->data.fix_type > 3) )
{ // found some invalid params - discard the packet
if (parsing_errors) *parsing_errors++;
memmove(gps_rx_buffer, gps_rx_buffer + 1, gps_rx_buffer_wr - 1);
gps_rx_buffer_wr--;
continue;
}
//
// we now have a valid complete binary packet, update the GpsData and GpsTime objects
// correct the endian order of the parameters

View File

@ -38,7 +38,7 @@
// you MUST have one of these uncommented - and ONLY one
//#define ENABLE_GPS_BINARY_GTOP // uncomment this if we are using GTOP BINARY mode
//#define ENABLE_GPS_ONESENTENCE_GTOP // uncomment this if we are using GTOP SINLGE SENTENCE mode
//#define ENABLE_GPS_ONESENTENCE_GTOP // uncomment this if we are using GTOP SINGLE SENTENCE mode
#define ENABLE_GPS_NMEA // uncomment this if we are using NMEA mode
// ****************