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

Commit 8e037a5

Browse files
committed
Added the bug fix for setNavigationFrequency
1 parent 3154c95 commit 8e037a5

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

examples/Example20_SendCustomCommand/Example20_SendCustomCommand.ino

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,25 @@ void setup()
150150
Serial.println(F("Dynamic platform model updated."));
151151
}
152152

153+
// Now let's read the navigation model settings again to see if the change was successful.
154+
155+
// We need to reset the packet before we try again as the values could have changed
156+
customCfg.cls = UBX_CLASS_CFG;
157+
customCfg.id = UBX_CFG_NAV5;
158+
customCfg.len = 0;
159+
customCfg.startingSpot = 0;
160+
161+
if (myGPS.sendCustomCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
162+
{
163+
Serial.println(F("sendCustomCommand (poll) failed! Freezing."));
164+
while (1)
165+
;
166+
}
167+
168+
// Print the current dynamic model
169+
Serial.print(F("The new dynamic model is: "));
170+
Serial.println(customPayload[2]);
171+
153172
//myGPS.saveConfigSelective(VAL_CFG_SUBSEC_NAVCONF); //Uncomment this line to save only the NAV settings to flash and BBR
154173
}
155174

src/SparkFun_Ublox_Arduino_Library.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForACKResponse(ubxPacket *outgoingUBX, uin
12461246
}
12471247

12481248
// We can be confident that the data packet (if we are going to get one) will always arrive
1249-
// before the matching ACK. So if we accidentally sent a config packet which only produces an ACK
1249+
// before the matching ACK. So if we sent a config packet which only produces an ACK
12501250
// then outgoingUBX->classAndIDmatch will be NOT_DEFINED and the packetAck.classAndIDmatch will VALID.
12511251
// We should not check outgoingUBX->valid, outgoingUBX->cls or outgoingUBX->id
12521252
// as these may have been changed by a PVT packet.
@@ -1255,7 +1255,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::waitForACKResponse(ubxPacket *outgoingUBX, uin
12551255
{
12561256
if (_printDebug == true)
12571257
{
1258-
_debugSerial->print(F("waitForACKResponse: NO DATA and VALID ACK after "));
1258+
_debugSerial->print(F("waitForACKResponse: no data and valid ACK after "));
12591259
_debugSerial->print(millis() - startTime);
12601260
_debugSerial->println(F(" msec"));
12611261
}
@@ -2117,6 +2117,7 @@ boolean SFE_UBLOX_GPS::setNavigationFrequency(uint8_t navFreq, uint16_t maxWait)
21172117
//payloadCfg is now loaded with current bytes. Change only the ones we need to
21182118
payloadCfg[0] = measurementRate & 0xFF; //measRate LSB
21192119
payloadCfg[1] = measurementRate >> 8; //measRate MSB
2120+
packetCfg.len = 6; // Bug fix!
21202121

21212122
return ((sendCommand(packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
21222123
}

0 commit comments

Comments
 (0)