@@ -99,6 +99,66 @@ typedef enum
99
99
SFE_UBLOX_PACKET_PACKETAUTO
100
100
} sfe_ublox_packet_buffer_e;
101
101
102
+ // Define a struct to allow selective logging of NMEA messages
103
+ typedef struct
104
+ {
105
+ union
106
+ {
107
+ uint32_t all;
108
+ struct
109
+ {
110
+ uint32_t all : 1 ;
111
+ uint32_t UBX_NMEA_DTM : 1 ;
112
+ uint32_t UBX_NMEA_GAQ : 1 ;
113
+ uint32_t UBX_NMEA_GBQ : 1 ;
114
+ uint32_t UBX_NMEA_GBS : 1 ;
115
+ uint32_t UBX_NMEA_GGA : 1 ;
116
+ uint32_t UBX_NMEA_GLL : 1 ;
117
+ uint32_t UBX_NMEA_GLQ : 1 ;
118
+ uint32_t UBX_NMEA_GNQ : 1 ;
119
+ uint32_t UBX_NMEA_GNS : 1 ;
120
+ uint32_t UBX_NMEA_GPQ : 1 ;
121
+ uint32_t UBX_NMEA_GQQ : 1 ;
122
+ uint32_t UBX_NMEA_GRS : 1 ;
123
+ uint32_t UBX_NMEA_GSA : 1 ;
124
+ uint32_t UBX_NMEA_GST : 1 ;
125
+ uint32_t UBX_NMEA_GSV : 1 ;
126
+ uint32_t UBX_NMEA_RLM : 1 ;
127
+ uint32_t UBX_NMEA_RMC : 1 ;
128
+ uint32_t UBX_NMEA_TXT : 1 ;
129
+ uint32_t UBX_NMEA_VLW : 1 ;
130
+ uint32_t UBX_NMEA_VTG : 1 ;
131
+ uint32_t UBX_NMEA_ZDA : 1 ;
132
+ } bits;
133
+ };
134
+ } sfe_ublox_nmea_logging_t ;
135
+ // Define an enum to make it easy to enable/disable selected NMEA messages for logging
136
+ typedef enum
137
+ {
138
+ SFE_UBLOX_LOG_NMEA_ALL = 0x00000001 ,
139
+ SFE_UBLOX_LOG_NMEA_DTM = 0x00000002 ,
140
+ SFE_UBLOX_LOG_NMEA_GAQ = 0x00000004 ,
141
+ SFE_UBLOX_LOG_NMEA_GBQ = 0x00000008 ,
142
+ SFE_UBLOX_LOG_NMEA_GBS = 0x00000010 ,
143
+ SFE_UBLOX_LOG_NMEA_GGA = 0x00000020 ,
144
+ SFE_UBLOX_LOG_NMEA_GLL = 0x00000040 ,
145
+ SFE_UBLOX_LOG_NMEA_GLQ = 0x00000080 ,
146
+ SFE_UBLOX_LOG_NMEA_GNQ = 0x00000100 ,
147
+ SFE_UBLOX_LOG_NMEA_GNS = 0x00000200 ,
148
+ SFE_UBLOX_LOG_NMEA_GPQ = 0x00000400 ,
149
+ SFE_UBLOX_LOG_NMEA_GQQ = 0x00000800 ,
150
+ SFE_UBLOX_LOG_NMEA_GRS = 0x00001000 ,
151
+ SFE_UBLOX_LOG_NMEA_GSA = 0x00002000 ,
152
+ SFE_UBLOX_LOG_NMEA_GST = 0x00004000 ,
153
+ SFE_UBLOX_LOG_NMEA_GSV = 0x00008000 ,
154
+ SFE_UBLOX_LOG_NMEA_RLM = 0x00010000 ,
155
+ SFE_UBLOX_LOG_NMEA_RMC = 0x00020000 ,
156
+ SFE_UBLOX_LOG_NMEA_TXT = 0x00040000 ,
157
+ SFE_UBLOX_LOG_NMEA_VLW = 0x00080000 ,
158
+ SFE_UBLOX_LOG_NMEA_VTG = 0x00100000 ,
159
+ SFE_UBLOX_LOG_NMEA_ZDA = 0x00200000
160
+ } sfe_ublox_nmea_logging_selective_e;
161
+
102
162
// Registers
103
163
const uint8_t UBX_SYNCH_1 = 0xB5 ;
104
164
const uint8_t UBX_SYNCH_2 = 0x62 ;
@@ -159,7 +219,7 @@ const uint8_t UBX_CFG_VALSET = 0x8A; //Used for config of higher version u-blox
159
219
160
220
// Class: NMEA
161
221
// The following are used to enable NMEA messages. Descriptions come from the NMEA messages overview in the ZED-F9P Interface Description
162
- const uint8_t UBX_NMEA_MSB = 0xF0 ; // All NMEA enable commands have 0xF0 as MSB
222
+ const uint8_t UBX_NMEA_MSB = 0xF0 ; // All NMEA enable commands have 0xF0 as MSB. Equal to UBX_CLASS_NMEA
163
223
const uint8_t UBX_NMEA_DTM = 0x0A ; // GxDTM (datum reference)
164
224
const uint8_t UBX_NMEA_GAQ = 0x45 ; // GxGAQ (poll a standard message (if the current talker ID is GA))
165
225
const uint8_t UBX_NMEA_GBQ = 0x44 ; // GxGBQ (poll a standard message (if the current Talker ID is GB))
@@ -169,11 +229,13 @@ const uint8_t UBX_NMEA_GLL = 0x01; //GxGLL (latitude and long, whith time of pos
169
229
const uint8_t UBX_NMEA_GLQ = 0x43 ; // GxGLQ (poll a standard message (if the current Talker ID is GL))
170
230
const uint8_t UBX_NMEA_GNQ = 0x42 ; // GxGNQ (poll a standard message (if the current Talker ID is GN))
171
231
const uint8_t UBX_NMEA_GNS = 0x0D ; // GxGNS (GNSS fix data)
172
- const uint8_t UBX_NMEA_GPQ = 0x040 ; // GxGPQ (poll a standard message (if the current Talker ID is GP))
232
+ const uint8_t UBX_NMEA_GPQ = 0x40 ; // GxGPQ (poll a standard message (if the current Talker ID is GP))
233
+ const uint8_t UBX_NMEA_GQQ = 0x47 ; // GxGQQ (poll a standard message (if the current Talker ID is GQ))
173
234
const uint8_t UBX_NMEA_GRS = 0x06 ; // GxGRS (GNSS range residuals)
174
235
const uint8_t UBX_NMEA_GSA = 0x02 ; // GxGSA (GNSS DOP and Active satellites)
175
236
const uint8_t UBX_NMEA_GST = 0x07 ; // GxGST (GNSS Pseudo Range Error Statistics)
176
237
const uint8_t UBX_NMEA_GSV = 0x03 ; // GxGSV (GNSS satellites in view)
238
+ const uint8_t UBX_NMEA_RLM = 0x0B ; // GxRMC (Return link message (RLM))
177
239
const uint8_t UBX_NMEA_RMC = 0x04 ; // GxRMC (Recommended minimum data)
178
240
const uint8_t UBX_NMEA_TXT = 0x41 ; // GxTXT (text transmission)
179
241
const uint8_t UBX_NMEA_VLW = 0x0F ; // GxVLW (dual ground/water distance)
@@ -928,8 +990,9 @@ class SFE_UBLOX_GNSS
928
990
void flushHNRPVT (); // Mark all the data as read/stale
929
991
void logHNRPVT (boolean enabled = true ); // Log data to file buffer
930
992
931
- // Helper function for NMEA logging
932
- void logNMEA (boolean enabled = true ); // Log NMEA data to file buffer
993
+ // Helper functions for NMEA logging
994
+ void setNMEALoggingMask (uint32_t messages = SFE_UBLOX_LOG_NMEA_ALL); // Log selected NMEA messages to file buffer - if enabled
995
+ uint32_t getNMEALoggingMask (); // Return which NMEA messages are selected for logging to the file buffer - if enabled
933
996
934
997
// Helper functions for CFG RATE
935
998
@@ -1186,7 +1249,7 @@ class SFE_UBLOX_GNSS
1186
1249
1187
1250
boolean ubx7FcheckDisabled = false ; // Flag to indicate if the "7F" check should be ignored in checkUbloxI2C
1188
1251
1189
- boolean _logNMEA = false ; // Flag to indicate if NMEA data should be added to the file buffer
1252
+ sfe_ublox_nmea_logging_t _logNMEA; // Flags to indicate which NMEA messages should be added to the file buffer for logging
1190
1253
1191
1254
// The packet buffers
1192
1255
// These are pointed at from within the ubxPacket
@@ -1218,11 +1281,15 @@ class SFE_UBLOX_GNSS
1218
1281
1219
1282
unsigned long lastCheck = 0 ;
1220
1283
1221
- uint16_t ubxFrameCounter; // It counts all UBX frame. [Fixed header(2bytes), CLS(1byte), ID(1byte), length(2bytes), payload(x bytes), checksums(2bytes)]
1222
-
1284
+ uint16_t ubxFrameCounter; // Count all UBX frame bytes. [Fixed header(2bytes), CLS(1byte), ID(1byte), length(2bytes), payload(x bytes), checksums(2bytes)]
1223
1285
uint8_t rollingChecksumA; // Rolls forward as we receive incoming bytes. Checked against the last two A/B checksum bytes
1224
1286
uint8_t rollingChecksumB; // Rolls forward as we receive incoming bytes. Checked against the last two A/B checksum bytes
1225
1287
1288
+ int16_t nmeaByteCounter; // Count all NMEA message bytes.
1289
+ const int16_t maxNMEAByteCount = 1024 ; // Abort NMEA message reception if nmeaByteCounter exceeds this
1290
+ uint8_t nmeaAddressField[6 ]; // NMEA Address Field - includes the start character (*)
1291
+ boolean logThisNMEA (); // Return true if we should log this NMEA message
1292
+
1226
1293
uint16_t rtcmLen = 0 ;
1227
1294
1228
1295
// Flag to prevent reentry into checkCallbacks
0 commit comments