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

Commit c009e9e

Browse files
committed
Merge branch 'master' into dead_reckoning
2 parents 5b20675 + 3f5422d commit c009e9e

File tree

15 files changed

+1374
-513
lines changed

15 files changed

+1374
-513
lines changed

Diff for: README.md

+8-9
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ Need a library for the Ublox and Particle? Checkout the [Particle library](https
4444
Repository Contents
4545
-------------------
4646

47-
* **/examples** - Example sketches for the library (.ino). Run these from the Arduino IDE.
47+
* **/examples** - Example sketches for the library (.ino). Run these from the Arduino IDE.
4848
* **/src** - Source files for the library (.cpp, .h).
49-
* **keywords.txt** - Keywords from this library that will be highlighted in the Arduino IDE.
50-
* **library.properties** - General library properties for the Arduino package manager.
49+
* **keywords.txt** - Keywords from this library that will be highlighted in the Arduino IDE.
50+
* **library.properties** - General library properties for the Arduino package manager.
5151

5252
Documentation
5353
--------------
5454

5555
* **[Installing an Arduino Library Guide](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)** - Basic information on how to install an Arduino library.
5656

57-
Polling vs. auto-reporting
57+
Polling vs. Auto-Reporting
5858
--------------------------
5959

6060
This library supports two modes of operation for getting navigation information with the `getPVT`
@@ -85,11 +85,11 @@ As an example, assume that the GPS is set to produce 5 navigation
8585
solutions per second and that the sketch only calls getPVT once a second, then the GPS will queue 5
8686
packets in its internal buffer (about 500 bytes) and the library will read those when getPVT is
8787
called, update its internal copy of the nav data 5 times, and return `true` to the sketch. The
88-
skecth calls `getLatitude`, etc. and retrieve the data of the most recent of those 5 packets.
88+
sketch calls `getLatitude`, etc. and retrieve the data of the most recent of those 5 packets.
8989

90-
Products That Use This Library
90+
Products That Use This Library
9191
---------------------------------
92-
92+
* [GPS-16481](https://www.sparkfun.com/products/16481) - SparkFun GPS-RTK-SMA ZED-F9P
9393
* [GPS-15136](https://www.sparkfun.com/products/15136) - SparkFun GPS-RTK2 ZED-F9P
9494
* [GPS-15005](https://www.sparkfun.com/products/15005) - SparkFun GPS-RTK NEO-M8P-2
9595
* [GPS-15210](https://www.sparkfun.com/products/15210) - SparkFun GPS Breakout - Chip Antenna, SAM-M8Q (Qwiic)
@@ -102,7 +102,7 @@ Products That Use This Library
102102
License Information
103103
-------------------
104104

105-
This product is _**open source**_!
105+
This product is _**open source**_!
106106

107107
Various bits of the code have different licenses applied. Anything SparkFun wrote is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round!
108108

@@ -111,4 +111,3 @@ Please use, reuse, and modify these files as you see fit. Please maintain attrib
111111
Distributed as-is; no warranty is given.
112112

113113
- Your friends at SparkFun.
114-

Diff for: Theory.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
How I2C (aka DDC) communication works with a uBlox module
22
===========================================================
33

4-
When the user calls one of the methods the library will poll the Ublox module for new data.
4+
When the user calls one of the methods the library will poll the Ublox module for new data.
55

66
* Wait for a minimum of 25 ms between polls (configured dynamically when update rate is set)
77
* Write 0xFD to module
@@ -19,9 +19,14 @@ A method will call **sendCommand()**. This will begin waiting for a response wit
1919

2020
Once **waitForACKResponse()** or **waitForNoACKResponse()** is called the library will start checking the ublox module for new bytes. These bytes may be part of a NMEA sentence, an RTCM sentence, or a UBX packet. The library will file each byte into the appropriate container. Once a given sentence or packet is complete, the appropriate processUBX(), processNMEA() will be called. These functions deal with specific processing for each type.
2121

22-
Note: When interfacing to a ublox module over I2C the **checkUbloxI2C()** will read all bytes currently sitting in the I2C buffer. This may pick up multiple UBX packets. For example, an ACK for a VALSET may be mixed in with an auto-PVT response. We cannot tell **checkUbloxI2C()** to stop once a give ACK is found because we run the risk of leaving bytes in the I2C buffer and loosing them. We don't have this issue with **checkUbloxSerial()**.
22+
Note: When interfacing to a ublox module over I2C **checkUbloxI2C()** will read all bytes currently sitting in the I2C buffer. This may pick up multiple UBX packets. For example, an ACK for a VALSET may be mixed in with an auto-PVT response. We cannot tell **checkUbloxI2C()** to stop once a given ACK is found because we run the risk of leaving bytes in the I2C buffer and losing them. We don't have this issue with **checkUbloxSerial()**.
2323

2424
**processUBX()** will check the CRC of the UBX packet. If validated, the packet will be marked as valid. Once a packet is marked as valid then **processUBXpacket()** is called to extract the contents. This is most commonly used to get the position, velocity, and time (PVT) out of the packet but is also used to check the nature of an ACK packet.
2525

26-
Once a packet has been processed, **waitForACKResponse()/waitForNoACKResponse()** makes the appropriate decision what to do with it. If a packet satisfies the CLS/ID and characteristics of what **waitForACKResponse()/waitForNoACKResponse()** is waiting for, then it returns back to sendCommand. If the packet didn't match or was invalid then **waitForACKResponse()/waitForNoACKResponse()** will continue to wait until the correct packet is received or we time out. **sendCommand()** then returns with true/false depending on the success of **waitForACKResponse()/waitForNoACKResponse()**.
26+
Once a packet has been processed, **waitForACKResponse()/waitForNoACKResponse()** makes the appropriate decision what to do with it. If a packet satisfies the CLS/ID and characteristics of what **waitForACKResponse()/waitForNoACKResponse()** is waiting for, then it returns back to sendCommand. If the packet didn't match or was invalid then **waitForACKResponse()/waitForNoACKResponse()** will continue to wait until the correct packet is received or we time out. **sendCommand()** then returns with a value from the **sfe_ublox_status_e** enum depending on the success of **waitForACKResponse()/waitForNoACKResponse()**.
2727

28+
If we are getting / polling data from the module, **sendCommand()** will return **SFE_UBLOX_STATUS_DATA_RECEIVED** if the get was successful.
29+
30+
If we are setting / writing data to the module, **sendCommand()** will return **SFE_UBLOX_STATUS_DATA_SENT** if the set was successful.
31+
32+
There are circumstances where the library can get the data it is expecting from the module, but it is overwritten (e.g. by an auto-PVT packet) before **sendCommand()** is able to return. In this case, **sendCommand()** will return the error **SFE_UBLOX_STATUS_DATA_OVERWRITTEN**. We should simply call the library function again, but we will need to reset the packet contents first as they will indeed have been overwritten as the error implies.

Diff for: examples/Example13_PVT/Example1_AutoPVT/Example1_AutoPVT.ino

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ void loop()
7575
Serial.print(F(" SIV: "));
7676
Serial.print(SIV);
7777

78+
int PDOP = myGPS.getPDOP();
79+
Serial.print(F(" PDOP: "));
80+
Serial.print(PDOP);
81+
Serial.print(F(" (m * 10^-2)"));
82+
7883
Serial.println();
7984
} else {
8085
Serial.print(".");

Diff for: examples/Example17_Geofence/Example17_Geofence.ino

+13-12
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void setup()
5050
Serial.println();
5151

5252
delay(1000); // Let the GPS power up
53-
53+
5454
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
5555
{
5656
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
@@ -64,7 +64,7 @@ void setup()
6464

6565
byte fixType = 0;
6666

67-
while (fixType != 3)
67+
while (fixType < 3)
6868
{
6969
fixType = myGPS.getFixType(); // Get the fix type
7070
Serial.print(F("Fix: ")); // Print it
@@ -74,6 +74,7 @@ void setup()
7474
else if(fixType == 2) Serial.print(F(" = 2D"));
7575
else if(fixType == 3) Serial.print(F(" = 3D"));
7676
else if(fixType == 4) Serial.print(F(" = GNSS + Dead reckoning"));
77+
else if(fixType == 5) Serial.print(F(" = Time only"));
7778
Serial.println();
7879
delay(1000);
7980
}
@@ -89,7 +90,7 @@ void setup()
8990
Serial.println(longitude);
9091

9192
uint32_t radius = 500; // Set the radius to 5m (radius is in m * 10^-2 i.e. cm)
92-
93+
9394
byte confidence = 2; // Set the confidence level: 0=none, 1=68%, 2=95%, 3=99.7%, 4=99.99%
9495

9596
// Call clearGeofences() to clear all existing geofences.
@@ -99,18 +100,18 @@ void setup()
99100
// It is possible to define up to four geofences.
100101
// Call addGeofence up to four times to define them.
101102
Serial.println(F("Setting the geofences:"));
102-
103+
103104
Serial.print(F("addGeofence for geofence 1 returned: "));
104105
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
105-
106+
106107
radius = 1000; // 10m
107108
Serial.print(F("addGeofence for geofence 2 returned: "));
108109
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
109-
110+
110111
radius = 1500; // 15m
111112
Serial.print(F("addGeofence for geofence 3 returned: "));
112113
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
113-
114+
114115
radius = 2000; // 20m
115116
Serial.print(F("addGeofence for geofence 4 returned: "));
116117
Serial.println(myGPS.addGeofence(latitude, longitude, radius, confidence));
@@ -130,16 +131,16 @@ void loop()
130131
Serial.println(F(".")); // Tidy up
131132
return; // and go round the loop again
132133
}
133-
134+
134135
Serial.print(F(". status is: ")); // Print the status
135136
Serial.print(currentGeofenceState.status);
136-
137+
137138
Serial.print(F(". numFences is: ")); // Print the numFences
138139
Serial.print(currentGeofenceState.numFences);
139-
140+
140141
Serial.print(F(". combState is: ")); // Print the combined state
141142
Serial.print(currentGeofenceState.combState);
142-
143+
143144
if (currentGeofenceState.combState == 0)
144145
{
145146
Serial.print(F(" = Unknown"));
@@ -163,6 +164,6 @@ void loop()
163164
Serial.print(currentGeofenceState.states[i]);
164165
}
165166
Serial.println();
166-
167+
167168
delay(1000);
168169
}

Diff for: examples/Example18_PowerSaveMode/Example18_PowerSaveMode.ino

+31-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Power Save Mode
33
By: Paul Clark (PaulZC)
4-
Date: December 18th, 2019
4+
Date: April 22nd, 2020
55
66
Based extensively on Example3_GetPosition
77
By: Nathan Seidle
@@ -82,7 +82,7 @@ void loop()
8282
// Put the GNSS into power save mode
8383
// (If you want to disable power save mode, call myGPS.powerSaveMode(false) instead)
8484
// This will fail on the ZED (protocol version >= 27) as UBX-CFG-RXM is not supported
85-
if (myGPS.powerSaveMode())
85+
if (myGPS.powerSaveMode()) // Defaults to true
8686
Serial.println(F("Power Save Mode enabled."));
8787
else
8888
Serial.println(F("***!!! Power Save Mode FAILED !!!***"));
@@ -95,6 +95,34 @@ void loop()
9595
else
9696
Serial.println(F("***!!! Power Save Disable FAILED !!!***"));
9797
}
98+
99+
// Read and print the new low power mode
100+
uint8_t lowPowerMode = myGPS.getPowerSaveMode();
101+
if (lowPowerMode == 255)
102+
{
103+
Serial.println(F("***!!! getPowerSaveMode FAILED !!!***"));
104+
}
105+
else
106+
{
107+
Serial.print(F("The low power mode is: "));
108+
Serial.print(lowPowerMode);
109+
if (lowPowerMode == 0)
110+
{
111+
Serial.println(F(" (Continuous)"));
112+
}
113+
else if (lowPowerMode == 1)
114+
{
115+
Serial.println(F(" (Power Save)"));
116+
}
117+
else if (lowPowerMode == 4)
118+
{
119+
Serial.println(F(" (Continuous)"));
120+
}
121+
else
122+
{
123+
Serial.println(F(" (Unknown!)"));
124+
}
125+
}
98126
}
99127

100128
//Query module every 10 seconds so it is easier to monitor the current draw
@@ -132,4 +160,4 @@ void loop()
132160

133161
Serial.println();
134162
}
135-
}
163+
}

