From 3c8fd9e6e92d8344ea9191077cf0c9937f9b36fb Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Fri, 28 Nov 2025 16:21:04 -0600 Subject: [PATCH] GPS fix for M4 --- src/gps/GPS.cpp | 13 +++++-------- src/gps/GPS.h | 5 +++++ variants/nrf52840/ELECROW-ThinkNode-M4/variant.h | 10 ++++++---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index a61a71dde..16c7a3ca3 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -896,14 +896,11 @@ void GPS::writePinEN(bool on) void GPS::writePinStandby(bool standby) { #ifdef PIN_GPS_STANDBY // Specifically the standby pin for L76B, L76K and clones - -// Determine the new value for the pin -// Normally: active HIGH for awake -#ifdef PIN_GPS_STANDBY_INVERTED - bool val = standby; -#else - bool val = !standby; -#endif + bool val; + if (standby) + val = GPS_STANDBY_ACTIVE; + else + val = !GPS_STANDBY_ACTIVE; // Write and log pinMode(PIN_GPS_STANDBY, OUTPUT); diff --git a/src/gps/GPS.h b/src/gps/GPS.h index 59cee7113..fcbf361d5 100644 --- a/src/gps/GPS.h +++ b/src/gps/GPS.h @@ -16,6 +16,11 @@ #define GPS_EN_ACTIVE 1 #endif +// Allow defining the polarity of the STANDBY output. default is LOW for standby +#ifndef GPS_STANDBY_ACTIVE +#define GPS_STANDBY_ACTIVE LOW +#endif + static constexpr uint32_t GPS_UPDATE_ALWAYS_ON_THRESHOLD_MS = 10 * 1000UL; static constexpr uint32_t GPS_FIX_HOLD_MAX_MS = 20000; diff --git a/variants/nrf52840/ELECROW-ThinkNode-M4/variant.h b/variants/nrf52840/ELECROW-ThinkNode-M4/variant.h index 10fc8b360..1823f4c88 100644 --- a/variants/nrf52840/ELECROW-ThinkNode-M4/variant.h +++ b/variants/nrf52840/ELECROW-ThinkNode-M4/variant.h @@ -117,15 +117,17 @@ static const uint8_t A0 = PIN_A0; #define GPS_L76K #define GPS_BAUDRATE 9600 #define PIN_GPS_EN (32 + 11) -#define GPS_EN_ACTIVE 0 -#define PIN_GPS_REINIT (3) +#define GPS_EN_ACTIVE LOW +#define PIN_GPS_RESET (3) +#define GPS_RESET_MODE HIGH #define PIN_GPS_STANDBY (28) +#define GPS_STANDBY_ACTIVE HIGH #define GPS_TX_PIN (32 + 12) #define GPS_RX_PIN (32 + 14) #define GPS_THREAD_INTERVAL 50 -#define PIN_SERIAL1_RX GPS_TX_PIN -#define PIN_SERIAL1_TX GPS_RX_PIN +#define PIN_SERIAL1_RX GPS_RX_PIN +#define PIN_SERIAL1_TX GPS_TX_PIN #ifdef __cplusplus }