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

Commit 9fc9c03

Browse files
authored
Merge pull request #155 from sparkfun/release_candidate
Merging release_candidate: updates for v1.8.8
2 parents 97bd455 + 0d34d12 commit 9fc9c03

25 files changed

+6158
-588
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ Temporary Items
5353
*~
5454
[._]*.un~
5555
*.swp
56+
57+
# Zephyr build files
58+
examples/Zephyr/*/build/*

Diff for: CONTRIBUTING.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
### How to Contribute
1+
# How to Contribute
22

33
Thank you so *much* for offering to help out. We truly appreciate it.
44

55
If you'd like to contribute, start by searching through the [issues](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/issues) and [pull requests](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/pulls) to see whether someone else has raised a similar idea or question.
6+
Please check the [closed issues](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/issues?q=is%3Aissue+is%3Aclosed)
7+
and [closed pull requests](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/pulls?q=is%3Apr+is%3Aclosed) too - you may find that your issue or feature has already been discussed.
68

79
If you decide to add a feature to this library, please create a PR and follow these best practices:
810

9-
* Change as little as possible. Do not sumbit a PR that changes 100 lines of whitespace. Break up into multiple PRs if necessary.
11+
* Change as little as possible. Do not submit a PR that changes 100 lines of whitespace. Break up into multiple PRs if necessary.
1012
* If you've added a new feature document it with a simple example sketch. This serves both as a test of your PR and as a quick way for users to quickly learn how to use your new feature.
11-
* If you add new functions also add them to keywords.txt so that they are properly highlighted in Arduino. [Read more](https://www.arduino.cc/en/Hacking/libraryTutorial).
13+
* If you add new functions also add them to _keywords.txt_ so that they are properly highlighted in Arduino. [Read more](https://www.arduino.cc/en/Hacking/libraryTutorial).
14+
* **Important:** Please submit your PR using the [release_candidate branch](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/tree/release_candidate). That way, we can merge and test your PR quickly without changing the _master_ branch
15+
16+
![Contributing.JPG](./img/Contributing.JPG)
1217

1318
## Style guide
1419

Diff for: README.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,32 @@ Thanks to:
4848
* [averywallis](https://github.com/averywallis) for adding good comments to the various constants.
4949
* [blazczak](https://github.com/blazczak) and [geeksville](https://github.com/geeksville) for adding support for the series 6 and 7 modules.
5050
* [bjorn@unsurv](https://github.com/unsurv) for adding powerOff and powerOffWithInterrupt.
51+
* [dotMorten](https://github.com/dotMorten) for the MSGOUT keys, autoHPPOSLLH, autoDOP and upgrades to autoPVT.
52+
* [markuckermann](https://github.com/markuckermann) for spotting the config layer gremlins
53+
* [vid553](https://github.com/vid553) for the Zephyr port
54+
* [balamuruganky](https://github.com/balamuruganky) for the NAV-PVT velocity parameters
55+
* [nelarsen](https://github.com/nelarsen) for the buffer overrun improvements
56+
* [mstranne](https://github.com/mstranne) and [shaneperera](https://github.com/shaneperera) for the pushRawData suggestion
57+
* [rubienr](https://github.com/rubienr) for spotting the logical AND issues
5158

5259
Need a Python version for Raspberry Pi? Checkout the [Qwiic Ublox GPS Py module](https://github.com/sparkfun/Qwiic_Ublox_Gps_Py).
5360

5461
Need a library for the Ublox and Particle? Checkout the [Particle library](https://github.com/aseelye/SparkFun_Ublox_Particle_Library) fork.
5562

63+
Contributing
64+
--------------
65+
66+
If you would like to contribute to this library: please do, we truly appreciate it, but please follow [these guidelines](./CONTRIBUTING.md). Thanks!
67+
5668
Repository Contents
5769
-------------------
5870

5971
* **/examples** - Example sketches for the library (.ino). Run these from the Arduino IDE.
6072
* **/src** - Source files for the library (.cpp, .h).
61-
* **keywords.txt** - Keywords from this library that will be highlighted in the Arduino IDE.
62-
* **library.properties** - General library properties for the Arduino package manager.
73+
* **[keywords.txt](./keywords.txt)** - Keywords from this library that will be highlighted in the Arduino IDE.
74+
* **[library.properties](./library.properties)** - General library properties for the Arduino package manager.
75+
* **[CONTRIBUTING.md](./CONTRIBUTING.md)** - Guidelines on how to contribute to this library.
76+
* **[Theory.md](./Theory.md)** - provides detail on how data is processed by the library.
6377

