mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-24 17:32:18 +00:00
make GPS 'work' on nrf52
This commit is contained in:
parent
fbd12e1929
commit
2fdb75efdf
@ -82,6 +82,7 @@ upload_speed = 921600
|
|||||||
debug_init_break = tbreak setup
|
debug_init_break = tbreak setup
|
||||||
build_flags =
|
build_flags =
|
||||||
${env.build_flags} -Wall -Wextra
|
${env.build_flags} -Wall -Wextra
|
||||||
|
lib_ignore = segger_rtt
|
||||||
|
|
||||||
; The 1.0 release of the TBEAM board
|
; The 1.0 release of the TBEAM board
|
||||||
[env:tbeam]
|
[env:tbeam]
|
||||||
|
10
src/GPS.cpp
10
src/GPS.cpp
@ -9,7 +9,7 @@
|
|||||||
HardwareSerial _serial_gps(GPS_SERIAL_NUM);
|
HardwareSerial _serial_gps(GPS_SERIAL_NUM);
|
||||||
#else
|
#else
|
||||||
// Assume NRF52
|
// Assume NRF52
|
||||||
// Uart _serial_gps(GPS_SERIAL_NUM);
|
HardwareSerial &_serial_gps = Serial1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool timeSetFromGPS; // We try to set our time from GPS each time we wake from sleep
|
bool timeSetFromGPS; // We try to set our time from GPS each time we wake from sleep
|
||||||
@ -31,6 +31,9 @@ void GPS::setup()
|
|||||||
|
|
||||||
#ifdef GPS_RX_PIN
|
#ifdef GPS_RX_PIN
|
||||||
_serial_gps.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
|
_serial_gps.begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
|
||||||
|
#else
|
||||||
|
_serial_gps.begin(GPS_BAUDRATE);
|
||||||
|
#endif
|
||||||
// _serial_gps.setRxBufferSize(1024); // the default is 256
|
// _serial_gps.setRxBufferSize(1024); // the default is 256
|
||||||
// ublox.enableDebugging(Serial);
|
// ublox.enableDebugging(Serial);
|
||||||
|
|
||||||
@ -43,7 +46,7 @@ void GPS::setup()
|
|||||||
isConnected = ublox.begin(_serial_gps);
|
isConnected = ublox.begin(_serial_gps);
|
||||||
|
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
DEBUG_MSG("Connected to GPS successfully, TXpin=%d\n", GPS_TX_PIN);
|
DEBUG_MSG("Connected to GPS successfully\n");
|
||||||
|
|
||||||
bool factoryReset = false;
|
bool factoryReset = false;
|
||||||
bool ok;
|
bool ok;
|
||||||
@ -81,7 +84,6 @@ void GPS::setup()
|
|||||||
// checkUblox cyclically)
|
// checkUblox cyclically)
|
||||||
ublox.assumeAutoPVT(true, true);
|
ublox.assumeAutoPVT(true, true);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPS::readFromRTC()
|
void GPS::readFromRTC()
|
||||||
@ -145,7 +147,6 @@ void GPS::prepareSleep()
|
|||||||
|
|
||||||
void GPS::doTask()
|
void GPS::doTask()
|
||||||
{
|
{
|
||||||
#ifdef GPS_RX_PIN
|
|
||||||
uint8_t fixtype = 3; // If we are only using the RX pin, assume we have a 3d fix
|
uint8_t fixtype = 3; // If we are only using the RX pin, assume we have a 3d fix
|
||||||
|
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
@ -207,7 +208,6 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
|
|||||||
}
|
}
|
||||||
} else // we didn't get a location update, go back to sleep and hope the characters show up
|
} else // we didn't get a location update, go back to sleep and hope the characters show up
|
||||||
wantNewLocation = true;
|
wantNewLocation = true;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Once we have sent a location once we only poll the GPS rarely, otherwise check back every 1s until we have something over
|
// Once we have sent a location once we only poll the GPS rarely, otherwise check back every 1s until we have something over
|
||||||
// the serial
|
// the serial
|
||||||
|
@ -54,24 +54,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define xstr(s) str(s)
|
#define xstr(s) str(s)
|
||||||
#define str(s) #s
|
#define str(s) #s
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// DEBUG
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
|
||||||
#define USE_SEGGER
|
|
||||||
#endif
|
|
||||||
#ifdef USE_SEGGER
|
|
||||||
#include "SEGGER_RTT.h"
|
|
||||||
#define DEBUG_MSG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#ifdef DEBUG_PORT
|
|
||||||
#define DEBUG_MSG(...) DEBUG_PORT.printf(__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define DEBUG_MSG(...)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// OLED
|
// OLED
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -217,7 +199,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#define NO_ESP32 // Don't use ESP32 libs (mainly bluetooth)
|
#define NO_ESP32 // Don't use ESP32 libs (mainly bluetooth)
|
||||||
|
|
||||||
// Turn off GPS code for now
|
// We bind to the GPS using variant.h instead for this platform (Serial1)
|
||||||
#undef GPS_RX_PIN
|
#undef GPS_RX_PIN
|
||||||
#undef GPS_TX_PIN
|
#undef GPS_TX_PIN
|
||||||
|
|
||||||
@ -233,6 +215,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// DEBUG
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#ifdef NO_ESP32
|
||||||
|
#define USE_SEGGER
|
||||||
|
#endif
|
||||||
|
#ifdef USE_SEGGER
|
||||||
|
#include "SEGGER_RTT.h"
|
||||||
|
#define DEBUG_MSG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#ifdef DEBUG_PORT
|
||||||
|
#define DEBUG_MSG(...) DEBUG_PORT.printf(__VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define DEBUG_MSG(...)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// AXP192 (Rev1-specific options)
|
// AXP192 (Rev1-specific options)
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -402,7 +402,7 @@ void _screen_header()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Screen::Screen(uint8_t address, uint8_t sda, uint8_t scl) : cmdQueue(32), dispdev(address, sda, scl), ui(&dispdev) {}
|
Screen::Screen(uint8_t address, int sda, int scl) : cmdQueue(32), dispdev(address, sda, scl), ui(&dispdev) {}
|
||||||
|
|
||||||
void Screen::handleSetOn(bool on)
|
void Screen::handleSetOn(bool on)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ class DebugInfo
|
|||||||
class Screen : public PeriodicTask
|
class Screen : public PeriodicTask
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Screen(uint8_t address, uint8_t sda = 0, uint8_t scl = 0);
|
Screen(uint8_t address, int sda = -1, int scl = -1);
|
||||||
|
|
||||||
Screen(const Screen &) = delete;
|
Screen(const Screen &) = delete;
|
||||||
Screen &operator=(const Screen &) = delete;
|
Screen &operator=(const Screen &) = delete;
|
||||||
|
Loading…
Reference in New Issue
Block a user