@@ -1284,15 +1284,15 @@ bool SFE_UBLOX_GNSS::checkUbloxSpi(ubxPacket *incomingUBX, uint8_t requestedClas
1284
1284
1285
1285
// If we are not receiving a sentence (currentSentence == NONE) and the byteReturned is 0xFF,
1286
1286
// i.e. the module has no data for us, then delay for
1287
- if ((byteReturned == 0xFF) && (currentSentence == NONE ))
1287
+ if ((byteReturned == 0xFF) && (currentSentence == SFE_UBLOX_SENTENCE_TYPE_NONE ))
1288
1288
{
1289
1289
digitalWrite(_csPin, HIGH);
1290
1290
_spiPort->endTransaction();
1291
1291
delay(spiPollingWait);
1292
1292
return (true);
1293
1293
}
1294
1294
1295
- while ((byteReturned != 0xFF) || (currentSentence != NONE ))
1295
+ while ((byteReturned != 0xFF) || (currentSentence != SFE_UBLOX_SENTENCE_TYPE_NONE ))
1296
1296
{
1297
1297
process(byteReturned, incomingUBX, requestedClass, requestedID);
1298
1298
byteReturned = _spiPort->transfer(0xFF);
@@ -1686,14 +1686,14 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
1686
1686
{
1687
1687
if (_outputPort != NULL)
1688
1688
_outputPort->write(incoming); // Echo this byte to the serial port
1689
- if ((currentSentence == NONE ) || (currentSentence == NMEA ))
1689
+ if ((currentSentence == SFE_UBLOX_SENTENCE_TYPE_NONE ) || (currentSentence == SFE_UBLOX_SENTENCE_TYPE_NMEA ))
1690
1690
{
1691
1691
if (incoming == UBX_SYNCH_1) // UBX binary frames start with 0xB5, aka μ
1692
1692
{
1693
1693
// This is the start of a binary sentence. Reset flags.
1694
1694
// We still don't know the response class
1695
1695
ubxFrameCounter = 0;
1696
- currentSentence = UBX ;
1696
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_UBX ;
1697
1697
// Reset the packetBuf.counter even though we will need to reset it again when ubxFrameCounter == 2
1698
1698
packetBuf.counter = 0;
1699
1699
ignoreThisPayload = false; // We should not ignore this payload - yet
@@ -1703,12 +1703,12 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
1703
1703
else if (incoming == '$')
1704
1704
{
1705
1705
nmeaByteCounter = 0; // Reset the NMEA byte counter
1706
- currentSentence = NMEA ;
1706
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NMEA ;
1707
1707
}
1708
1708
else if (incoming == 0xD3) // RTCM frames start with 0xD3
1709
1709
{
1710
1710
rtcmFrameCounter = 0;
1711
- currentSentence = RTCM ;
1711
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_RTCM ;
1712
1712
}
1713
1713
else
1714
1714
{
@@ -1717,13 +1717,13 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
1717
1717
}
1718
1718
1719
1719
// Depending on the sentence, pass the character to the individual processor
1720
- if (currentSentence == UBX )
1720
+ if (currentSentence == SFE_UBLOX_SENTENCE_TYPE_UBX )
1721
1721
{
1722
1722
// Decide what type of response this is
1723
1723
if ((ubxFrameCounter == 0) && (incoming != UBX_SYNCH_1)) // ISO 'μ'
1724
- currentSentence = NONE ; // Something went wrong. Reset.
1724
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // Something went wrong. Reset.
1725
1725
else if ((ubxFrameCounter == 1) && (incoming != UBX_SYNCH_2)) // ASCII 'b'
1726
- currentSentence = NONE ; // Something went wrong. Reset.
1726
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // Something went wrong. Reset.
1727
1727
// Note to future self:
1728
1728
// There may be some duplication / redundancy in the next few lines as processUBX will also
1729
1729
// load information into packetBuf, but we'll do it here too for clarity
@@ -1936,15 +1936,15 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
1936
1936
// Finally, increment the frame counter
1937
1937
ubxFrameCounter++;
1938
1938
}
1939
- else if (currentSentence == NMEA ) // Process incoming NMEA mesages. Selectively log if desired.
1939
+ else if (currentSentence == SFE_UBLOX_SENTENCE_TYPE_NMEA ) // Process incoming NMEA mesages. Selectively log if desired.
1940
1940
{
1941
1941
if ((nmeaByteCounter == 0) && (incoming != '$'))
1942
1942
{
1943
- currentSentence = NONE ; // Something went wrong. Reset. (Almost certainly redundant!)
1943
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // Something went wrong. Reset. (Almost certainly redundant!)
1944
1944
}
1945
1945
else if ((nmeaByteCounter == 1) && (incoming != 'G'))
1946
1946
{
1947
- currentSentence = NONE ; // Something went wrong. Reset.
1947
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // Something went wrong. Reset.
1948
1948
}
1949
1949
else if ((nmeaByteCounter >= 0) && (nmeaByteCounter <= 5))
1950
1950
{
@@ -2029,7 +2029,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
2029
2029
nmeaByteCounter++; // Increment the byte counter
2030
2030
2031
2031
if (nmeaByteCounter == maxNMEAByteCount) // Check if we have processed too many bytes
2032
- currentSentence = NONE ; // Something went wrong. Reset.
2032
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // Something went wrong. Reset.
2033
2033
2034
2034
if (nmeaByteCounter == 0) // Check if we are done
2035
2035
{
@@ -2109,10 +2109,10 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
2109
2109
}
2110
2110
}
2111
2111
#endif
2112
- currentSentence = NONE ; // All done!
2112
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // All done!
2113
2113
}
2114
2114
}
2115
- else if (currentSentence == RTCM )
2115
+ else if (currentSentence == SFE_UBLOX_SENTENCE_TYPE_RTCM )
2116
2116
{
2117
2117
currentSentence = processRTCMframe(incoming, &rtcmFrameCounter); // Deal with RTCM bytes
2118
2118
}
@@ -2876,7 +2876,7 @@ nmeaAutomaticFlags *SFE_UBLOX_GNSS::getNMEAFlagsPtr()
2876
2876
// Byte 2: 10-bits of length of this packet including the first two-ish header bytes, + 6.
2877
2877
// byte 3 + 4 bits: Msg type 12 bits
2878
2878
// Example: D3 00 7C 43 F0 ... / 0x7C = 124+6 = 130 bytes in this packet, 0x43F = Msg type 1087
2879
- SFE_UBLOX_GNSS::SentenceTypes SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming, uint16_t * rtcmFrameCounter)
2879
+ SFE_UBLOX_GNSS::sfe_ublox_sentence_types_e SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming, uint16_t * rtcmFrameCounter)
2880
2880
{
2881
2881
static uint16_t rtcmLen = 0;
2882
2882
@@ -2898,22 +2898,19 @@ SFE_UBLOX_GNSS::SentenceTypes SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming,
2898
2898
rtcmMsgType |= (incoming >> 4); //Message Type, bits 0-7
2899
2899
}*/
2900
2900
2901
- *rtcmFrameCounter++ ;
2901
+ *rtcmFrameCounter = *rtcmFrameCounter + 1 ;
2902
2902
2903
2903
processRTCM(incoming); // Here is where we expose this byte to the user
2904
2904
2905
2905
// Reset and start looking for next sentence type when done
2906
- return (*rtcmFrameCounter == rtcmLen) ? NONE : RTCM ;
2906
+ return (*rtcmFrameCounter == rtcmLen) ? SFE_UBLOX_SENTENCE_TYPE_NONE : SFE_UBLOX_SENTENCE_TYPE_RTCM ;
2907
2907
}
2908
2908
2909
2909
// This function is called for each byte of an RTCM frame
2910
2910
// Ths user can overwrite this function and process the RTCM frame as they please
2911
2911
// Bytes can be piped to Serial or other interface. The consumer could be a radio or the internet (Ntrip broadcaster)
2912
2912
void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
2913
2913
{
2914
- uint8_t ignoreMe = incoming;
2915
- ignoreMe += 0; // Do something with incoming just to get rid of the pesky compiler warning!
2916
-
2917
2914
// Radio.sendReliable((String)incoming); //An example of passing this byte to a radio
2918
2915
2919
2916
//_debugSerial->write(incoming); //An example of passing this byte out the serial port
@@ -2923,6 +2920,8 @@ void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
2923
2920
// if(incoming < 0x10) _debugSerial->print(F("0"));
2924
2921
// _debugSerial->print(incoming, HEX);
2925
2922
// if(rtcmFrameCounter % 16 == 0) _debugSerial->println();
2923
+
2924
+ (void)incoming; // Do something with incoming just to get rid of the pesky compiler warning!
2926
2925
}
2927
2926
2928
2927
// Given a character, file it away into the uxb packet structure
@@ -2995,7 +2994,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_
2995
2994
{
2996
2995
incomingUBX->checksumB = incoming;
2997
2996
2998
- currentSentence = NONE ; // We're done! Reset the sentence to being looking for a new start char
2997
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // We're done! Reset the sentence to being looking for a new start char
2999
2998
3000
2999
// Validate this sentence
3001
3000
if ((incomingUBX->checksumA == rollingChecksumA) && (incomingUBX->checksumB == rollingChecksumB))
@@ -3163,7 +3162,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_
3163
3162
if (overrun || ((incomingUBX->counter == maximum_payload_size + 6) && (ignoreThisPayload == false)))
3164
3163
{
3165
3164
// Something has gone very wrong
3166
- currentSentence = NONE ; // Reset the sentence to being looking for a new start char
3165
+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // Reset the sentence to being looking for a new start char
3167
3166
#ifndef SFE_UBLOX_REDUCED_PROG_MEM
3168
3167
if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
3169
3168
{
@@ -4620,9 +4619,6 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::sendCommand(ubxPacket *outgoingUBX, uint16_t
4620
4619
// Returns false if sensor fails to respond to I2C traffic
4621
4620
sfe_ublox_status_e SFE_UBLOX_GNSS::sendI2cCommand(ubxPacket *outgoingUBX, uint16_t maxWait)
4622
4621
{
4623
- uint16_t ignoreMe = maxWait;
4624
- ignoreMe += 0; // Do something with maxWait just to avoid the pesky compiler warnings!
4625
-
4626
4622
// From the integration guide:
4627
4623
// "The receiver does not provide any write access except for writing UBX and NMEA messages to the
4628
4624
// receiver, such as configuration or aiding data. Therefore, the register set mentioned in section Read
@@ -4754,6 +4750,8 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::sendI2cCommand(ubxPacket *outgoingUBX, uint16
4754
4750
if (_i2cPort->endTransmission() != 0)
4755
4751
return (SFE_UBLOX_STATUS_I2C_COMM_FAILURE); // Sensor did not ACK
4756
4752
4753
+ (void)maxWait; // Do something with maxWait just to avoid the pesky compiler warnings!
4754
+
4757
4755
return (SFE_UBLOX_STATUS_SUCCESS);
4758
4756
}
4759
4757
@@ -4784,7 +4782,7 @@ void SFE_UBLOX_GNSS::sendSerialCommand(ubxPacket *outgoingUBX)
4784
4782
void SFE_UBLOX_GNSS::spiTransfer(uint8_t byteToTransfer)
4785
4783
{
4786
4784
uint8_t returnedByte = _spiPort->transfer(byteToTransfer);
4787
- if ((spiBufferIndex < getSpiTransactionSize()) && (returnedByte != 0xFF || currentSentence != NONE ))
4785
+ if ((spiBufferIndex < getSpiTransactionSize()) && (returnedByte != 0xFF || currentSentence != SFE_UBLOX_SENTENCE_TYPE_NONE ))
4788
4786
{
4789
4787
spiBuffer[spiBufferIndex] = returnedByte;
4790
4788
spiBufferIndex++;
@@ -17497,8 +17495,7 @@ uint16_t SFE_UBLOX_GNSS::getMagAcc(uint16_t maxWait)
17497
17495
// getGeoidSeparation is currently redundant. The geoid separation seems to only be provided in NMEA GGA and GNS messages.
17498
17496
int32_t SFE_UBLOX_GNSS::getGeoidSeparation(uint16_t maxWait)
17499
17497
{
17500
- uint16_t ignoreMe = maxWait;
17501
- ignoreMe += 0; // Do something with maxWait just to get rid of the pesky compiler warning
17498
+ (void)maxWait; // Do something with maxWait just to get rid of the pesky compiler warning
17502
17499
17503
17500
return (0);
17504
17501
}
0 commit comments