Diff for: examples/Example19_DynamicModel/Example19_DynamicModel.ino

+20-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
Set Dynamic Model
33
By: Paul Clark (PaulZC)
4-
Date: March 9th, 2020
5-
4+
Date: April 22nd, 2020
5+
66
Based extensively on Example3_GetPosition
77
By: Nathan Seidle
88
SparkFun Electronics
@@ -18,7 +18,7 @@
1818
SEA, AIRBORNE1g, AIRBORNE2g, AIRBORNE4g, WRIST, BIKE
1919
2020
Note: Long/lat are large numbers because they are * 10^7. To convert lat/long
21-
to something google maps understands simply divide the numbers by 10,000,000. We
21+
to something google maps understands simply divide the numbers by 10,000,000. We
2222
do this so that we don't have to use floating point numbers.
2323
2424
Leave NMEA parsing behind. Now you can simply ask the module for the datums you want!
@@ -47,18 +47,19 @@ void setup()
4747
Serial.begin(115200);
4848
while (!Serial)
4949
; //Wait for user to open terminal
50-
Serial.println("SparkFun Ublox Example");
50+
Serial.println(F("SparkFun Ublox Example"));
5151

5252
Wire.begin();
5353

54+
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
55+
5456
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
5557
{
5658
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
5759
while (1)
5860
;
5961
}
6062

