You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uint8_t hms = ubxDataStruct.hour; // Print the hours
84
+
uint8_t hms = ubxDataStruct->hour; // Print the hours
86
85
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
87
86
Serial.print(hms);
88
87
Serial.print(F(":"));
89
-
hms = ubxDataStruct.min; // Print the minutes
88
+
hms = ubxDataStruct->min; // Print the minutes
90
89
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
91
90
Serial.print(hms);
92
91
Serial.print(F(":"));
93
-
hms = ubxDataStruct.sec; // Print the seconds
92
+
hms = ubxDataStruct->sec; // Print the seconds
94
93
if (hms < 10) Serial.print(F("0")); // Print a leading zero if required
95
94
Serial.print(hms);
96
95
Serial.print(F("."));
97
-
unsignedlong millisecs = ubxDataStruct.iTOW % 1000; // Print the milliseconds
96
+
unsignedlong millisecs = ubxDataStruct->iTOW % 1000; // Print the milliseconds
98
97
if (millisecs < 100) Serial.print(F("0")); // Print the trailing zeros correctly
99
98
if (millisecs < 10) Serial.print(F("0"));
100
99
Serial.print(millisecs);
101
100
102
-
long latitude = ubxDataStruct.lat; // Print the latitude
101
+
long latitude = ubxDataStruct->lat; // Print the latitude
103
102
Serial.print(F(" Lat: "));
104
103
Serial.print(latitude);
105
104
106
-
long longitude = ubxDataStruct.lon; // Print the longitude
105
+
long longitude = ubxDataStruct->lon; // Print the longitude
107
106
Serial.print(F(" Long: "));
108
107
Serial.print(longitude);
109
108
Serial.print(F(" (degrees * 10^-7)"));
110
109
111
-
long altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
110
+
long altitude = ubxDataStruct->hMSL; // Print the height above mean sea level
112
111
Serial.print(F(" Height above MSL: "));
113
112
Serial.print(altitude);
114
113
Serial.println(F(" (mm)"));
@@ -200,10 +199,12 @@ void setup()
200
199
201
200
myGNSS.setNavigationFrequency(1); //Produce one navigation solution per second
202
201
203
-
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
202
+
myGNSS.setAutoPVTcallbackPtr(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
204
203
205
204
myGNSS.logNAVPVT(); // Enable NAV PVT data logging
206
205
206
+
myBuffer = newuint8_t[packetLength]; // Create our own buffer to hold the data while we write it to SD card
207
+
207
208
Serial.println(F("Press any key to stop logging."));
208
209
}
209
210
@@ -214,9 +215,7 @@ void loop()
214
215
215
216
if (myGNSS.fileBufferAvailable() >= packetLength) // Check to see if a new packetLength-byte NAV PVT message has been stored
216
217
{
217
-
uint8_t myBuffer[packetLength]; // Create our own buffer to hold the data while we write it to SD card
218
-
219
-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, packetLength); // Extract exactly packetLength bytes from the UBX file buffer and put them into myBuffer
218
+
myGNSS.extractFileBufferData(myBuffer, packetLength); // Extract exactly packetLength bytes from the UBX file buffer and put them into myBuffer
220
219
221
220
myFile.write(myBuffer, packetLength); // Write exactly packetLength bytes from myBuffer to the ubxDataFile on the SD card
Serial.print(F(" towMsR: ")); // Time Of Week of rising edge (ms)
109
-
Serial.print(ubxDataStruct.towMsR);
108
+
Serial.print(ubxDataStruct->towMsR);
110
109
111
110
Serial.print(F(" towSubMsR: ")); // Millisecond fraction of Time Of Week of rising edge in nanoseconds
112
-
Serial.print(ubxDataStruct.towSubMsR);
111
+
Serial.print(ubxDataStruct->towSubMsR);
113
112
114
113
Serial.print(F(" towMsF: ")); // Time Of Week of falling edge (ms)
115
-
Serial.print(ubxDataStruct.towMsF);
114
+
Serial.print(ubxDataStruct->towMsF);
116
115
117
116
Serial.print(F(" towSubMsF: ")); // Millisecond fraction of Time Of Week of falling edge in nanoseconds
118
-
Serial.println(ubxDataStruct.towSubMsF);
117
+
Serial.println(ubxDataStruct->towSubMsF);
119
118
120
119
dotsPrinted = 0; // Reset dotsPrinted
121
120
}
@@ -206,10 +205,12 @@ void setup()
206
205
207
206
myGNSS.setNavigationFrequency(1); //Produce one navigation solution per second
208
207
209
-
myGNSS.setAutoTIMTM2callback(&printTIMTM2data); // Enable automatic TIM TM2 messages with callback to printTIMTM2data
208
+
myGNSS.setAutoTIMTM2callbackPtr(&printTIMTM2data); // Enable automatic TIM TM2 messages with callback to printTIMTM2data
210
209
211
210
myGNSS.logTIMTM2(); // Enable TIM TM2 data logging
212
211
212
+
myBuffer = newuint8_t[packetLength]; // Create our own buffer to hold the data while we write it to SD card
213
+
213
214
Serial.println(F("Press any key to stop logging."));
214
215
}
215
216
@@ -220,9 +221,7 @@ void loop()
220
221
221
222
if (myGNSS.fileBufferAvailable() >= packetLength) // Check to see if a new packetLength-byte TIM TM2 message has been stored
222
223
{
223
-
uint8_t myBuffer[packetLength]; // Create our own buffer to hold the data while we write it to SD card
224
-
225
-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, packetLength); // Extract exactly packetLength bytes from the UBX file buffer and put them into myBuffer
224
+
myGNSS.extractFileBufferData(myBuffer, packetLength); // Extract exactly packetLength bytes from the UBX file buffer and put them into myBuffer
226
225
227
226
myFile.write(myBuffer, packetLength); // Write exactly packetLength bytes from myBuffer to the ubxDataFile on the SD card
// | / _____ You can use any name you like for the struct
106
105
// | | /
107
106
// | | |
108
-
voidnewRAWX(UBX_RXM_RAWX_data_t ubxDataStruct)
107
+
voidnewRAWX(UBX_RXM_RAWX_data_t *ubxDataStruct)
109
108
{
110
109
numRAWX++; // Increment the count
111
110
}
@@ -202,14 +201,16 @@ void setup()
202
201
203
202
myGNSS.setNavigationFrequency(1); //Produce one navigation solution per second (that's plenty for Precise Point Positioning)
204
203
205
-
myGNSS.setAutoRXMSFRBXcallback(&newSFRBX); // Enable automatic RXM SFRBX messages with callback to newSFRBX
204
+
myGNSS.setAutoRXMSFRBXcallbackPtr(&newSFRBX); // Enable automatic RXM SFRBX messages with callback to newSFRBX
206
205
207
206
myGNSS.logRXMSFRBX(); // Enable RXM SFRBX data logging
208
207
209
-
myGNSS.setAutoRXMRAWXcallback(&newRAWX); // Enable automatic RXM RAWX messages with callback to newRAWX
208
+
myGNSS.setAutoRXMRAWXcallbackPtr(&newRAWX); // Enable automatic RXM RAWX messages with callback to newRAWX
210
209
211
210
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
212
211
212
+
myBuffer = newuint8_t[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
213
+
213
214
Serial.println(F("Press any key to stop logging."));
214
215
215
216
lastPrint = millis(); // Initialize lastPrint
@@ -228,9 +229,7 @@ void loop()
228
229
{
229
230
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
230
231
231
-
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
232
-
233
-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
232
+
myGNSS.extractFileBufferData(myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
234
233
235
234
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
236
235
@@ -273,15 +272,13 @@ void loop()
273
272
{
274
273
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
275
274
276
-
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
277
-
278
275
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
279
276
if (bytesToWrite > sdWriteSize)
280
277
{
281
278
bytesToWrite = sdWriteSize;
282
279
}
283
280
284
-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
281
+
myGNSS.extractFileBufferData(myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
285
282
286
283
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
0 commit comments