3
3
using a custom command.
4
4
By: @mayopan
5
5
Date: May 9th, 2020
6
+
6
7
Based on:
7
8
Send Custom Command
8
9
By: Paul Clark (PaulZC)
9
10
Date: April 20th, 2020
11
+
10
12
License: MIT. See license file for more information but you can
11
13
basically do whatever you want with this code.
14
+
12
15
Previously it was possible to create and send a custom packet
13
16
through the library but it would always appear to timeout as
14
17
some of the internal functions referred to the internal private
19
22
it had been called from within the library
20
23
- the custom packet will be updated with data returned by the module
21
24
(previously this was not possible from outside the library)
25
+
22
26
Feel like supporting open source hardware?
23
27
Buy a board from SparkFun!
24
28
ZED-F9P RTK2: https://www.sparkfun.com/products/15136
25
29
NEO-M8P RTK: https://www.sparkfun.com/products/15005
26
30
SAM-M8Q: https://www.sparkfun.com/products/15106
31
+
27
32
Hardware Connections:
28
33
Plug a Qwiic cable into the GPS and a BlackBoard
29
34
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
@@ -42,7 +47,7 @@ class SFE_UBLOX_GPS_ADD : public SFE_UBLOX_GPS
42
47
public:
43
48
boolean getModuleInfo (uint16_t maxWait = 1100 ); // Queries module, texts
44
49
45
- struct minfoStructure // Structure to hold the module info (uses 340 bytes of RAM)
50
+ struct minfoStructure // Structure to hold the module info (uses 341 bytes of RAM)
46
51
{
47
52
char swVersion[30 ];
48
53
char hwVersion[10 ];
@@ -134,20 +139,21 @@ boolean SFE_UBLOX_GPS_ADD::getModuleInfo(uint16_t maxWait)
134
139
// Other values indicate errors. Please see the sfe_ublox_status_e enum for further details.
135
140
136
141
// Referring to the u-blox M8 Receiver Description and Protocol Specification we see that
137
- // the navigation rate is configured using the UBX-CFG-RATE message. So let's load our
138
- // custom packet with the correct information so we can read (poll / get) the current settings .
142
+ // the module information can be read using the UBX-MON-VER message. So let's load our
143
+ // custom packet with the correct information so we can read (poll / get) the module information .
139
144
140
145
customCfg.cls = UBX_CLASS_MON; // This is the message Class
141
146
customCfg.id = UBX_MON_VER; // This is the message ID
142
147
customCfg.len = 0 ; // Setting the len (length) to zero let's us poll the current settings
143
148
customCfg.startingSpot = 0 ; // Always set the startingSpot to zero (unless you really know what you are doing)
144
149
145
- // We also need to tell sendCommand how long it should wait for a reply
146
- // uint16_t maxWait = 250; // Wait for up to 250ms (Serial may need a lot longer e.g. 1100)
150
+ // Now let's send the command. The module info is returned in customPayload
147
151
148
152
if (sendCommand (&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED)
149
153
return (false ); // If command send fails then bail
150
154
155
+ // Now let's extract the module info from customPayload
156
+
151
157
uint16_t position = 0 ;
152
158
for (int i = 0 ; i < 30 ; i++)
153
159
{
@@ -173,4 +179,4 @@ boolean SFE_UBLOX_GPS_ADD::getModuleInfo(uint16_t maxWait)
173
179
}
174
180
175
181
return (true ); // Success!
176
- }
182
+ }
0 commit comments