Setting GPS after restart
parent
c702f17736
commit
a9cbffb4d5
|
@ -29,6 +29,7 @@ lib_deps =
|
||||||
Adafruit GFX Library
|
Adafruit GFX Library
|
||||||
Adafruit Unified Sensor
|
Adafruit Unified Sensor
|
||||||
AXP202X_Library
|
AXP202X_Library
|
||||||
|
SparkFun u-blox Arduino Library
|
||||||
|
|
||||||
[env:ttgo-t-beam-v1.0]
|
[env:ttgo-t-beam-v1.0]
|
||||||
board = ttgo-t-beam
|
board = ttgo-t-beam
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <taskGPS.h>
|
#include <taskGPS.h>
|
||||||
#include "TTGO_T-Beam_LoRa_APRS_config.h"
|
#include "TTGO_T-Beam_LoRa_APRS_config.h"
|
||||||
|
#include <SparkFun_Ublox_Arduino_Library.h>
|
||||||
|
|
||||||
|
SFE_UBLOX_GPS myGPS;
|
||||||
|
|
||||||
// Pins for GPS
|
// Pins for GPS
|
||||||
#ifdef T_BEAM_V1_0
|
#ifdef T_BEAM_V1_0
|
||||||
|
@ -15,7 +18,24 @@ bool gpsInitialized = false;
|
||||||
void taskGPS(void *parameter) {
|
void taskGPS(void *parameter) {
|
||||||
if (!gpsInitialized){
|
if (!gpsInitialized){
|
||||||
gpsSerial.begin(GPSBaud, SERIAL_8N1, TXPin, RXPin); //Startup HW serial for GPS
|
gpsSerial.begin(GPSBaud, SERIAL_8N1, TXPin, RXPin); //Startup HW serial for GPS
|
||||||
|
|
||||||
|
// set GPS parameters on restart
|
||||||
|
// Thanks Peter (https://github.com/peterus)
|
||||||
|
// https://github.com/lora-aprs/TTGO-T-Beam_GPS-reset
|
||||||
|
if(myGPS.begin(gpsSerial)){
|
||||||
|
myGPS.setUART1Output(COM_TYPE_NMEA); //Set the UART port to output NMEA only
|
||||||
|
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
|
myGPS.disableNMEAMessage(UBX_NMEA_GLL, COM_PORT_UART1);
|
||||||
|
myGPS.disableNMEAMessage(UBX_NMEA_GSA, COM_PORT_UART1);
|
||||||
|
myGPS.disableNMEAMessage(UBX_NMEA_GSV, COM_PORT_UART1);
|
||||||
|
myGPS.disableNMEAMessage(UBX_NMEA_VTG, COM_PORT_UART1);
|
||||||
|
myGPS.disableNMEAMessage(UBX_NMEA_RMC, COM_PORT_UART1);
|
||||||
|
myGPS.enableNMEAMessage(UBX_NMEA_GGA, COM_PORT_UART1);
|
||||||
|
myGPS.saveConfiguration(); //Save the current settings to flash and BBR
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
while (gpsSerial.available() > 0) {
|
while (gpsSerial.available() > 0) {
|
||||||
gps.encode(gpsSerial.read());
|
gps.encode(gpsSerial.read());
|
||||||
|
|
Loading…
Reference in New Issue