mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +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:
parent
9d14723dcc
commit
3881c652c1
@ -139,6 +139,12 @@ static void gpsTask(void *parameters)
|
|||||||
#ifdef FULL_COLD_RESTART
|
#ifdef FULL_COLD_RESTART
|
||||||
// tell the GPS to do a FULL COLD restart
|
// tell the GPS to do a FULL COLD restart
|
||||||
PIOS_COM_SendStringNonBlocking(gpsPort, "$PMTK104*37\r\n");
|
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
|
#endif
|
||||||
|
|
||||||
#ifdef DISABLE_GPS_TRESHOLD
|
#ifdef DISABLE_GPS_TRESHOLD
|
||||||
@ -151,7 +157,7 @@ static void gpsTask(void *parameters)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_GPS_ONESENTENCE_GTOP
|
#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");
|
PIOS_COM_SendStringNonBlocking(gpsPort, "$PGCMD,21,2*6C\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -187,7 +193,7 @@ static void gpsTask(void *parameters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// NMEA or SINGLE-SENTANCE 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_ReceiveBufferUsed(gpsPort) > 0)
|
||||||
@ -281,7 +287,7 @@ static void gpsTask(void *parameters)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_GPS_ONESENTENCE_GTOP
|
#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");
|
PIOS_COM_SendStringNonBlocking(gpsPort,"$PGCMD,21,2*6C\r\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -152,8 +152,12 @@ int GTOP_BIN_update_position(uint8_t b, volatile uint32_t *chksum_errors, volati
|
|||||||
|
|
||||||
if (rx_packet->header != 0x2404 ||
|
if (rx_packet->header != 0x2404 ||
|
||||||
rx_packet->end_word != 0x0A0D ||
|
rx_packet->end_word != 0x0A0D ||
|
||||||
rx_packet->asterisk != 0x2A)
|
rx_packet->asterisk != 0x2A ||
|
||||||
{ // no valid packet found - yet
|
(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++;
|
if (parsing_errors) *parsing_errors++;
|
||||||
memmove(gps_rx_buffer, gps_rx_buffer + 1, gps_rx_buffer_wr - 1);
|
memmove(gps_rx_buffer, gps_rx_buffer + 1, gps_rx_buffer_wr - 1);
|
||||||
gps_rx_buffer_wr--;
|
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
|
// 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
|
// we now have a valid complete binary packet, update the GpsData and GpsTime objects
|
||||||
|
|
||||||
// correct the endian order of the parameters
|
// correct the endian order of the parameters
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
// you MUST have one of these uncommented - and ONLY one
|
// 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_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
|
#define ENABLE_GPS_NMEA // uncomment this if we are using NMEA mode
|
||||||
|
|
||||||
// ****************
|
// ****************
|
||||||
|
Loading…
Reference in New Issue
Block a user