diff --git a/src/configuration.h b/src/configuration.h index aad4ac457..6351c35b1 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -171,10 +171,6 @@ along with this program. If not, see . // ----------------------------------------------------------------------------- // GPS // ----------------------------------------------------------------------------- -#ifndef GPS_BAUDRATE -#define GPS_BAUDRATE 9600 -#endif - #ifndef GPS_THREAD_INTERVAL #define GPS_THREAD_INTERVAL 200 #endif @@ -185,6 +181,10 @@ along with this program. If not, see . /* Step #1: offer chance for variant-specific defines */ #include "variant.h" +#ifndef GPS_BAUDRATE +#define GPS_BAUDRATE 9600 +#endif + /* Step #2: follow with defines common to the architecture; also enable HAS_ option not specifically disabled by variant.h */ #include "architecture.h" @@ -313,4 +313,4 @@ along with this program. If not, see . #endif #include "DebugConfiguration.h" -#include "RF95Configuration.h" \ No newline at end of file +#include "RF95Configuration.h" diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 9628784d6..f04b45622 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -400,14 +400,14 @@ bool GPS::setup() int msglen = 0; if (!didSerialInit) { -#ifdef GNSS_Airoha // change by WayenWeng - if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) { - probe(GPS_BAUDRATE); - LOG_INFO("GPS setting to %d.\n", GPS_BAUDRATE); - } -#else -#if !defined(GPS_UC6580) + if (tx_gpio && gnssModel == GNSS_MODEL_UNKNOWN) { + + // if GPS_BAUDRATE is specified in variant (i.e. not 9600), skip to the specified rate. + if (speedSelect == 0 && GPS_BAUDRATE != serialSpeeds[speedSelect]) { + speedSelect = std::find(serialSpeeds, std::end(serialSpeeds), GPS_BAUDRATE) - serialSpeeds; + } + LOG_DEBUG("Probing for GPS at %d \n", serialSpeeds[speedSelect]); gnssModel = probe(serialSpeeds[speedSelect]); if (gnssModel == GNSS_MODEL_UNKNOWN) { @@ -423,9 +423,6 @@ bool GPS::setup() } else { gnssModel = GNSS_MODEL_UNKNOWN; } -#else - gnssModel = GNSS_MODEL_UC6580; -#endif if (gnssModel == GNSS_MODEL_MTK) { /* @@ -777,7 +774,6 @@ bool GPS::setup() LOG_INFO("GNSS module configuration saved!\n"); } } -#endif // !GNSS_Airoha didSerialInit = true; } @@ -1191,6 +1187,15 @@ GnssModel_t GPS::probe(int serialSpeed) _serial_gps->write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); delay(20); + // get version information from Unicore UFirebirdII Series + // Works for: UC6580, UM620, UM621, UM670A, UM680A, or UM681A + _serial_gps->write("$PDTINFO\r\n"); + delay(750); + if (getACK("UC6580", 500) == GNSS_RESPONSE_OK) { + LOG_INFO("UC6580 detected, using UC6580 Module\n"); + return GNSS_MODEL_UC6580; + } + // Get version information clearBuffer(); _serial_gps->write("$PCAS06,1*1A\r\n"); @@ -1398,13 +1403,6 @@ GPS *GPS::createGps() #else _serial_gps->begin(GPS_BAUDRATE); #endif - - /* - * T-Beam-S3-Core will be preset to use gps Probe here, and other boards will not be changed first - */ -#if defined(GPS_UC6580) - _serial_gps->updateBaudRate(115200); -#endif } return new_gps; } diff --git a/variants/heltec_wireless_tracker/variant.h b/variants/heltec_wireless_tracker/variant.h index f0ee0631d..685c9f079 100644 --- a/variants/heltec_wireless_tracker/variant.h +++ b/variants/heltec_wireless_tracker/variant.h @@ -52,6 +52,7 @@ #define GPS_RESET_MODE LOW #define GPS_UC6580 +#define GPS_BAUDRATE 115200 #define USE_SX1262 #define LORA_DIO0 -1 // a No connect on the SX1262 module diff --git a/variants/heltec_wireless_tracker_V1_0/variant.h b/variants/heltec_wireless_tracker_V1_0/variant.h index 1b4751a57..6b038dc28 100644 --- a/variants/heltec_wireless_tracker_V1_0/variant.h +++ b/variants/heltec_wireless_tracker_V1_0/variant.h @@ -49,6 +49,7 @@ #define GPS_RESET_MODE LOW #define GPS_UC6580 +#define GPS_BAUDRATE 11520 #define USE_SX1262 #define LORA_DIO0 -1 // a No connect on the SX1262 module diff --git a/variants/tracksenger/internal/variant.h b/variants/tracksenger/internal/variant.h index e63cecd7b..929c38793 100644 --- a/variants/tracksenger/internal/variant.h +++ b/variants/tracksenger/internal/variant.h @@ -48,6 +48,7 @@ #define GPS_RESET_MODE LOW #define GPS_UC6580 +#define GPS_BAUDRATE 115200 #define USE_SX1262 #define LORA_DIO0 -1 // a No connect on the SX1262 module @@ -87,4 +88,4 @@ { \ 26, 37, 17, 16, 15, 7 \ } -// #end keyboard \ No newline at end of file +// #end keyboard diff --git a/variants/tracksenger/lcd/variant.h b/variants/tracksenger/lcd/variant.h index 0f3423d52..3f952361b 100644 --- a/variants/tracksenger/lcd/variant.h +++ b/variants/tracksenger/lcd/variant.h @@ -72,6 +72,7 @@ #define GPS_RESET_MODE LOW #define GPS_UC6580 +#define GPS_BAUDRATE 115200 #define USE_SX1262 #define LORA_DIO0 -1 // a No connect on the SX1262 module @@ -111,4 +112,4 @@ { \ 26, 37, 17, 16, 15, 7 \ } -// #end keyboard \ No newline at end of file +// #end keyboard diff --git a/variants/tracksenger/oled/variant.h b/variants/tracksenger/oled/variant.h index d6bacf139..99f12bd23 100644 --- a/variants/tracksenger/oled/variant.h +++ b/variants/tracksenger/oled/variant.h @@ -50,6 +50,7 @@ #define GPS_RESET_MODE LOW #define GPS_UC6580 +#define GPS_BAUDRATE 115200 #define USE_SX1262 #define LORA_DIO0 -1 // a No connect on the SX1262 module @@ -89,4 +90,4 @@ { \ 26, 37, 17, 16, 15, 7 \ } -// #end keyboard \ No newline at end of file +// #end keyboard