From 766287d3fddde8c49065534e069ad1261422e19b Mon Sep 17 00:00:00 2001 From: Mictronics Date: Tue, 16 Jan 2024 15:28:25 +0100 Subject: [PATCH] Use RP2040 SerialUART instead of Arduino HardwareSerial to access setFIFOSize. Increase FIFO size to 256 byte reading entire NMEA sentences at once. --- src/gps/GPS.cpp | 6 ++++-- src/gps/GPS.h | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index d6ffabc506..f2b6fc1d8c 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -16,9 +16,10 @@ #define GPS_RESET_MODE HIGH #endif -#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(aLinuxInputImpl) || \ - defined(RPI_PICO_WAVESHARE) +#if defined(NRF52840_XXAA) || defined(NRF52833_XXAA) || defined(ARCH_ESP32) || defined(aLinuxInputImpl) HardwareSerial *GPS::_serial_gps = &Serial1; +#elif defined(RPI_PICO_WAVESHARE) +SerialUART *GPS::_serial_gps = &Serial1; #else HardwareSerial *GPS::_serial_gps = NULL; #endif @@ -1022,6 +1023,7 @@ GPS *GPS::createGps() _serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, new_gps->rx_gpio, new_gps->tx_gpio); #else + _serial_gps->setFIFOSize(256); _serial_gps->begin(GPS_BAUDRATE); #endif diff --git a/src/gps/GPS.h b/src/gps/GPS.h index db20c4b685..13fd85f87e 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -93,8 +93,11 @@ class GPS : private concurrency::OSThread public: /** If !NULL we will use this serial port to construct our GPS */ +#if defined(RPI_PICO_WAVESHARE) + static SerialUART *_serial_gps; +#else static HardwareSerial *_serial_gps; - +#endif static uint8_t _message_PMREQ[]; static const uint8_t _message_CFG_RXM_PSM[]; static const uint8_t _message_CFG_RXM_ECO[];