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

Adding packetBuf. Changing sendCommand. Requested class and ID passing. #97

Merged
merged 28 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
51de78e
Experimental code - passes requested class and id down to processUBX
PaulZC Apr 17, 2020
2b30dd0
Initial commit - passing the ubxPacket down to processUBX
PaulZC Apr 18, 2020
852dfe1
Update SparkFun_Ublox_Arduino_Library.cpp
PaulZC Apr 18, 2020
d2503cf
Update SparkFun_Ublox_Arduino_Library.cpp
PaulZC Apr 18, 2020
95a729a
Update SparkFun_Ublox_Arduino_Library.cpp
PaulZC Apr 18, 2020
e514b38
Merge branch 'Experimental_ACKResponse' into Experimental__custom_pac…
PaulZC Apr 18, 2020
f101690
Merge branch 'Experimental_custom_packetCfg' into Experimental__custo…
PaulZC Apr 18, 2020
94c32a0
Merge branch 'master' into Experimental_ACKResponse
PaulZC Apr 18, 2020
35c6623
Merge branch 'master' into Experimental__custom_packetCfg
PaulZC Apr 18, 2020
f2ac34f
Merge branch 'master' into Experimental_ACKResponse
PaulZC Apr 18, 2020
98d9edf
Update SparkFun_Ublox_Arduino_Library.cpp
PaulZC Apr 18, 2020
46cd041
Update SparkFun_Ublox_Arduino_Library.cpp
PaulZC Apr 18, 2020
3a69451
Update SparkFun_Ublox_Arduino_Library.cpp
PaulZC Apr 18, 2020
c738f7a
Merge branch 'Experimental_ACKResponse' into Experimental__custom_pac…
PaulZC Apr 18, 2020
12b48f9
Added Example20_SendCustomCommand
PaulZC Apr 18, 2020
927b9cb
Added NOTACKNOWLEDGED
PaulZC Apr 19, 2020
3154c95
Removed typos
PaulZC Apr 19, 2020
8e037a5
Added the bug fix for setNavigationFrequency
PaulZC Apr 19, 2020
b22e812
Added an extra debug print in setNavigationFrequency
PaulZC Apr 19, 2020
e0c3230
Updated so packet pointers are used everywhere from sendCommand down
PaulZC Apr 19, 2020
e724638
Updated the example
PaulZC Apr 19, 2020
3e2aa74
Updated Theory.md
PaulZC Apr 19, 2020
09e52fa
Merge branch 'Experimental__custom_packetCfg' into Experimental_packe…
PaulZC Apr 20, 2020
504efe7
Added packetBuf etc to the header
PaulZC Apr 20, 2020
956b41f
Added most of the packetBuf functionality
PaulZC Apr 20, 2020
66ee2b3
Update SparkFun_Ublox_Arduino_Library.cpp
PaulZC Apr 20, 2020
d420820
Update Example20_SendCustomCommand.ino
PaulZC Apr 20, 2020
8ce607c
Update SparkFun_Ublox_Arduino_Library.cpp
PaulZC Apr 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated the example
  • Loading branch information
PaulZC committed Apr 19, 2020
commit e72463836884d0fb3155ced77699d48417e4533c
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ void setup()
// SFE_UBLOX_STATUS_DATA_RECEIVED if the data we requested was read / polled successfully
// SFE_UBLOX_STATUS_DATA_SENT if the data we sent was writted successfully (ACK'd)
// Other values indicate errors. Please see the sfe_ublox_status_e enum for further details.
// If you see a failure you can of course simply try sending the same command again.

// Referring to the u-blox M8 Receiver Description and Protocol Specification we see that
// the dynamic model is configured using the UBX-CFG-NAV5 message. So let's load our
// custom packet with the correct information so we can read (poll) the current settings.
// custom packet with the correct information so we can read (poll / get) the current settings.

customCfg.cls = UBX_CLASS_CFG; // This is the message Class
customCfg.id = UBX_CFG_NAV5; // This is the message ID
Expand All @@ -102,18 +101,9 @@ void setup()
// Now let's read the current navigation model settings. The results will be loaded into customCfg.
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
{
Serial.println(F("sendCommand (poll) failed! Trying again..."));
// We need to reset the packet before we try again as the values could have changed
customCfg.cls = UBX_CLASS_CFG;
customCfg.id = UBX_CFG_NAV5;
customCfg.len = 0;
customCfg.startingSpot = 0;
if (myGPS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
{
Serial.println(F("sendCommand (poll) failed again! Freezing."));
while (1)
;
}
Serial.println(F("sendCommand (poll) failed! Freezing..."));
while (1)
;
}

// Referring to the message definition for UBX-CFG-NAV5 we see that we need to change
Expand Down
12 changes: 4 additions & 8 deletions src/SparkFun_Ublox_Arduino_Library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const char *SFE_UBLOX_GPS::statusString(sfe_ublox_status_e stat)
return "Timeout";
break;
case SFE_UBLOX_STATUS_COMMAND_UNKNOWN:
return "Command Unknown";
return "Command Unknown (NACK)";
break;
case SFE_UBLOX_STATUS_OUT_OF_RANGE:
return "Out of range";
Expand All @@ -154,6 +154,9 @@ const char *SFE_UBLOX_GPS::statusString(sfe_ublox_status_e stat)
case SFE_UBLOX_STATUS_I2C_COMM_FAILURE:
return "I2C Comm Failure";
break;
case SFE_UBLOX_STATUS_DATA_OVERWRITTEN:
return "Data Packet Overwritten";
break;
default:
return "Unknown Status";
break;
Expand Down Expand Up @@ -2059,18 +2062,11 @@ boolean SFE_UBLOX_GPS::setNavigationFrequency(uint8_t navFreq, uint16_t maxWait)
if (sendCommand(&packetCfg, maxWait) != SFE_UBLOX_STATUS_DATA_RECEIVED) // We are expecting data and an ACK
return (false); //If command send fails then bail

if (_printDebug == true)
{
_debugSerial->print(F("setNavigationFrequency packetCfg.len is "));
_debugSerial->println(packetCfg.len);
}

uint16_t measurementRate = 1000 / navFreq;

//payloadCfg is now loaded with current bytes. Change only the ones we need to
payloadCfg[0] = measurementRate & 0xFF; //measRate LSB
payloadCfg[1] = measurementRate >> 8; //measRate MSB
//packetCfg.len = 6;

return ((sendCommand(&packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
}
Expand Down