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

Commit 3e2aa74

Browse files
committed
Updated Theory.md
1 parent e724638 commit 3e2aa74

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ 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
--------------
@@ -85,9 +85,9 @@ 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
---------------------------------
9292

9393
* [GPS-15136](https://www.sparkfun.com/products/15136) - SparkFun GPS-RTK2 ZED-F9P
@@ -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-

Theory.md

Lines changed: 8 additions & 3 deletions
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.

examples/Example20_SendCustomCommand/Example20_SendCustomCommand.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void setup()
101101
// Now let's read the current navigation model settings. The results will be loaded into customCfg.
102102
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
103103
{
104-
Serial.println(F("sendCommand (poll) failed! Freezing..."));
104+
Serial.println(F("sendCommand (poll / get) failed! Freezing..."));
105105
while (1)
106106
;
107107
}
@@ -114,7 +114,7 @@ void setup()
114114
Serial.print(customPayload[2]);
115115

116116
// Let's change it
117-
if (customPayload[2] != 0x04) // If it is current not 4, change it to 4
117+
if (customPayload[2] != 0x04) // If it is currently not 4, change it to 4
118118
{
119119
Serial.println(F(". Changing it to 4."));
120120
customPayload[2] = 0x04;

0 commit comments

Comments
 (0)