Fixed gps probe

This commit is contained in:
lewisxhe 2025-01-13 10:38:16 +08:00
commit 63e18df2df
49 changed files with 980 additions and 294 deletions

View file

@ -909,9 +909,9 @@ void scanDevices(TwoWire *w)
#ifdef HAS_GPS
bool beginGPS()
bool l76kProbe()
{
SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
bool result = false;
uint32_t startTimeout ;
SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n");
@ -919,12 +919,13 @@ bool beginGPS()
// Get version information
startTimeout = millis() + 3000;
Serial.print("Try to init L76K . Wait stop .");
SerialGPS.flush();
// SerialGPS.flush();
while (SerialGPS.available()) {
int c = SerialGPS.read();
// Serial.write(c);
// Serial.print(".");
Serial.flush();
SerialGPS.flush();
// Serial.flush();
// SerialGPS.flush();
if (millis() > startTimeout) {
Serial.println("Wait L76K stop NMEA timeout!");
return false;
@ -962,6 +963,19 @@ bool beginGPS()
return result;
}
bool beginGPS()
{
SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
bool result = false;
for ( int i = 0; i < 3; ++i) {
result = l76kProbe();
if (result) {
return result;
}
}
return result;
}
static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID)