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

Commit e0c3230

Browse files
committed
Updated so packet pointers are used everywhere from sendCommand down
1 parent b22e812 commit e0c3230

File tree

4 files changed

+83
-138
lines changed

4 files changed

+83
-138
lines changed

examples/Example20_SendCustomCommand/Example20_SendCustomCommand.ino

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
sendCustomCommand
2+
Send Custom Command
33
By: Paul Clark (PaulZC)
44
Date: April 18th, 2020
55
@@ -13,12 +13,12 @@
1313
through the library but it would always appear to timeout as
1414
some of the internal functions referred to the internal private
1515
struct packetCfg.
16-
The most recent version of the library allows sendCustomCommand to
16+
The most recent version of the library allows sendCommand to
1717
use a custom packet as if it were packetCfg and so:
18-
- sendCustomCommand will return a sfe_ublox_status_e enum as if
19-
sendCommand had been called from within the library
18+
- sendCommand will return a sfe_ublox_status_e enum as if
19+
it had been called from within the library
2020
- the custom packet will be updated with data returned by the module
21-
(previously this was not possible)
21+
(previously this was not possible from outside the library)
2222
2323
Feel like supporting open source hardware?
2424
Buy a board from SparkFun!
@@ -81,7 +81,7 @@ void setup()
8181
// sfe_ublox_packet_validity_e valid : Goes from NOT_DEFINED to VALID or NOT_VALID when checksum is checked
8282
// sfe_ublox_packet_validity_e classAndIDmatch : Goes from NOT_DEFINED to VALID or NOT_VALID when the Class and ID match the requestedClass and requestedID
8383

84-
// sendCustomCommand will return:
84+
// sendCommand will return:
8585
// SFE_UBLOX_STATUS_DATA_RECEIVED if the data we requested was read / polled successfully
8686
// SFE_UBLOX_STATUS_DATA_SENT if the data we sent was writted successfully (ACK'd)
8787
// Other values indicate errors. Please see the sfe_ublox_status_e enum for further details.
@@ -96,21 +96,21 @@ void setup()
9696
customCfg.len = 0; // Setting the len (length) to zero let's us poll the current settings
9797
customCfg.startingSpot = 0; // Always set the startingSpot to zero (unless you really know what you are doing)
9898

99-
// We also need to tell sendCustomCommand how long it should wait for a reply
99+
// We also need to tell sendCommand how long it should wait for a reply
100100
uint16_t maxWait = 250; // Wait for up to 250ms (Serial may need a lot longer e.g. 1100)
101101

102102
// Now let's read the current navigation model settings. The results will be loaded into customCfg.
103-
if (myGPS.sendCustomCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
103+
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
104104
{
105-
Serial.println(F("sendCustomCommand (poll) failed! Trying again..."));
105+
Serial.println(F("sendCommand (poll) failed! Trying again..."));
106106
// We need to reset the packet before we try again as the values could have changed
107107
customCfg.cls = UBX_CLASS_CFG;
108108
customCfg.id = UBX_CFG_NAV5;
109109
customCfg.len = 0;
110110
customCfg.startingSpot = 0;
111-
if (myGPS.sendCustomCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
111+
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
112112
{
113-
Serial.println(F("sendCustomCommand (poll) failed again! Freezing."));
113+
Serial.println(F("sendCommand (poll) failed again! Freezing."));
114114
while (1)
115115
;
116116
}
@@ -136,12 +136,12 @@ void setup()
136136
}
137137

138138
// We don't need to update customCfg.len as it will have been set to 36 (0x24)
139-
// when sendCustomCommand read the data
139+
// when sendCommand read the data
140140

141141
// Now we write the custom packet back again to change the setting
142-
if (myGPS.sendCustomCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_SENT) // This time we are only expecting an ACK
142+
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_SENT) // This time we are only expecting an ACK
143143
{
144-
Serial.println(F("sendCustomCommand (set) failed! Freezing."));
144+
Serial.println(F("sendCommand (set) failed! Freezing."));
145145
while (1)
146146
;
147147
}
@@ -158,9 +158,9 @@ void setup()
158158
customCfg.len = 0;
159159
customCfg.startingSpot = 0;
160160

161-
if (myGPS.sendCustomCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
161+
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
162162
{
163-
Serial.println(F("sendCustomCommand (poll) failed! Freezing."));
163+
Serial.println(F("sendCommand (poll) failed! Freezing."));
164164
while (1)
165165
;
166166
}

keywords.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ processNMEA KEYWORD2
2727

2828
calcChecksum KEYWORD2
2929
sendCommand KEYWORD2
30-
sendCustomCommand KEYWORD2
3130
printPacket KEYWORD2
3231
setI2CAddress KEYWORD2
3332
setSerialRate KEYWORD2

0 commit comments

Comments
 (0)