6478
Documentation
6579
--------------

Diff for: Theory.md

+10-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,21 @@ 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 **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()**.
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 **AutoPVT** response. We cannot tell **checkUbloxI2C()** to stop once a given ACK is found because we run the risk of leaving unprocessed 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 a value from the **sfe_ublox_status_e** enum 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

2828
If we are getting / polling data from the module, **sendCommand()** will return **SFE_UBLOX_STATUS_DATA_RECEIVED** if the get was successful.
2929

3030
If we are setting / writing data to the module, **sendCommand()** will return **SFE_UBLOX_STATUS_DATA_SENT** if the set was successful.
3131

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.
32+
We are proud that this library still compiles and runs on the original RedBoard (ATmega328P). We achieve that by being very careful about how much RAM we allocate to packet storage. We use only three buffers or containers to store the incoming data:
33+
- **packetBuf** (packetBuffer) - is small and is used to store only the head (and tail) of incoming UBX packets until we know they are. If the packet is _expected_ (i.e. it matches the Class and ID in the packet passed in **sendCommand()**) then the incoming bytes are diverted into **packetCfg** or **packetAck**. Unexpected packets are ignored.
34+
- **packetCfg** (packetConfiguration) - is used to store an _expected_ incoming UBX packet of up to 256 bytes. E.g. **getProtocolVersion()** returns about 220 bytes. Message data requested by a higher function is returned in packetCfg.
35+
- **packetAck** (packetAcknowledge) - is small and is used to store the ACK or NACK accompanying any _expected_ packetCfg.
36+
37+
**AutoPVT**, **AutoHPPOSLLH** and **AutoDOP** packets can arrive at any time. They too _have_ to be stored and processed in **packetCfg**. This means there are circumstances where the library can get the data it is expecting from the module, but it is overwritten (e.g. by an **AutoPVT** 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.
38+
39+
Need a command that is not currently "built-in" to the library? You can do that using a Custom Command. Check out [Example20_SendCustomCommand](https://github.com/sparkfun/SparkFun_Ublox_Arduino_Library/blob/master/examples/Example20_SendCustomCommand/Example20_SendCustomCommand.ino) for further details. Note: this will of course increase your RAM use.

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

+26-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,32 @@ void loop()
7878
int PDOP = myGPS.getPDOP();
7979
Serial.print(F(" PDOP: "));
8080
Serial.print(PDOP);
81-
Serial.print(F(" (10^-2)"));
81+
Serial.print(F(" (10^-2)"));
82+
83+
int nedNorthVel = myGPS.getNedNorthVel();
84+
Serial.print(F(" VelN: "));
85+
Serial.print(nedNorthVel);
86+
Serial.print(F(" (mm/s)"));
87+
88+
int nedEastVel = myGPS.getNedEastVel();
89+
Serial.print(F(" VelE: "));
90+
Serial.print(nedEastVel);
91+
Serial.print(F(" (mm/s)"));
92+
93+
int nedDownVel = myGPS.getNedDownVel();
94+
Serial.print(F(" VelD: "));
95+
Serial.print(nedDownVel);
96+
Serial.print(F(" (mm/s)"));
97+
98+
int verticalAccEst = myGPS.getVerticalAccEst();
99+
Serial.print(F(" VAccEst: "));
100+
Serial.print(verticalAccEst);
101+
Serial.print(F(" (mm)"));
102+
103+
int horizontalAccEst = myGPS.getHorizontalAccEst();
104+
Serial.print(F(" HAccEst: "));
105+
Serial.print(horizontalAccEst);
106+
Serial.print(F(" (mm)"));
82107

83108
Serial.println();
84109
} else {

Diff for: examples/Series_6_7/Example1_GetPositionAndTime_Series_6_7/SparkFun_Ublox_Arduino_Library_Series_6_7.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,9 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
899899
switch (msg->cls)
900900
{
901901
case UBX_CLASS_NAV:
902-
if (msg->id == UBX_NAV_PVT && msg->len == 92)
902+
//u-blox8 length == 92
903+
//u-blox7 length == 84
904+
if ((msg->id == UBX_NAV_PVT) && ((msg->len == 92) || (msg->len == 84)))
903905
{
904906
//Parse various byte fields into global vars
905907
constexpr int startingSpot = 0; //fixed value used in processUBX
@@ -915,6 +917,7 @@ void SFE_UBLOX_GPS::processUBXpacket(ubxPacket *msg)
915917
gpsNanosecond = extractLong(16); //Includes milliseconds
916918

917919
fixType = extractByte(20 - startingSpot);
920+
//Note: the u-blox7 does not support carrSoln. carrierSolution will be zero.
918921
carrierSolution = extractByte(21 - startingSpot) >> 6; //Get 6th&7th bits of this byte
919922
SIV = extractByte(23 - startingSpot);
920923
longitude = extractLong(24 - startingSpot);

Diff for: examples/ZED-F9P/Example11_autoHPPOSLLH/Example11_autoHPPOSLLH.ino renamed to examples/ZED-F9P/Example13_autoHPPOSLLH/Example13_autoHPPOSLLH.ino

+13-12
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ void setup()
4343
Wire.begin();
4444

4545
//myGPS.enableDebugging(); // Uncomment this line to enable lots of helpful debug messages
46+
//myGPS.enableDebugging(Serial, true); // Uncomment this line to enable the minimum of helpful debug messages
4647

4748
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
4849
{
@@ -55,21 +56,21 @@ void setup()
5556

5657
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
5758
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
58-
59+
5960
myGPS.setNavigationFrequency(1); //Produce one solution per second
60-
61+
6162

6263
// The acid test: all four of these combinations should work seamlessly :-)
63-
64+
6465
//myGPS.setAutoPVT(false); // Library will poll each reading
6566
//myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
66-
67+
6768
//myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
6869
//myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
6970

7071
//myGPS.setAutoPVT(false); // Library will poll each reading
7172
//myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
72-
73+
7374
myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
7475
myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
7576
}
@@ -81,31 +82,31 @@ void loop()
8182
if ((myGPS.getHPPOSLLH()) || (myGPS.getPVT()))
8283
{
8384
Serial.println();
84-
85+
8586
long highResLatitude = myGPS.getHighResLatitude();
8687
Serial.print(F("Hi Res Lat: "));
8788
Serial.print(highResLatitude);
88-
89+
8990
int highResLatitudeHp = myGPS.getHighResLatitudeHp();
9091
Serial.print(F(" "));
9192
Serial.print(highResLatitudeHp);
92-
93+
9394
long highResLongitude = myGPS.getHighResLongitude();
9495
Serial.print(F(" Hi Res Long: "));
9596
Serial.print(highResLongitude);
96-
97+
9798
int highResLongitudeHp = myGPS.getHighResLongitudeHp();
9899
Serial.print(F(" "));
99100
Serial.print(highResLongitudeHp);
100-
101+
101102
unsigned long horizAccuracy = myGPS.getHorizontalAccuracy();
102103
Serial.print(F(" Horiz accuracy: "));
103104
Serial.print(horizAccuracy);
104-
105+
105106
long latitude = myGPS.getLatitude();
106107
Serial.print(F(" Lat: "));
107108
Serial.print(latitude);
108-
109+
109110
long longitude = myGPS.getLongitude();
110111
Serial.print(F(" Long: "));
111112
Serial.println(longitude);

Diff for: examples/ZED-F9P/Example3_StartRTCMBase/Example3_StartRTCMBase.ino

+17-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@
2929
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
3030
SFE_UBLOX_GPS myGPS;
3131

32+
//#define USE_SERIAL1 // Uncomment this line to push the RTCM data to Serial1
33+
3234
void setup()
3335
{
3436
Serial.begin(115200);
3537
while (!Serial); //Wait for user to open terminal
3638
Serial.println("Ublox Base station example");
3739

40+
#ifdef USE_SERIAL1
41+
// If our board supports it, we can output the RTCM data on Serial1
42+
Serial1.begin(115200);
43+
#endif
44+
3845
Wire.begin();
3946
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
4047

@@ -44,8 +51,11 @@ void setup()
4451
while (1);
4552
}
4653

54+
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
55+
//myGPS.factoryDefault(); delay(5000);
56+
4757
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
48-
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
58+
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
4959

5060
while (Serial.available()) Serial.read(); //Clear any latent chars in serial buffer
5161
Serial.println("Press any key to send commands to begin Survey-In");
@@ -153,7 +163,12 @@ void loop()
153163
//Useful for passing the RTCM correction data to a radio, Ntrip broadcaster, etc.
154164
void SFE_UBLOX_GPS::processRTCM(uint8_t incoming)
155165
{
156-
//Let's just pretty-print the HEX values for now
166+
#ifdef USE_SERIAL1
167+
//Push the RTCM data to Serial1
168+
Serial1.write(incoming);
169+
#endif
170+
171+
//Pretty-print the HEX values to Serial
157172
if (myGPS.rtcmFrameCounter % 16 == 0) Serial.println();
158173
Serial.print(" ");
159174
if (incoming < 0x10) Serial.print("0");

Diff for: examples/ZED-F9P/Example5_RelativePositioningInformation/Example5_RelativePositioningInformation.ino

+37-1
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,21 @@
2626
#include "SparkFun_Ublox_Arduino_Library.h" //http://librarymanager/All#SparkFun_Ublox_GPS
2727
SFE_UBLOX_GPS myGPS;
2828

29+
//#define USE_SERIAL1 // Uncomment this line to push the RTCM data from Serial1 to the module via I2C
30+
31+
size_t numBytes = 0; // Record the number os bytes received from Serial1
32+
2933
void setup()
3034
{
3135
Serial.begin(115200);
3236
while (!Serial); //Wait for user to open terminal
3337
Serial.println("Ublox Base station example");
3438

39+
#ifdef USE_SERIAL1
40+
// If our board supports it, we can receive the RTCM data on Serial1
41+
Serial1.begin(115200);
42+
#endif
43+
3544
Wire.begin();
3645
Wire.setClock(400000); //Increase I2C clock speed to 400kHz
3746

@@ -40,6 +49,15 @@ void setup()
4049
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
4150
while (1);
4251
}
52+
53+
// Uncomment the next line if you want to reset your module back to the default settings with 1Hz navigation rate
54+
//myGPS.factoryDefault(); delay(5000);
55+
56+
#ifdef USE_SERIAL1
57+
Serial.print(F("Enabling UBX and RTCM input on I2C. Result: "));
58+
Serial.print(myGPS.setPortInput(COM_PORT_I2C, COM_TYPE_UBX | COM_TYPE_RTCM3)); //Enable UBX and RTCM input on I2C
59+
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save the communications port settings to flash and BBR
60+
#endif
4361
}
4462

4563
void loop()
@@ -121,5 +139,23 @@ void loop()
121139
else
122140
Serial.println("RELPOS request failed");
123141

124-
delay(4000);
142+
for (int i = 0; i < 500; i++)
143+
{
144+
#ifdef USE_SERIAL1
145+
uint8_t store[256];
146+
while ((Serial1.available()) && (numBytes < 256)) // Check if data has been received
147+
{
148+
store[numBytes++] = Serial1.read(); // Read a byte from Serial1 and store it
149+
}
150+
if (numBytes > 0) // Check if data was received
151+
{
152+
//Serial.print("Pushing ");
153+
//Serial.print(numBytes);
154+
//Serial.println(" bytes via I2C");
155+
myGPS.pushRawData(((uint8_t *)&store), numBytes); // Push the RTCM data via I2C
156+
numBytes = 0; // Reset numBytes
157+
}
158+
#endif
159+
delay(10);
160+
}
125161
}

0 commit comments

Comments
 (0)