@@ -9185,13 +9185,27 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
91859185        {
91869186          spartn[3] = incoming; // Restore TF005 and TF006 now we know the data is valid
91879187          parseState = TF007;
9188-           //Serial.println("Header CRC is valid");
9189-           //Serial.printf("payloadLength %d EAF %d crcType %d\n", payloadLength, EAF, crcType);
9188+ #ifndef SFE_UBLOX_REDUCED_PROG_MEM
9189+           if (_printDebug == true)
9190+           {
9191+             _debugSerial.print(F("SPARTN Header CRC is valid: payloadLength "));
9192+             _debugSerial.print(payloadLength);
9193+             _debugSerial.print(F(" EAF "));
9194+             _debugSerial.print(EAF);
9195+             _debugSerial.print(F(" crcType "));
9196+             _debugSerial.println(crcType);
9197+           }
9198+ #endif
91909199        }
91919200        else
91929201        {
91939202          parseState = waitingFor73;
9194-           //Serial.println("Header CRC is INVALID");
9203+ #ifndef SFE_UBLOX_REDUCED_PROG_MEM
9204+           if (_printDebug == true)
9205+           {
9206+             _debugSerial.println(F("SPARTN Header CRC is INVALID"));
9207+           }
9208+ #endif
91959209        }
91969210      }
91979211      frameCount++;
@@ -9200,7 +9214,13 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
92009214      spartn[4] = incoming;
92019215      messageSubtype = incoming >> 4;
92029216      timeTagType = (incoming >> 3) & 0x01;
9203-       //Serial.printf("timeTagType %d\n", timeTagType);
9217+ #ifndef SFE_UBLOX_REDUCED_PROG_MEM
9218+       if (_printDebug == true)
9219+       {
9220+         _debugSerial.print(F("SPARTN timeTagType "));
9221+         _debugSerial.println(timeTagType);
9222+       }
9223+ #endif
92049224      if (timeTagType == 0)
92059225        TF007toTF016 = 4;
92069226      else
@@ -9223,7 +9243,13 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
92239243        else
92249244        {
92259245          authenticationIndicator = (incoming >> 3) & 0x07;
9226-           //Serial.printf("authenticationIndicator %d\n", authenticationIndicator);
9246+ #ifndef SFE_UBLOX_REDUCED_PROG_MEM
9247+           if (_printDebug == true)
9248+           {
9249+             _debugSerial.print(F("SPARTN authenticationIndicator "));
9250+             _debugSerial.println(authenticationIndicator);
9251+           }
9252+ #endif
92279253          if (authenticationIndicator <= 1)
92289254            embeddedApplicationLengthBytes = 0;
92299255          else
@@ -9247,7 +9273,13 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
92479273                break;
92489274            }
92499275          }
9250-           //Serial.printf("embeddedApplicationLengthBytes %d\n", embeddedApplicationLengthBytes);
9276+ #ifndef SFE_UBLOX_REDUCED_PROG_MEM
9277+           if (_printDebug == true)
9278+           {
9279+             _debugSerial.print(F("SPARTN embeddedApplicationLengthBytes "));
9280+             _debugSerial.println(embeddedApplicationLengthBytes);
9281+           }
9282+ #endif
92519283        }
92529284        parseState = TF016;
92539285        frameCount = 0;                  
@@ -9286,7 +9318,13 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
92869318      {
92879319          parseState = waitingFor73;
92889320          uint16_t numBytes = 4 + TF007toTF016 + payloadLength + embeddedApplicationLengthBytes;
9289-           //Serial.printf("numBytes %d\n", numBytes);
9321+ #ifndef SFE_UBLOX_REDUCED_PROG_MEM
9322+           if (_printDebug == true)
9323+           {
9324+             _debugSerial.print(F("SPARTN numBytes "));
9325+             _debugSerial.println(numBytes);
9326+           }
9327+ #endif
92909328          uint8_t *ptr = &spartn[numBytes];
92919329          switch (crcType)
92929330          {
@@ -9297,11 +9335,6 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
92979335              {
92989336                valid = true;
92999337                len = numBytes + 1;
9300-                 //Serial.println("SPARTN CRC-8 is valid");
9301-               }
9302-               else
9303-               {
9304-                 //Serial.println("SPARTN CRC-8 is INVALID");
93059338              }
93069339            }
93079340            break;
@@ -9314,11 +9347,6 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
93149347              {
93159348                valid = true;
93169349                len = numBytes + 2;
9317-                 //Serial.println("SPARTN CRC-16 is valid");
9318-               }
9319-               else
9320-               {
9321-                 //Serial.println("SPARTN CRC-16 is INVALID");
93229350              }
93239351            }
93249352            break;
@@ -9334,11 +9362,18 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
93349362              {
93359363                valid = true;
93369364                len = numBytes + 3;
9337-                 //Serial.println("SPARTN CRC-24 is valid");
93389365              }
93399366              else
93409367              {
9341-                 //Serial.printf("SPARTN CRC-24 is INVALID: 0x%06X vs 0x%06X\n", expected, crc);
9368+ #ifndef SFE_UBLOX_REDUCED_PROG_MEM
9369+                 if (_printDebug == true)
9370+                 {
9371+                   _debugSerial.print(F("SPARTN CRC-24 is INVALID: 0x"));
9372+                   _debugSerial.print(expected, HEX);
9373+                   _debugSerial.print(F(" vs 0x"));
9374+                   _debugSerial.println(crc, HEX);
9375+                 }
9376+ #endif
93429377              }
93439378            }
93449379            break;
@@ -9355,11 +9390,6 @@ uint8_t * DevUBLOXGNSS::parseSPARTN(uint8_t incoming, bool &valid, uint16_t &len
93559390              {
93569391                valid = true;
93579392                len = numBytes + 4;
9358-                 //Serial.println("SPARTN CRC-32 is valid");
9359-               }
9360-               else
9361-               {
9362-                 //Serial.println("SPARTN CRC-32 is INVALID");
93639393              }
93649394            }
93659395            break;
0 commit comments