rak4631: gps now works

This commit is contained in:
Kevin Hester
2021-04-11 15:17:56 +08:00
parent f7d199a3be
commit 7224782d23
5 changed files with 67 additions and 10 deletions

View File

@@ -7,7 +7,7 @@
#include <assert.h>
// If we have a serial GPS port it will not be null
#ifdef GPS_RX_PIN
#ifdef GPS_SERIAL_NUM
HardwareSerial _serial_gps_real(GPS_SERIAL_NUM);
HardwareSerial *GPS::_serial_gps = &_serial_gps_real;
#elif defined(NRF52840_XXAA) || defined(NRF52833_XXAA)
@@ -34,7 +34,8 @@ bool GPS::setupGPS()
if (_serial_gps && !didSerialInit) {
didSerialInit = true;
#ifdef GPS_RX_PIN
// ESP32 has a special set of parameters vs other arduino ports
#if defined(GPS_RX_PIN) && !defined(NO_ESP32)
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
#else
_serial_gps->begin(GPS_BAUDRATE);
@@ -319,8 +320,8 @@ int GPS::prepareDeepSleep(void *unused)
#include "NMEAGPS.h"
#endif
GPS* createGps() {
GPS *createGps()
{
#ifdef NO_GPS
return nullptr;
@@ -329,7 +330,7 @@ GPS* createGps() {
#ifdef GPS_TX_PIN
// Init GPS - first try ublox
UBloxGPS *ublox = new UBloxGPS();
if (!ublox->setup()) {
DEBUG_MSG("ERROR: No UBLOX GPS found\n");
delete ublox;
@@ -344,9 +345,9 @@ GPS* createGps() {
// assume NMEA at 9600 baud.
DEBUG_MSG("Hoping that NMEA might work\n");
#ifdef HAS_AIR530_GPS
GPS* new_gps = new Air530GPS();
GPS *new_gps = new Air530GPS();
#else
GPS* new_gps = new NMEAGPS();
GPS *new_gps = new NMEAGPS();
#endif
new_gps->setup();
return new_gps;

View File

@@ -427,8 +427,11 @@ void setup()
readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time)
#ifdef GENIEBLOCKS
// gps setup
pinMode(GPS_RESET_N, OUTPUT);
I'm intentionally breaking your build so you see this note. Feel free to revert if not correct. I think you can
removed this code by instead defining PIN_GPS_RESET and use the shared code in GPS.cpp instead.
// gps setup
pinMode(GPS_RESET_N, OUTPUT);
pinMode(GPS_EXTINT, OUTPUT);
digitalWrite(GPS_RESET_N, HIGH);
digitalWrite(GPS_EXTINT, LOW);