mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 06:32:06 +00:00
Try GPS_BAUDRATE first, not only.
This commit is contained in:
parent
2954095f3d
commit
1d804f5a01
@ -426,19 +426,7 @@ bool GPS::setup()
|
|||||||
if (!didSerialInit) {
|
if (!didSerialInit) {
|
||||||
int msglen = 0;
|
int msglen = 0;
|
||||||
if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) {
|
if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||||
|
if (probeTries < 2) {
|
||||||
// if GPS_BAUDRATE is specified in variant, skip to the specified rate.
|
|
||||||
if (GPS_BAUDRATE_FIXED) {
|
|
||||||
gnssModel = probe(GPS_BAUDRATE);
|
|
||||||
if (gnssModel == GNSS_MODEL_UNKNOWN && probeTries == 1) {
|
|
||||||
LOG_WARN("GPS probe failed, setting to %d", GPS_BAUDRATE);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
++probeTries;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (probeTries == 0) {
|
|
||||||
LOG_DEBUG("Probing for GPS at %d", serialSpeeds[speedSelect]);
|
LOG_DEBUG("Probing for GPS at %d", serialSpeeds[speedSelect]);
|
||||||
gnssModel = probe(serialSpeeds[speedSelect]);
|
gnssModel = probe(serialSpeeds[speedSelect]);
|
||||||
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||||
@ -449,7 +437,7 @@ bool GPS::setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Rare Serial Speeds
|
// Rare Serial Speeds
|
||||||
if (probeTries == 1) {
|
if (probeTries == 2) {
|
||||||
LOG_DEBUG("Probing for GPS at %d", rareSerialSpeeds[speedSelect]);
|
LOG_DEBUG("Probing for GPS at %d", rareSerialSpeeds[speedSelect]);
|
||||||
gnssModel = probe(rareSerialSpeeds[speedSelect]);
|
gnssModel = probe(rareSerialSpeeds[speedSelect]);
|
||||||
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
if (gnssModel == GNSS_MODEL_UNKNOWN) {
|
||||||
@ -460,7 +448,7 @@ bool GPS::setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
gnssModel = GNSS_MODEL_UNKNOWN;
|
gnssModel = GNSS_MODEL_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,12 @@ class GPS : private concurrency::OSThread
|
|||||||
uint8_t fixType = 0; // fix type from GPGSA
|
uint8_t fixType = 0; // fix type from GPGSA
|
||||||
#endif
|
#endif
|
||||||
private:
|
private:
|
||||||
|
#if GPS_BAUDRATE_FIXED
|
||||||
|
// if GPS_BAUDRATE is specified in variant, try that first.
|
||||||
|
const int serialSpeeds[4] = {GPS_BAUDRATE, 9600, 115200, 38400};
|
||||||
|
#else
|
||||||
const int serialSpeeds[3] = {9600, 115200, 38400};
|
const int serialSpeeds[3] = {9600, 115200, 38400};
|
||||||
|
#endif
|
||||||
const int rareSerialSpeeds[3] = {4800, 57600, GPS_BAUDRATE};
|
const int rareSerialSpeeds[3] = {4800, 57600, GPS_BAUDRATE};
|
||||||
|
|
||||||
uint32_t lastWakeStartMsec = 0, lastSleepStartMsec = 0, lastFixStartMsec = 0;
|
uint32_t lastWakeStartMsec = 0, lastSleepStartMsec = 0, lastFixStartMsec = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user