From 3656caccbb4b609be818c54a9738cce2fcb148e2 Mon Sep 17 00:00:00 2001 From: sambas Date: Sat, 27 Mar 2010 13:13:39 +0000 Subject: [PATCH] Checksum check for nmea sentences git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@399 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/OpenPilot/Modules/GPS/GPS.c | 46 +++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/flight/OpenPilot/Modules/GPS/GPS.c b/flight/OpenPilot/Modules/GPS/GPS.c index b9255eabc..fb252cb41 100644 --- a/flight/OpenPilot/Modules/GPS/GPS.c +++ b/flight/OpenPilot/Modules/GPS/GPS.c @@ -61,8 +61,8 @@ static int32_t addObject(UAVObjHandle obj); static int32_t setUpdatePeriod(UAVObjHandle obj, int32_t updatePeriodMs); // functions -void nmeaInit(void); char* nmeaGetPacketBuffer(void); +char nmeaChecksum(char* gps_buffer); uint8_t nmeaProcess(cBuffer* rxBuffer); void nmeaProcessGPGGA(char* packet); void nmeaProcessGPVTG(char* packet); @@ -215,6 +215,38 @@ char* nmeaGetPacketBuffer(void) return NmeaPacket; } +/** + * Prosesses NMEA sentence checksum + * \param[in] Buffer for parsed nmea sentence + * \return 0 checksum not valid + * \return 1 checksum valid + */ +char nmeaChecksum(char* gps_buffer) +{ + char checksum=0; + char checksum_received=0; + + for(int x=0; x