Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/helpers/sensors/NmeaGpsDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@
#endif
#endif

// Optional rates detect() tries after GPS_BAUD_RATE, for GPS modules whose baud rate is
// not known in advance (e.g. -D GPS_BAUD_PROBE_LIST=9600,115200,38400). Used by every
// NmeaGpsDriver that does not pass its own list.
#ifdef GPS_BAUD_PROBE_LIST
static const uint32_t NMEA_GPS_PROBE_BAUDS[] = { GPS_BAUD_PROBE_LIST };
#define GPS_PROBE_BAUDS NMEA_GPS_PROBE_BAUDS
#define GPS_PROBE_COUNT ((uint8_t)(sizeof(NMEA_GPS_PROBE_BAUDS) / sizeof(NMEA_GPS_PROBE_BAUDS[0])))
#else
#define GPS_PROBE_BAUDS nullptr
#define GPS_PROBE_COUNT 0
#endif

#ifndef PIN_GPS_SWITCH
#define PIN_GPS_SWITCH (-1)
#endif
Expand Down Expand Up @@ -199,7 +211,7 @@ class NmeaGpsDriver : public GpsDriver {
uint32_t baudRate = GPS_BAUD_RATE,
int hardwareEnablePin = PIN_GPS_SWITCH,
int hardwareEnableActive = GPS_SWITCH_ACTIVE,
const uint32_t* probeBauds = nullptr, uint8_t probeCount = 0)
const uint32_t* probeBauds = GPS_PROBE_BAUDS, uint8_t probeCount = GPS_PROBE_COUNT)
: _hardwareSerial(&serial), _peripheralPower(peripheralPower), _txPin(txPin), _rxPin(rxPin),
_resetPin(resetPin), _enablePin(enablePin), _enableActive(enableActive),
_resetActive(resetActive), _baudRate(baudRate),
Expand Down
7 changes: 1 addition & 6 deletions variants/promicro/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ VolatileRTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);
#if ENV_INCLUDE_GPS
#include <helpers/sensors/MicroNMEALocationProvider.h>
#ifdef GPS_BAUD_PROBE_LIST // e.g. -D GPS_BAUD_PROBE_LIST=9600,38400,115200
static const uint32_t gps_probe_bauds[] = { GPS_BAUD_PROBE_LIST };
NmeaGpsDriver gps_driver(Serial1, gps_probe_bauds, sizeof(gps_probe_bauds) / sizeof(gps_probe_bauds[0]));
#else
NmeaGpsDriver gps_driver(Serial1);
#endif
NmeaGpsDriver gps_driver(Serial1);
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
#else
Expand Down
1 change: 1 addition & 0 deletions variants/station_g2/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ build_flags =
-D PIN_USER_BTN=38
-D PIN_GPS_RX=15
-D PIN_GPS_TX=7
-D GPS_BAUD_PROBE_LIST=9600,115200,38400 ; Grove UART GPS units (e.g. M5Stack Unit GPS v1.1) default to 115200
-D SX126X_DIO2_AS_RF_SWITCH=true
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
-D SX126X_CURRENT_LIMIT=140
Expand Down
1 change: 1 addition & 0 deletions variants/station_g3_esp32/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ build_flags =
-D PIN_USER_BTN=38
-D PIN_GPS_RX=15
-D PIN_GPS_TX=7
-D GPS_BAUD_PROBE_LIST=9600,115200,38400 ; Grove UART GPS units (e.g. M5Stack Unit GPS v1.1) default to 115200
-D SX126X_DIO2_AS_RF_SWITCH=true
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
-D SX126X_CURRENT_LIMIT=140
Expand Down