Update example.

This commit is contained in:
lewisxhe
2024-08-15 11:46:53 +08:00
parent f52beba4c7
commit 91d6e7fc33
2 changed files with 14 additions and 3 deletions
+6 -1
View File
@@ -22,6 +22,11 @@
TinyGPSPlus gps; TinyGPSPlus gps;
// L76K GPS USE 9600 BAUDRATE
#define GPS_BAUD 9600
// M10Q GPS USE 38400 BAUDRATE
// #define GPS_BAUD 38400
void setup() void setup()
{ {
@@ -32,7 +37,7 @@ void setup()
digitalWrite(BOARD_POWERON, HIGH); digitalWrite(BOARD_POWERON, HIGH);
//GPS Serial port //GPS Serial port
SerialGPS.begin(38400, SERIAL_8N1, BOARD_GPS_RX_PIN, BOARD_GPS_TX_PIN); SerialGPS.begin(GPS_BAUD, SERIAL_8N1, BOARD_GPS_RX_PIN, BOARD_GPS_TX_PIN);
Serial.println("This sketch only applies to boards carrying GPS shields, the default is T-Deck"); Serial.println("This sketch only applies to boards carrying GPS shields, the default is T-Deck");
+8 -2
View File
@@ -48,6 +48,11 @@
#endif #endif
// L76K GPS USE 9600 BAUDRATE
#define GPS_BAUD 9600
// M10Q GPS USE 38400 BAUDRATE
// #define GPS_BAUD 38400
typedef struct { typedef struct {
uint8_t cmd; uint8_t cmd;
@@ -411,7 +416,7 @@ void loopGPS()
} }
while (SerialGPS.available()) { while (SerialGPS.available()) {
int c = SerialGPS.read(); int c = SerialGPS.read();
// Serial.write(c); Serial.write(c);
gps.encode(c); gps.encode(c);
} }
@@ -1086,7 +1091,8 @@ void setup()
tft.setRotation( 1 ); tft.setRotation( 1 );
tft.fillScreen(TFT_BLACK); tft.fillScreen(TFT_BLACK);
SerialGPS.begin(38400, SERIAL_8N1, BOARD_GPS_RX_PIN, BOARD_GPS_TX_PIN);
SerialGPS.begin(GPS_BAUD, SERIAL_8N1, BOARD_GPS_RX_PIN, BOARD_GPS_TX_PIN);
Wire.begin(BOARD_I2C_SDA, BOARD_I2C_SCL); Wire.begin(BOARD_I2C_SDA, BOARD_I2C_SCL);