|
@@ -319,39 +319,50 @@ void gps_initialize(void) {
|
|
|
* PMTK353: set gnss search mode (GPS/Galileo/Glonass/Beidou)
|
|
|
* PMTK313: enable SBAS
|
|
|
*/
|
|
|
- if (!System.gps_initialized)
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK355*31\r\n"));
|
|
|
- if (get_flag(CONFFLAG_ENABLE_SBAS))
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK313,1*2E\r\n"));
|
|
|
- else
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK313,0*2F\r\n"));
|
|
|
- if (!System.gps_only) {
|
|
|
- switch (System.conf.gnss_mode) {
|
|
|
- default:
|
|
|
- case GNSS_MODE_GPS_GLONASS_GALILEO:
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,1,1,0,0*2A\r\n"));
|
|
|
- break;
|
|
|
- case GNSS_MODE_GPS:
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,0,0,0*2A\r\n"));
|
|
|
- break;
|
|
|
- case GNSS_MODE_GPS_GALILEO:
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,1,0,0*2B\r\n"));
|
|
|
- break;
|
|
|
- case GNSS_MODE_GALILEO:
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK353,0,0,1,0,0*2A\r\n"));
|
|
|
- break;
|
|
|
- case GNSS_MODE_GPS_BEIDOU:
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,0,0,1*2B\r\n"));
|
|
|
- break;
|
|
|
- case GNSS_MODE_BEIDOU:
|
|
|
- xfprintf(uart0_put_wrap, PSTR("$PMTK353,0,0,0,0,1*2A\r\n"));
|
|
|
- break;
|
|
|
- }
|
|
|
- } else {
|
|
|
- System.conf.gnss_mode = GNSS_MODE_GPS;
|
|
|
+ switch (System.gps_initialized) {
|
|
|
+ case GPS_INIT_NOT_INITIALIZED:
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK355*31\r\n"));
|
|
|
+ xputs_P(PSTR("GNSS mode query sent\r\n"));
|
|
|
+ System.gps_initialized = GPS_INIT_QUERY_SENT;
|
|
|
+ break;
|
|
|
+ case GPS_INIT_QUERY_SENT:
|
|
|
+ if (get_flag(CONFFLAG_ENABLE_SBAS)) {
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK313,1*2E\r\n"));
|
|
|
+ xputs_P(PSTR("SBAS enable sent\r\n"));
|
|
|
+ } else {
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK313,0*2F\r\n"));
|
|
|
+ xputs_P(PSTR("SBAS disable sent\r\n"));
|
|
|
+ }
|
|
|
+ if (!System.gps_only) {
|
|
|
+ switch (System.conf.gnss_mode) {
|
|
|
+ default:
|
|
|
+ case GNSS_MODE_GPS_GLONASS_GALILEO:
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,1,1,0,0*2A\r\n"));
|
|
|
+ break;
|
|
|
+ case GNSS_MODE_GPS:
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,0,0,0*2A\r\n"));
|
|
|
+ break;
|
|
|
+ case GNSS_MODE_GPS_GALILEO:
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,1,0,0*2B\r\n"));
|
|
|
+ break;
|
|
|
+ case GNSS_MODE_GALILEO:
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK353,0,0,1,0,0*2A\r\n"));
|
|
|
+ break;
|
|
|
+ case GNSS_MODE_GPS_BEIDOU:
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,0,0,1*2B\r\n"));
|
|
|
+ break;
|
|
|
+ case GNSS_MODE_BEIDOU:
|
|
|
+ xfprintf(uart0_put_wrap, PSTR("$PMTK353,0,0,0,0,1*2A\r\n"));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ xputs_P(PSTR("GNSS mode setting sent\r\n"));
|
|
|
+ } else {
|
|
|
+ System.conf.gnss_mode = GNSS_MODE_GPS;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
- xputs_P(PSTR("GPS init sent\r\n"));
|
|
|
- System.gps_initialized = 1;
|
|
|
}
|
|
|
|
|
|
void check_min_sat_limit(void) {
|