Skip to content

Commit fae14c1

Browse files
committed
Update data logging examples 4-6
1 parent 5a4ac25 commit fae14c1

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

examples/Data_Logging/DataLoggingExample4_RXM_without_Callbacks/DataLoggingExample4_RXM_without_Callbacks.ino

+6-9
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
Insert a formatted micro-SD card into the socket on the Carrier Board.
3636
Connect the Carrier Board to your computer using a USB-C cable.
3737
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
38-
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
39-
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
40-
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
38+
This code has been tested using version 2.2.0 of the Apollo3 boards on Arduino IDE 1.8.13.
4139
Select "Artemis MicroMod Processor" as the board type.
4240
Press upload to upload the code onto the Artemis.
4341
Open the Serial Monitor at 115200 baud to see the output.
@@ -77,6 +75,7 @@ File myFile; //File that all GNSS data is written to
7775

7876
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
7977
#define fileBufferSize 16384 // Allocate 16KBytes of RAM for UBX message storage
78+
uint8_t *myBuffer; // A buffer to hold the data while we write it to SD card
8079

8180
unsigned long lastPrint; // Record when the last Serial print took place
8281
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
@@ -181,6 +180,8 @@ void setup()
181180

182181
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
183182

183+
myBuffer = new uint8_t[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
184+
184185
Serial.println(F("Press any key to stop logging."));
185186

186187
lastPrint = millis(); // Initialize lastPrint
@@ -198,9 +199,7 @@ void loop()
198199
{
199200
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
200201

201-
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
202-
203-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
202+
myGNSS.extractFileBufferData(myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
204203

205204
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
206205

@@ -242,15 +241,13 @@ void loop()
242241
{
243242
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
244243

245-
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
246-
247244
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
248245
if (bytesToWrite > sdWriteSize)
249246
{
250247
bytesToWrite = sdWriteSize;
251248
}
252249

253-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
250+
myGNSS.extractFileBufferData(myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
254251

255252
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
256253

examples/Data_Logging/DataLoggingExample5_Fast_RXM/DataLoggingExample5_Fast_RXM.ino

+6-9
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
Insert a formatted micro-SD card into the socket on the Carrier Board.
3636
Connect the Carrier Board to your computer using a USB-C cable.
3737
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
38-
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
39-
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
40-
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
38+
This code has been tested using version 2.2.0 of the Apollo3 boards on Arduino IDE 1.8.13.
4139
Select "Artemis MicroMod Processor" as the board type.
4240
Press upload to upload the code onto the Artemis.
4341
Open the Serial Monitor at 115200 baud to see the output.
@@ -77,6 +75,7 @@ File myFile; //File that all GNSS data is written to
7775

7876
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
7977
#define fileBufferSize 32768 // Allocate 32KBytes of RAM for UBX message storage
78+
uint8_t *myBuffer; // A buffer to hold the data while we write it to SD card
8079

8180
unsigned long lastPrint; // Record when the last Serial print took place
8281
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
@@ -196,6 +195,8 @@ void setup()
196195

197196
myGNSS.logRXMRAWX(); // Enable RXM RAWX data logging
198197

198+
myBuffer = new uint8_t[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
199+
199200
Serial.println(F("Press any key to stop logging."));
200201

201202
lastPrint = millis(); // Initialize lastPrint
@@ -213,9 +214,7 @@ void loop()
213214
{
214215
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
215216

216-
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
217-
218-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
217+
myGNSS.extractFileBufferData(myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
219218

220219
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
221220

@@ -263,15 +262,13 @@ void loop()
263262
{
264263
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
265264

266-
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
267-
268265
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
269266
if (bytesToWrite > sdWriteSize)
270267
{
271268
bytesToWrite = sdWriteSize;
272269
}
273270

274-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
271+
myGNSS.extractFileBufferData(myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
275272

276273
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
277274

examples/Data_Logging/DataLoggingExample6_NMEA/DataLoggingExample6_NMEA.ino

+6-9
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
Insert a formatted micro-SD card into the socket on the Carrier Board.
2525
Connect the Carrier Board to your computer using a USB-C cable.
2626
Ensure you have the SparkFun Apollo3 boards installed: http://boardsmanager/All#SparkFun_Apollo3
27-
This code has been tested using version 2.1.0 of the Apollo3 boards on Arduino IDE 1.8.13.
28-
- Version 2.1.1 of Apollo3 contains a feature which makes I2C communication with u-blox modules problematic
29-
- We recommend using v2.1.0 of Apollo3 until v2.2.0 is released
27+
This code has been tested using version 2.2.0 of the Apollo3 boards on Arduino IDE 1.8.13.
3028
Select "Artemis MicroMod Processor" as the board type.
3129
Press upload to upload the code onto the Artemis.
3230
Open the Serial Monitor at 115200 baud to see the output.
@@ -68,6 +66,7 @@ File myFile; //File that all GNSS data is written to
6866

6967
#define sdWriteSize 512 // Write data to the SD card in blocks of 512 bytes
7068
#define fileBufferSize 16384 // Allocate 16KBytes of RAM for UBX message storage
69+
uint8_t *myBuffer; // A buffer to hold the data while we write it to SD card
7170

7271
unsigned long lastPrint; // Record when the last Serial print took place
7372
unsigned long bytesWritten = 0; // Record how many bytes have been written to SD card
@@ -175,6 +174,8 @@ void setup()
175174
myGNSS.setNMEALoggingMask(SFE_UBLOX_FILTER_NMEA_ALL); // Enable logging of all enabled NMEA messages
176175
//myGNSS.setNMEALoggingMask(SFE_UBLOX_FILTER_NMEA_GGA | SFE_UBLOX_FILTER_NMEA_GSA); // Or we can, for example, log only GxGGA & GxGSA and ignore GxGSV
177176

177+
myBuffer = new uint8_t[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
178+
178179
Serial.println(F("Press any key to stop logging."));
179180

180181
lastPrint = millis(); // Initialize lastPrint
@@ -192,9 +193,7 @@ void loop()
192193
{
193194
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN each time we write to the SD card
194195

195-
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
196-
197-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
196+
myGNSS.extractFileBufferData(myBuffer, sdWriteSize); // Extract exactly sdWriteSize bytes from the UBX file buffer and put them into myBuffer
198197

199198
myFile.write(myBuffer, sdWriteSize); // Write exactly sdWriteSize bytes from myBuffer to the ubxDataFile on the SD card
200199

@@ -236,15 +235,13 @@ void loop()
236235
{
237236
digitalWrite(LED_BUILTIN, HIGH); // Flash LED_BUILTIN while we write to the SD card
238237

239-
uint8_t myBuffer[sdWriteSize]; // Create our own buffer to hold the data while we write it to SD card
240-
241238
uint16_t bytesToWrite = remainingBytes; // Write the remaining bytes to SD card sdWriteSize bytes at a time
242239
if (bytesToWrite > sdWriteSize)
243240
{
244241
bytesToWrite = sdWriteSize;
245242
}
246243

247-
myGNSS.extractFileBufferData((uint8_t *)&myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
244+
myGNSS.extractFileBufferData(myBuffer, bytesToWrite); // Extract bytesToWrite bytes from the UBX file buffer and put them into myBuffer
248245

249246
myFile.write(myBuffer, bytesToWrite); // Write bytesToWrite bytes from myBuffer to the ubxDataFile on the SD card
250247

0 commit comments

Comments
 (0)