Add delay and debug code for GPS probe

This commit is contained in:
Jonathan Bennett 2023-09-02 20:35:38 -05:00
parent 1a178c7d33
commit b21368ecfa

View File

@ -58,15 +58,21 @@ GPS_RESPONSE GPS::getACK(const char *message, int waitMillis)
b = _serial_gps->read(); b = _serial_gps->read();
buffer[bytesRead] = b; buffer[bytesRead] = b;
bytesRead++; bytesRead++;
if ((bytesRead == 768) || (b == '\r')) { if ((bytesRead == 767) || (b == '\r')) {
if (strnstr((char *)buffer, message, bytesRead) != nullptr) { if (strnstr((char *)buffer, message, bytesRead) != nullptr) {
return GNSS_RESPONSE_OK; return GNSS_RESPONSE_OK;
} else { } else {
buffer[bytesRead] = '\0';
bytesRead++;
LOG_INFO("Bytes read:%s\n", (char*) buffer);
bytesRead = 0; bytesRead = 0;
} }
} }
} }
} }
buffer[bytesRead] = '\0';
bytesRead++;
LOG_INFO("Bytes read:%s\n", (char*) buffer);
return GNSS_RESPONSE_NONE; return GNSS_RESPONSE_NONE;
} }
@ -887,6 +893,7 @@ GnssModel_t GPS::probe(int serialSpeed)
#endif #endif
memset(&info, 0, sizeof(struct uBloxGnssModelInfo)); memset(&info, 0, sizeof(struct uBloxGnssModelInfo));
uint8_t buffer[768] = {0}; uint8_t buffer[768] = {0};
delay(100);
// Close all NMEA sentences , Only valid for MTK platform // Close all NMEA sentences , Only valid for MTK platform
_serial_gps->write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); _serial_gps->write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n");