From 1220ef204aa262a74635c761d4bdeeba8ed91b5a Mon Sep 17 00:00:00 2001 From: PaulZC Date: Tue, 13 Apr 2021 15:30:20 +0100 Subject: [PATCH] Move logNMEA into process so it does not matter if processNMEA is overwritten --- .../DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino | 3 --- src/SparkFun_u-blox_GNSS_Arduino_Library.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino b/examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino index 6101326..80e2b62 100644 --- a/examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino +++ b/examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino @@ -9,9 +9,6 @@ This example shows how to configure the u-blox GNSS to send PVT reports automatically and log those and any incoming NMEA messages to SD card in UBX format - ** Please note: NMEA logging relies upon processNMEA ** - ** You will not be able to log NMEA data automatically through the library if you overwrite processNMEA with your own function ** - ** Please note: this example will only work on processors like the Artemis which have plenty of RAM available ** This code is intended to be run on the MicroMod Data Logging Carrier Board using the Artemis Processor diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp index 895f374..cfba10d 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp @@ -1243,6 +1243,10 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r } else if (currentSentence == NMEA) { + //If _logNMEA is true, attempt to store incoming in the file buffer + if (_logNMEA) + storeFileBytes(&incoming, 1); + processNMEA(incoming); //Process each NMEA character } else if (currentSentence == RTCM) @@ -1259,10 +1263,6 @@ void SFE_UBLOX_GNSS::processNMEA(char incoming) //If user has assigned an output port then pipe the characters there if (_nmeaOutputPort != NULL) _nmeaOutputPort->write(incoming); //Echo this byte to the serial port - - //If _logNMEA is true, attempt to store incoming in the file buffer - if (_logNMEA) - storeFileBytes((uint8_t *)&incoming, 1); } //We need to be able to identify an RTCM packet and then the length