@@ -1284,15 +1284,15 @@ bool SFE_UBLOX_GNSS::checkUbloxSpi(ubxPacket *incomingUBX, uint8_t requestedClas
12841284
12851285 // If we are not receiving a sentence (currentSentence == NONE) and the byteReturned is 0xFF,
12861286 // 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 ))
12881288 {
12891289 digitalWrite(_csPin, HIGH);
12901290 _spiPort->endTransaction();
12911291 delay(spiPollingWait);
12921292 return (true);
12931293 }
12941294
1295- while ((byteReturned != 0xFF) || (currentSentence != NONE ))
1295+ while ((byteReturned != 0xFF) || (currentSentence != SFE_UBLOX_SENTENCE_TYPE_NONE ))
12961296 {
12971297 process(byteReturned, incomingUBX, requestedClass, requestedID);
12981298 byteReturned = _spiPort->transfer(0xFF);
@@ -1686,14 +1686,14 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
16861686{
16871687 if (_outputPort != NULL)
16881688 _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 ))
16901690 {
16911691 if (incoming == UBX_SYNCH_1) // UBX binary frames start with 0xB5, aka μ
16921692 {
16931693 // This is the start of a binary sentence. Reset flags.
16941694 // We still don't know the response class
16951695 ubxFrameCounter = 0;
1696- currentSentence = UBX ;
1696+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_UBX ;
16971697 // Reset the packetBuf.counter even though we will need to reset it again when ubxFrameCounter == 2
16981698 packetBuf.counter = 0;
16991699 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
17031703 else if (incoming == '$')
17041704 {
17051705 nmeaByteCounter = 0; // Reset the NMEA byte counter
1706- currentSentence = NMEA ;
1706+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NMEA ;
17071707 }
17081708 else if (incoming == 0xD3) // RTCM frames start with 0xD3
17091709 {
17101710 rtcmFrameCounter = 0;
1711- currentSentence = RTCM ;
1711+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_RTCM ;
17121712 }
17131713 else
17141714 {
@@ -1717,13 +1717,13 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
17171717 }
17181718
17191719 // Depending on the sentence, pass the character to the individual processor
1720- if (currentSentence == UBX )
1720+ if (currentSentence == SFE_UBLOX_SENTENCE_TYPE_UBX )
17211721 {
17221722 // Decide what type of response this is
17231723 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.
17251725 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.
17271727 // Note to future self:
17281728 // There may be some duplication / redundancy in the next few lines as processUBX will also
17291729 // 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
19361936 // Finally, increment the frame counter
19371937 ubxFrameCounter++;
19381938 }
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.
19401940 {
19411941 if ((nmeaByteCounter == 0) && (incoming != '$'))
19421942 {
1943- currentSentence = NONE ; // Something went wrong. Reset. (Almost certainly redundant!)
1943+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // Something went wrong. Reset. (Almost certainly redundant!)
19441944 }
19451945 else if ((nmeaByteCounter == 1) && (incoming != 'G'))
19461946 {
1947- currentSentence = NONE ; // Something went wrong. Reset.
1947+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // Something went wrong. Reset.
19481948 }
19491949 else if ((nmeaByteCounter >= 0) && (nmeaByteCounter <= 5))
19501950 {
@@ -2029,7 +2029,7 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
20292029 nmeaByteCounter++; // Increment the byte counter
20302030
20312031 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.
20332033
20342034 if (nmeaByteCounter == 0) // Check if we are done
20352035 {
@@ -2109,10 +2109,10 @@ void SFE_UBLOX_GNSS::process(uint8_t incoming, ubxPacket *incomingUBX, uint8_t r
21092109 }
21102110 }
21112111#endif
2112- currentSentence = NONE ; // All done!
2112+ currentSentence = SFE_UBLOX_SENTENCE_TYPE_NONE ; // All done!
21132113 }
21142114 }
2115- else if (currentSentence == RTCM )
2115+ else if (currentSentence == SFE_UBLOX_SENTENCE_TYPE_RTCM )
21162116 {
21172117 currentSentence = processRTCMframe(incoming, &rtcmFrameCounter); // Deal with RTCM bytes
21182118 }
@@ -2876,7 +2876,7 @@ nmeaAutomaticFlags *SFE_UBLOX_GNSS::getNMEAFlagsPtr()
28762876// Byte 2: 10-bits of length of this packet including the first two-ish header bytes, + 6.
28772877// byte 3 + 4 bits: Msg type 12 bits
28782878// 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)
28802880{
28812881 static uint16_t rtcmLen = 0;
28822882
@@ -2898,22 +2898,19 @@ SFE_UBLOX_GNSS::SentenceTypes SFE_UBLOX_GNSS::processRTCMframe(uint8_t incoming,
28982898 rtcmMsgType |= (incoming >> 4); //Message Type, bits 0-7
28992899 }*/
29002900
2901- *rtcmFrameCounter++ ;
2901+ *rtcmFrameCounter = *rtcmFrameCounter + 1 ;
29022902
29032903 processRTCM(incoming); // Here is where we expose this byte to the user
29042904
29052905 // 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 ;
29072907}
29082908
29092909// This function is called for each byte of an RTCM frame
29102910// Ths user can overwrite this function and process the RTCM frame as they please
29112911// Bytes can be piped to Serial or other interface. The consumer could be a radio or the internet (Ntrip broadcaster)
29122912void SFE_UBLOX_GNSS::processRTCM(uint8_t incoming)
29132913{
2914- uint8_t ignoreMe = incoming;
2915- ignoreMe += 0; // Do something with incoming just to get rid of the pesky compiler warning!
2916-
29172914 // Radio.sendReliable((String)incoming); //An example of passing this byte to a radio
29182915
29192916 //_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)
29232920 // if(incoming < 0x10) _debugSerial->print(F("0"));
29242921 // _debugSerial->print(incoming, HEX);
29252922 // if(rtcmFrameCounter % 16 == 0) _debugSerial->println();
2923+
2924+ (void)incoming; // Do something with incoming just to get rid of the pesky compiler warning!
29262925}
29272926
29282927// 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_
29952994 {
29962995 incomingUBX->checksumB = incoming;
29972996
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
29992998
30002999 // Validate this sentence
30013000 if ((incomingUBX->checksumA == rollingChecksumA) && (incomingUBX->checksumB == rollingChecksumB))
@@ -3163,7 +3162,7 @@ void SFE_UBLOX_GNSS::processUBX(uint8_t incoming, ubxPacket *incomingUBX, uint8_
31633162 if (overrun || ((incomingUBX->counter == maximum_payload_size + 6) && (ignoreThisPayload == false)))
31643163 {
31653164 // 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
31673166#ifndef SFE_UBLOX_REDUCED_PROG_MEM
31683167 if ((_printDebug == true) || (_printLimitedDebug == true)) // This is important. Print this if doing limited debugging
31693168 {
@@ -4620,9 +4619,6 @@ sfe_ublox_status_e SFE_UBLOX_GNSS::sendCommand(ubxPacket *outgoingUBX, uint16_t
46204619// Returns false if sensor fails to respond to I2C traffic
46214620sfe_ublox_status_e SFE_UBLOX_GNSS::sendI2cCommand(ubxPacket *outgoingUBX, uint16_t maxWait)
46224621{
4623- uint16_t ignoreMe = maxWait;
4624- ignoreMe += 0; // Do something with maxWait just to avoid the pesky compiler warnings!
4625-
46264622 // From the integration guide:
46274623 // "The receiver does not provide any write access except for writing UBX and NMEA messages to the
46284624 // 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
47544750 if (_i2cPort->endTransmission() != 0)
47554751 return (SFE_UBLOX_STATUS_I2C_COMM_FAILURE); // Sensor did not ACK
47564752
4753+ (void)maxWait; // Do something with maxWait just to avoid the pesky compiler warnings!
4754+
47574755 return (SFE_UBLOX_STATUS_SUCCESS);
47584756}
47594757
@@ -4784,7 +4782,7 @@ void SFE_UBLOX_GNSS::sendSerialCommand(ubxPacket *outgoingUBX)
47844782void SFE_UBLOX_GNSS::spiTransfer(uint8_t byteToTransfer)
47854783{
47864784 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 ))
47884786 {
47894787 spiBuffer[spiBufferIndex] = returnedByte;
47904788 spiBufferIndex++;
@@ -17497,8 +17495,7 @@ uint16_t SFE_UBLOX_GNSS::getMagAcc(uint16_t maxWait)
1749717495// getGeoidSeparation is currently redundant. The geoid separation seems to only be provided in NMEA GGA and GNS messages.
1749817496int32_t SFE_UBLOX_GNSS::getGeoidSeparation(uint16_t maxWait)
1749917497{
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
1750217499
1750317500 return (0);
1750417501}
0 commit comments