Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 6ce6ae1

Browse files
committed
Example comment updates
1 parent eb57ec0 commit 6ce6ae1

File tree

9 files changed

+107
-62
lines changed

9 files changed

+107
-62
lines changed

examples/Callbacks/CallbackExample1_NAV_PVT/CallbackExample1_NAV_PVT.ino

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ SFE_UBLOX_GPS myGPS;
2828

2929
// Callback: printPVTdata will be called when new NAV PVT data arrives
3030
// See u-blox_structs.h for the full definition of UBX_NAV_PVT_data_t
31+
// _____ You can use any name you like for the callback. Use the same name when you call setAutoPVTcallback
32+
// / _____ This _must_ be UBX_NAV_PVT_data_t
33+
// | / _____ You can use any name you like for the struct
34+
// | | /
35+
// | | |
3136
void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
3237
{
3338
Serial.println();
@@ -49,7 +54,7 @@ void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
4954
if (millisecs < 100) Serial.print(F("0")); // Print the trailing zeros correctly
5055
if (millisecs < 10) Serial.print(F("0"));
5156
Serial.print(millisecs);
52-
57+
5358
long latitude = ubxDataStruct.lat; // Print the latitude
5459
Serial.print(F(" Lat: "));
5560
Serial.print(latitude);
@@ -58,7 +63,7 @@ void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
5863
Serial.print(F(" Long: "));
5964
Serial.print(longitude);
6065
Serial.print(F(" (degrees * 10^-7)"));
61-
66+
6267
long altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
6368
Serial.print(F(" Height above MSL: "));
6469
Serial.print(altitude);
@@ -83,7 +88,7 @@ void setup()
8388

8489
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
8590
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
86-
91+
8792
myGPS.setNavigationFrequency(2); //Produce two solutions per second
8893

8994
myGPS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
@@ -93,7 +98,7 @@ void loop()
9398
{
9499
myGPS.checkUblox(); // Check for the arrival of new data and process it.
95100
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
96-
101+
97102
Serial.print(".");
98103
delay(50);
99104
}

examples/Callbacks/CallbackExample2_NAV_ODO/CallbackExample2_NAV_ODO.ino

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ SFE_UBLOX_GPS myGPS;
2828

2929
// Callback: printODOdata will be called when new NAV ODO data arrives
3030
// See u-blox_structs.h for the full definition of UBX_NAV_ODO_data_t
31+
// _____ You can use any name you like for the callback. Use the same name when you call setAutoNAVODOcallback
32+
// / _____ This _must_ be UBX_NAV_ODO_data_t
33+
// | / _____ You can use any name you like for the struct
34+
// | | /
35+
// | | |
3136
void printODOdata(UBX_NAV_ODO_data_t ubxDataStruct)
3237
{
3338
Serial.println();
@@ -36,7 +41,7 @@ void printODOdata(UBX_NAV_ODO_data_t ubxDataStruct)
3641
unsigned long iTOW = ubxDataStruct.iTOW; // iTOW is in milliseconds
3742
Serial.print(iTOW);
3843
Serial.print(F(" (ms)"));
39-
44+
4045
Serial.print(F(" Distance: "));
4146
unsigned long distance = ubxDataStruct.distance; // Print the distance
4247
Serial.print(distance);
@@ -66,19 +71,19 @@ void setup()
6671

6772
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
6873
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
69-
74+
7075
myGPS.setNavigationFrequency(1); //Produce one solution per second
7176

7277
//myGPS.resetOdometer(); //Uncomment this line to reset the odometer
73-
78+
7479
myGPS.setAutoNAVODOcallback(&printODOdata); // Enable automatic NAV ODO messages with callback to printODOdata
7580
}
7681

7782
void loop()
7883
{
7984
myGPS.checkUblox(); // Check for the arrival of new data and process it.
8085
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
81-
86+
8287
Serial.print(".");
8388
delay(50);
8489
}

examples/Callbacks/CallbackExample3_TIM_TM2/CallbackExample3_TIM_TM2.ino

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,21 @@ int dotsPrinted = 0; // Print dots in rows of 50 while waiting for a TIM TM2 mes
4343

4444
// Callback: printTIMTM2data will be called when new TIM TM2 data arrives
4545
// See u-blox_structs.h for the full definition of UBX_TIM_TM2_data_t
46+
// _____ You can use any name you like for the callback. Use the same name when you call setAutoTIMTM2callback
47+
// / _____ This _must_ be UBX_TIM_TM2_data_t
48+
// | / _____ You can use any name you like for the struct
49+
// | | /
50+
// | | |
4651
void printTIMTM2data(UBX_TIM_TM2_data_t ubxDataStruct)
4752
{
4853
Serial.println();
4954

5055
Serial.print(F("newFallingEdge: ")); // 1 if a new falling edge was detected
5156
Serial.print(ubxDataStruct.flags.bits.newFallingEdge);
52-
57+
5358
Serial.print(F(" newRisingEdge: ")); // 1 if a new rising edge was detected
5459
Serial.print(ubxDataStruct.flags.bits.newRisingEdge);
55-
60+
5661
Serial.print(F(" Rising Edge Counter: ")); // Rising edge counter
5762
Serial.print(ubxDataStruct.count);
5863

@@ -89,7 +94,7 @@ void setup()
8994

9095
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
9196
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
92-
97+
9398
myGPS.setNavigationFrequency(1); //Produce one solution per second
9499

95100
myGPS.setAutoTIMTM2callback(&printTIMTM2data); // Enable automatic TIM TM2 messages with callback to printTIMTM2data

examples/Callbacks/CallbackExample4_HNR/CallbackExample4_HNR.ino

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
This example configures the High Navigation Rate on the NEO-M8U and then
99
reads and displays the attitude solution, vehicle dynamics information
1010
and high rate position, velocity and time.
11-
11+
1212
This example uses callbacks to process the HNR data automatically. No more polling!
1313
1414
Please make sure your NEO-M8U is running UDR firmware >= 1.31. Please update using u-center if necessary:
@@ -20,7 +20,7 @@
2020
2121
Hardware Connections:
2222
Plug a Qwiic cable into the GPS and a Redboard Qwiic
23-
If you don't have a platform with a Qwiic connection use the
23+
If you don't have a platform with a Qwiic connection use the
2424
SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
2525
Open the serial monitor at 115200 baud to see the output
2626
@@ -33,6 +33,11 @@ SFE_UBLOX_GPS myGPS;
3333

3434
// Callback: printHNRATTdata will be called when new HNR ATT data arrives
3535
// See u-blox_structs.h for the full definition of UBX_HNR_ATT_data_t
36+
// _____ You can use any name you like for the callback. Use the same name when you call setAutoHNRATTcallback
37+
// / _____ This _must_ be UBX_HNR_ATT_data_t
38+
// | / _____ You can use any name you like for the struct
39+
// | | /
40+
// | | |
3641
void printHNRATTdata(UBX_HNR_ATT_data_t ubxDataStruct)
3742
{
3843
Serial.println();
@@ -86,12 +91,12 @@ void setup()
8691

8792
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
8893
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
89-
94+
9095
if (myGPS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
9196
Serial.println(F("setHNRNavigationRate was successful"));
9297
else
9398
Serial.println(F("setHNRNavigationRate was NOT successful"));
94-
99+
95100
if (myGPS.setAutoHNRATTcallback(&printHNRATTdata) == true) // Enable automatic HNR ATT messages with callback to printHNRATTdata
96101
Serial.println(F("setAutoHNRATTcallback successful"));
97102

@@ -106,7 +111,7 @@ void loop()
106111
{
107112
myGPS.checkUblox(); // Check for the arrival of new data and process it.
108113
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
109-
114+
110115
Serial.print(".");
111116
delay(25);
112117
}

examples/Callbacks/CallbackExample5_ESF/CallbackExample5_ESF.ino

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
1818
Hardware Connections:
1919
Plug a Qwiic cable into the GPS and a Redboard Qwiic
20-
If you don't have a platform with a Qwiic connection use the
20+
If you don't have a platform with a Qwiic connection use the
2121
SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
2222
Open the serial monitor at 115200 baud to see the output
2323
@@ -30,6 +30,11 @@ SFE_UBLOX_GPS myGPS;
3030

3131
// Callback: printESFALGdata will be called when new ESF ALG data arrives
3232
// See u-blox_structs.h for the full definition of UBX_ESF_ALG_data_t
33+
// _____ You can use any name you like for the callback. Use the same name when you call setAutoESFALGcallback
34+
// / _____ This _must_ be UBX_ESF_ALG_data_t
35+
// | / _____ You can use any name you like for the struct
36+
// | | /
37+
// | | |
3338
void printESFALGdata(UBX_ESF_ALG_data_t ubxDataStruct)
3439
{
3540
Serial.println();
@@ -38,13 +43,13 @@ void printESFALGdata(UBX_ESF_ALG_data_t ubxDataStruct)
3843
unsigned long iTOW = ubxDataStruct.iTOW; // iTOW is in milliseconds
3944
Serial.print(iTOW);
4045
Serial.print(F(" (ms)"));
41-
46+
4247
Serial.print(F(" Roll: ")); // Print selected data
4348
Serial.print((float)ubxDataStruct.roll / 100.0, 2); // Convert roll to degrees
44-
49+
4550
Serial.print(F(" Pitch: "));
4651
Serial.print((float)ubxDataStruct.pitch / 100.0, 2); // Convert pitch to degrees
47-
52+
4853
Serial.print(F(" Yaw: "));
4954
Serial.print((float)ubxDataStruct.yaw / 100.0, 2); // Convert yaw to degrees
5055

@@ -57,10 +62,10 @@ void printESFINSdata(UBX_ESF_INS_data_t ubxDataStruct)
5762
{
5863
Serial.print(F("xAccel: ")); // Print selected data
5964
Serial.print(ubxDataStruct.xAccel);
60-
65+
6166
Serial.print(F(" yAccel: "));
6267
Serial.print(ubxDataStruct.yAccel);
63-
68+
6469
Serial.print(F(" zAccel: "));
6570
Serial.print(ubxDataStruct.zAccel);
6671

@@ -76,7 +81,7 @@ void printESFMEASdata(UBX_ESF_MEAS_data_t ubxDataStruct)
7681

7782
Serial.print(F("id: ")); // Print selected data
7883
Serial.print(ubxDataStruct.id);
79-
84+
8085
Serial.print(F(" numMeas: "));
8186
Serial.println(ubxDataStruct.flags.bits.numMeas);
8287

@@ -87,7 +92,7 @@ void printESFMEASdata(UBX_ESF_MEAS_data_t ubxDataStruct)
8792

8893
UBX_ESF_MEAS_sensorData_t sensorData;
8994
myGPS.getSensorFusionMeasurement(&sensorData, ubxDataStruct, num); // Extract the data for one sensor
90-
95+
9196
Serial.print(F(": Type: "));
9297
Serial.print(sensorData.data.bits.dataType);
9398
Serial.print(F(" Data: "));
@@ -102,7 +107,7 @@ void printESFSTATUSdata(UBX_ESF_STATUS_data_t ubxDataStruct)
102107
{
103108
Serial.print(F("fusionMode: ")); // Print selected data
104109
Serial.print(ubxDataStruct.fusionMode);
105-
110+
106111
Serial.print(F(" numSens: "));
107112
Serial.println(ubxDataStruct.numSens);
108113

@@ -113,7 +118,7 @@ void printESFSTATUSdata(UBX_ESF_STATUS_data_t ubxDataStruct)
113118

114119
UBX_ESF_STATUS_sensorStatus_t sensorStatus;
115120
myGPS.getSensorFusionStatus(&sensorStatus, ubxDataStruct, num); // Extract the data for one sensor
116-
121+
117122
Serial.print(F(": Type: "));
118123
Serial.print(sensorStatus.sensStatus1.bits.type);
119124
Serial.print(F(" Used: "));
@@ -145,7 +150,7 @@ void setup()
145150

146151
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
147152
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
148-
153+
149154
myGPS.setNavigationFrequency(1); //Produce one solution per second
150155
myGPS.setHNRNavigationRate(1); //Set the High Navigation Rate to 1Hz
151156

@@ -168,7 +173,7 @@ void loop()
168173
{
169174
myGPS.checkUblox(); // Check for the arrival of new data and process it.
170175
myGPS.checkCallbacks(); // Check if any callbacks are waiting to be processed.
171-
176+
172177
Serial.print(".");
173178
delay(25);
174179
}

examples/Data_Logging/DataLoggingExample1_NAV_PVT/DataLoggingExample1_NAV_PVT.ino

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ File myFile; //File that all GNSS data is written to
5757

5858
// Callback: printPVTdata will be called when new NAV PVT data arrives
5959
// See u-blox_structs.h for the full definition of UBX_NAV_PVT_data_t
60+
// _____ You can use any name you like for the callback. Use the same name when you call setAutoPVTcallback
61+
// / _____ This _must_ be UBX_NAV_PVT_data_t
62+
// | / _____ You can use any name you like for the struct
63+
// | | /
64+
// | | |
6065
void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
6166
{
6267
Serial.println();
@@ -78,7 +83,7 @@ void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
7883
if (millisecs < 100) Serial.print(F("0")); // Print the trailing zeros correctly
7984
if (millisecs < 10) Serial.print(F("0"));
8085
Serial.print(millisecs);
81-
86+
8287
long latitude = ubxDataStruct.lat; // Print the latitude
8388
Serial.print(F(" Lat: "));
8489
Serial.print(latitude);
@@ -87,11 +92,11 @@ void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
8792
Serial.print(F(" Long: "));
8893
Serial.print(longitude);
8994
Serial.print(F(" (degrees * 10^-7)"));
90-
95+
9196
long altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
9297
Serial.print(F(" Height above MSL: "));
9398
Serial.print(altitude);
94-
Serial.println(F(" (mm)"));
99+
Serial.println(F(" (mm)"));
95100
}
96101

97102
void setup()
@@ -119,7 +124,7 @@ void setup()
119124
}
120125

121126
delay(100); // Wait, just in case multiple characters were sent
122-
127+
123128
while (Serial.available()) // Empty the Serial buffer
124129
{
125130
Serial.read();
@@ -165,11 +170,11 @@ void setup()
165170

166171
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
167172
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
168-
173+
169174
myGPS.setNavigationFrequency(1); //Produce one navigation solution per second
170175

171176
myGPS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
172-
177+
173178
myGPS.logNAVPVT(); // Enable NAV PVT data logging
174179

175180
Serial.println(F("Press any key to stop logging."));
@@ -197,7 +202,7 @@ void loop()
197202
Serial.println(F("Logging stopped. Freezing..."));
198203
while(1); // Do nothing more
199204
}
200-
205+
201206
Serial.print(".");
202207
delay(50);
203208
}

0 commit comments

Comments
 (0)