@@ -711,7 +711,10 @@ boolean SFE_UBLOX_GPS::sendCommand(ubxPacket outgoingUBX, uint16_t maxWait)
711
711
if (commType == COMM_TYPE_I2C)
712
712
{
713
713
if (!sendI2cCommand (outgoingUBX, maxWait))
714
+ {
715
+ debugPrintln ((char *)" Send I2C Command failed" );
714
716
return false ;
717
+ }
715
718
}
716
719
else if (commType == COMM_TYPE_SERIAL)
717
720
{
@@ -720,12 +723,15 @@ boolean SFE_UBLOX_GPS::sendCommand(ubxPacket outgoingUBX, uint16_t maxWait)
720
723
721
724
if (maxWait > 0 )
722
725
{
726
+ debugPrintln ((char *)" Waiting for response from sendCommand" );
727
+
723
728
// Give waitForResponse the cls/id to check for
724
729
return waitForResponse (outgoingUBX.cls , outgoingUBX.id , maxWait); // Wait for Ack response
725
730
}
726
731
return true ;
727
732
}
728
733
734
+ // Returns false if sensor fails to respond to I2C traffic
729
735
boolean SFE_UBLOX_GPS::sendI2cCommand (ubxPacket outgoingUBX, uint16_t maxWait)
730
736
{
731
737
// Point at 0xFF data register
@@ -958,12 +964,31 @@ boolean SFE_UBLOX_GPS::waitForResponse(uint8_t requestedClass, uint8_t requested
958
964
return (true );
959
965
}
960
966
}
967
+ else if (packetCfg.valid == true )
968
+ {
969
+ // Packets that are not CFG packets such as getPVT()
970
+ Serial.println (" Non CFG packet" );
971
+ // Did we receive a config packet that matches the cls/id we requested?
972
+ if (packetCfg.cls == requestedClass && packetCfg.id == requestedID)
973
+ {
974
+ debugPrintln ((char *)" CLS/ID match!" );
975
+ return (true ); // We have new data to act upon
976
+ }
977
+ else
978
+ {
979
+ if (_printDebug == true )
980
+ {
981
+ _debugSerial->print (F (" Packet didn't match CLS/ID" ));
982
+ printPacket (&packetCfg);
983
+ }
984
+ }
985
+ }
961
986
}
962
987
963
988
delayMicroseconds (500 );
964
989
}
965
990
966
- debugPrintln ((char *)" waitForResponse timeout" );
991
+ debugPrintln ((char *)" waitForResponse timeout: No valid ack packet received " );
967
992
968
993
return (false );
969
994
}
@@ -2063,17 +2088,20 @@ boolean SFE_UBLOX_GPS::getPVT(uint16_t maxWait)
2063
2088
{
2064
2089
if (autoPVT && autoPVTImplicitUpdate)
2065
2090
{
2091
+ Serial.println (" Check ulbox" );
2066
2092
// The GPS is automatically reporting, we just check whether we got unread data
2067
2093
checkUblox ();
2068
2094
return moduleQueried.all ;
2069
2095
}
2070
2096
else if (autoPVT && !autoPVTImplicitUpdate)
2071
2097
{
2072
2098
// Someone else has to call checkUblox for us...
2099
+ Serial.println (" Immediateexi" );
2073
2100
return (false );
2074
2101
}
2075
2102
else
2076
2103
{
2104
+ Serial.println (" Poll PVT" );
2077
2105
// The GPS is not automatically reporting navigation position so we have to poll explicitly
2078
2106
packetCfg.cls = UBX_CLASS_NAV;
2079
2107
packetCfg.id = UBX_NAV_PVT;
@@ -2082,7 +2110,6 @@ boolean SFE_UBLOX_GPS::getPVT(uint16_t maxWait)
2082
2110
2083
2111
// The data is parsed as part of processing the response
2084
2112
return sendCommand (packetCfg, maxWait);
2085
- return (false ); // If command send fails then bail
2086
2113
}
2087
2114
}
2088
2115
@@ -2245,8 +2272,13 @@ uint8_t SFE_UBLOX_GPS::getSIV(uint16_t maxWait)
2245
2272
// 0=no fix, 1=dead reckoning, 2=2D, 3=3D, 4=GNSS, 5=Time fix
2246
2273
uint8_t SFE_UBLOX_GPS::getFixType (uint16_t maxWait)
2247
2274
{
2275
+ Serial.println (" Get fix type" );
2248
2276
if (moduleQueried.fixType == false )
2277
+ {
2278
+ Serial.println (" GetPVT" );
2279
+
2249
2280
getPVT (maxWait);
2281
+ }
2250
2282
moduleQueried.fixType = false ; // Since we are about to give this to user, mark this data as stale
2251
2283
moduleQueried.all = false ;
2252
2284
0 commit comments