61-
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages
6263
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
6364

6465
// If we are going to change the dynamic platform model, let's do it here.
@@ -67,11 +68,23 @@ void setup()
6768

6869
if (myGPS.setDynamicModel(DYN_MODEL_PORTABLE) == false) // Set the dynamic model to PORTABLE
6970
{
70-
Serial.println("***!!! Warning: setDynamicModel failed !!!***");
71+
Serial.println(F("***!!! Warning: setDynamicModel failed !!!***"));
72+
}
73+
else
74+
{
75+
Serial.println(F("Dynamic platform model changed successfully!"));
76+
}
77+
78+
// Let's read the new dynamic model to see if it worked
79+
uint8_t newDynamicModel = myGPS.getDynamicModel();
80+
if (newDynamicModel == 255)
81+
{
82+
Serial.println(F("***!!! Warning: getDynamicModel failed !!!***"));
7183
}
7284
else
7385
{
74-
Serial.println("Dynamic platform model changed successfully!");
86+
Serial.print(F("The new dynamic model is: "));
87+
Serial.println(newDynamicModel);
7588
}
7689

7790
//myGPS.saveConfigSelective(VAL_CFG_SUBSEC_NAVCONF); //Uncomment this line to save only the NAV settings to flash and BBR

0 commit comments

Comments
 (0)