GPS fixes

Work aroung Serial reset issue on ESP32
Don't send unsupported command to G60xx GPS
This commit is contained in:
Jonathan Bennett 2023-09-04 14:18:27 -05:00
parent ffcb131171
commit e943fffe8c

View File

@ -60,11 +60,14 @@ GPS_RESPONSE GPS::getACK(const char *message, uint32_t waitMillis)
bytesRead++;
if ((bytesRead == 767) || (b == '\r')) {
if (strnstr((char *)buffer, message, bytesRead) != nullptr) {
#ifdef GPS_DEBUG
buffer[bytesRead] = '\0';
LOG_DEBUG("%s\r", (char *)buffer);
#endif
return GNSS_RESPONSE_OK;
} else {
#ifdef GPS_DEBUG
buffer[bytesRead] = '\0';
bytesRead++;
LOG_INFO("Bytes read:%s\n", (char *)buffer);
#endif
bytesRead = 0;
@ -74,7 +77,6 @@ GPS_RESPONSE GPS::getACK(const char *message, uint32_t waitMillis)
}
#ifdef GPS_DEBUG
buffer[bytesRead] = '\0';
bytesRead++;
LOG_INFO("Bytes read:%s\n", (char *)buffer);
#endif
return GNSS_RESPONSE_NONE;
@ -324,8 +326,9 @@ bool GPS::setupGPS()
// Also we need SBAS for better accuracy and extra features
// ToDo: Dynamic configure GNSS systems depending of LoRa region
if ((strncmp(info.hwVersion, "00070000", 8) == 0) || // Max7 seems to only support GPS *or* GLONASS
(strncmp(info.hwVersion, "00040007", 8) == 0)) {
if (strncmp(info.hwVersion, "00040007", 8) !=
0) { // The original ublox 6 is GPS only and doesn't support the UBX-CFG-GNSS message
if (strncmp(info.hwVersion, "00070000", 8) == 0) { // Max7 seems to only support GPS *or* GLONASS
LOG_DEBUG("Setting GPS+SBAS\n");
byte _message_GNSS[28] = {
0xb5, 0x62, // Sync message for UBX protocol
@ -379,9 +382,11 @@ bool GPS::setupGPS()
} else {
LOG_INFO("GNSS configured for GPS+SBAS+GLONASS. Pause for 0.75s before sending next command.\n");
}
// Documentation say, we need wait atleast 0.5s after reconfiguration of GNSS module, before sending next commands
// Documentation say, we need wait atleast 0.5s after reconfiguration of GNSS module, before sending next
// commands
delay(750);
}
}
// Enable interference resistance, because we are using LoRa, WiFi and Bluetooth on same board,
// and we need to reduce interference from them
@ -950,7 +955,15 @@ GnssModel_t GPS::probe(int serialSpeed)
_serial_gps->end();
_serial_gps->begin(serialSpeed);
#else
if (_serial_gps->baudRate() != serialSpeed) {
LOG_DEBUG("Setting Baud to %i\n", serialSpeed);
_serial_gps->updateBaudRate(serialSpeed);
}
#endif
#ifdef GPS_DEBUG
for (int i = 0; i < 20; i++) {
getACK("$GP", 200);
}
#endif
memset(&info, 0, sizeof(struct uBloxGnssModelInfo));
uint8_t buffer[768] = {0};