Skip to content

Commit 2bc69fb

Browse files
committed
Add 2nd try if failure (because u-center does)
1 parent 058f904 commit 2bc69fb

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ addCfgValset32 KEYWORD2
164164
sendCfgValset8 KEYWORD2
165165
sendCfgValset16 KEYWORD2
166166
sendCfgValset32 KEYWORD2
167+
downloadDeviceConfig KEYWORD2
167168

168169
getNAVPOSECEF KEYWORD2
169170
setAutoNAVPOSECEF KEYWORD2

src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5219,26 +5219,41 @@ uint8_t SFE_UBLOX_GNSS::sendCfgValset8(uint32_t key, uint8_t value, uint16_t max
52195219
//Layer number can be 0 (RAM) or layer 7 (Default)
52205220
void SFE_UBLOX_GNSS::downloadDeviceConfig(Stream &downloadPort, uint8_t layerNumber, uint16_t maxWait)
52215221
{
5222-
for (int x = 0 ; x < 18 ; x++)
5222+
for (int x = 0; x < 18; x++)
52235223
{
5224-
getVal(0x0FFF0000, layerNumber, x * 64, maxWait); //Advance by 64 keys each time
5224+
//KeyID of 0x0FFF0000 is magic config read key. Found using u-center and downloading Receiver Configuration from Tools menu.
5225+
//Advance by 64 keys each time
5226+
if (getVal(0x0FFF0000, layerNumber, x * 64, maxWait) != SFE_UBLOX_STATUS_SUCCESS)
5227+
{
5228+
//Try again
5229+
if (getVal(0x0FFF0000, layerNumber, x * 64, maxWait) != SFE_UBLOX_STATUS_SUCCESS)
5230+
{
5231+
if (_printDebug == true)
5232+
{
5233+
_debugSerial->println(F("downloadDeviceConfig: Failed to obtain config data."));
5234+
}
5235+
}
5236+
}
52255237

52265238
//All lines start with a VALGET
52275239
downloadPort.print(F("CFG-VALGET - 06 8B "));
52285240

52295241
//Pretty print the response length
52305242
uint16_t responseLength = packetCfg.len;
5231-
if ((responseLength & 0xFF) < 0x10) downloadPort.print(F("0"));
5243+
if ((responseLength & 0xFF) < 0x10)
5244+
downloadPort.print(F("0"));
52325245
downloadPort.print(responseLength & 0xFF, HEX);
52335246
downloadPort.print(F(" "));
5234-
if ((responseLength >> 8) < 0x10) downloadPort.print(F("0"));
5247+
if ((responseLength >> 8) < 0x10)
5248+
downloadPort.print(F("0"));
52355249
downloadPort.print(responseLength >> 8, HEX);
52365250

52375251
//Pretty print the payload
5238-
for (int x = 0 ; x < 32 ; x++)
5252+
for (int x = 0; x < 32; x++)
52395253
{
52405254
downloadPort.print(F(" "));
5241-
if (payloadCfg[x] < 0x10) downloadPort.print(F("0"));
5255+
if (payloadCfg[x] < 0x10)
5256+
downloadPort.print(F("0"));
52425257
downloadPort.print(payloadCfg[x], HEX);
52435258
}
52445259
downloadPort.println();

0 commit comments

Comments
 (0)