Skip to content

Commit 0b04481

Browse files
committed
Merge branch 'release_candidate_v2.1_modified_state_management' of https://github.com/sparkfun/SparkFun_u-blox_GNSS_Arduino_Library into release_candidate_v2.1_modified_state_management
2 parents 8c2fbf6 + 7f2384b commit 0b04481

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

examples/Example20_SendCustomCommand/Example20_SendCustomCommand.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void setup()
6464
// Let's create our custom packet
6565
uint8_t customPayload[MAX_PAYLOAD_SIZE]; // This array holds the payload data bytes
6666
// The next line creates and initialises the packet information which wraps around the payload
67-
ubxPacket customCfg = {0, 0, 0, 0, 0, customPayload, 0, 0, SFE_UBLOX_PACKET_VALIDITY_NOT_DEFINED, SFE_UBLOX_PACKET_VALIDITY_NOT_DEFINED};
67+
ubxPacket customCfg = {0, 0, 0, 0, 0, customPayload, 0, 0, SFE_UBLOX_PACKET_VALIDITY_NOT_DEFINED};
6868

6969
// The structure of ubxPacket is:
7070
// uint8_t cls : The message Class
@@ -126,7 +126,7 @@ void setup()
126126
// when sendCommand read the data
127127

128128
// Now we write the custom packet back again to change the setting
129-
if (myGNSS.sendCommand(&customCfg, maxWait) != SFE_UBLOX_STATUS_DATA_SENT) // This time we are only expecting an ACK
129+
if (myGNSS.sendCommand(&customCfg, maxWait, true) != SFE_UBLOX_STATUS_DATA_SENT) // This time we are only expecting an ACK
130130
{
131131
Serial.println(F("sendCommand (set) failed! Freezing."));
132132
while (1)

src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2756,6 +2756,11 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::sendCommand(ubxPacket *outgoingUBX, uint16_t
27562756
if (_printDebug == true)
27572757
{
27582758
_debugSerial->println(F("sendCommand: Waiting for ACK response"));
2759+
_debugSerial->print(F("expecting cls and id: 0x"));
2760+
_debugSerial->print(outgoingUBX->cls, HEX);
2761+
_debugSerial->print(F(" 0x"));
2762+
_debugSerial->println(outgoingUBX->id, HEX);
2763+
27592764
}
27602765
retVal = waitForACKResponse(outgoingUBX, outgoingUBX->cls, outgoingUBX->id, maxWait, expectACKonly); //Wait for Ack response
27612766
}
@@ -3029,6 +3034,13 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::waitForACKResponse(ubxPacket *outgoingUBX, ui
30293034
packetAuto.valid = SFE_UBLOX_PACKET_VALIDITY_NOT_DEFINED;
30303035

30313036
unsigned long startTime = millis();
3037+
if (_printDebug == true)
3038+
{
3039+
_debugSerial->print(F("waitForACKResponse: requested class and id: "));
3040+
_debugSerial->print(requestedClass, HEX);
3041+
_debugSerial->print(F(" "));
3042+
_debugSerial->println(requestedID, HEX);
3043+
}
30323044
while (millis() - startTime < maxTime)
30333045
{
30343046
if (checkUbloxInternal(outgoingUBX, requestedClass, requestedID) == true) //See if new data is available. Process bytes as they come in.
@@ -3814,7 +3826,7 @@ boolean SFE_UBLOX_GNSS::setPortInput(uint8_t portID, uint8_t inStreamSettings, u
38143826
//payloadCfg is now loaded with current bytes. Change only the ones we need to
38153827
payloadCfg[12] = inStreamSettings; //InProtocolMask LSB - Set inStream bits
38163828

3817-
return ((sendCommand(&packetCfg, maxWait)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
3829+
return ((sendCommand(&packetCfg, maxWait, true)) == SFE_UBLOX_STATUS_DATA_SENT); // We are only expecting an ACK
38183830
}
38193831

38203832
//Changes the I2C address that the u-blox module responds to

0 commit comments

Comments
 (0)