From 22ce208e6802635efe8b013d7d4dfb0256cf58e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=ADckolas=20Goline?= Date: Wed, 4 Nov 2026 13:36:33 -0300 Subject: [PATCH] muzi_base: fix GPS UART pins and re-enable ATGM336H NMEA output The refactor no longer calls Serial1.setPins() on nRF52, so Serial1 uses PIN_SERIAL1_RX/TX directly. Those were swapped (the GPS transmits on P0.20), so no data was received. Fix them and define PIN_GPS_TX/RX by the gps module's side, as other variants do. The ATGM336H keeps its NMEA output config across power cycles, and other firmware may leave every sentence disabled. Re-enable GGA + RMC after each power-up. --- variants/muzi_base/target.cpp | 12 ++++++++++++ variants/muzi_base/target.h | 4 ++++ variants/muzi_base/variant.h | 8 ++++---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/variants/muzi_base/target.cpp b/variants/muzi_base/target.cpp index b65bafa1d..6653ada19 100644 --- a/variants/muzi_base/target.cpp +++ b/variants/muzi_base/target.cpp @@ -50,6 +50,18 @@ void MuziBaseSensorManager::loop() { _pwr_last_click = t; if (++_pwr_clicks >= USER_BTN_POWER_OFF_CLICKS) muziPowerOff(); } +#if ENV_INCLUDE_GPS + // the ATGM336H keeps its nmea output config across power cycles (backup + // supply), and other firmware may have turned every sentence off. re-enable + // GGA + RMC after each power-up, once the module has booted. + bool gps_on = _location->isActive(); + if (gps_on && !_gps_was_active) _gps_cfg_at = millis() + 1000; + _gps_was_active = gps_on; + if (_gps_cfg_at && gps_on && (long)(millis() - _gps_cfg_at) > 0) { + _gps_cfg_at = 0; + _location->sendSentence("$PCAS03,1,0,0,0,1,0,0,0,0,0,,,0,0"); + } +#endif EnvironmentSensorManager::loop(); } diff --git a/variants/muzi_base/target.h b/variants/muzi_base/target.h index 3f7dcbf5f..0c143e1bc 100644 --- a/variants/muzi_base/target.h +++ b/variants/muzi_base/target.h @@ -42,6 +42,10 @@ extern AutoDiscoverRTCClock rtc_clock; class MuziBaseSensorManager : public EnvironmentSensorManager { unsigned long _pwr_last_click = 0; uint8_t _pwr_clicks = 0; +#if ENV_INCLUDE_GPS + unsigned long _gps_cfg_at = 0; + bool _gps_was_active = false; +#endif public: #if ENV_INCLUDE_GPS MuziBaseSensorManager(LocationProvider& location) : EnvironmentSensorManager(location) {} diff --git a/variants/muzi_base/variant.h b/variants/muzi_base/variant.h index 0c1245a89..d42804f68 100644 --- a/variants/muzi_base/variant.h +++ b/variants/muzi_base/variant.h @@ -54,8 +54,8 @@ static const uint8_t AREF = (PIN_AREF); // not used //////////////////////////////////////////////////////////////////////////////// // UART pin definition -#define PIN_SERIAL1_RX (19) // P0.19 used for GPS RX -#define PIN_SERIAL1_TX (20) // P0.20 used for GPS TX +#define PIN_SERIAL1_RX (20) // P0.20, data from the gps +#define PIN_SERIAL1_TX (19) // P0.19, data to the gps //////////////////////////////////////////////////////////////////////////////// // I2C pin definition @@ -153,8 +153,8 @@ static const uint8_t AREF = (PIN_AREF); // not used //////////////////////////////////////////////////////////////////////////////// // GPS #define HAS_GPS 1 -#define PIN_GPS_RX PIN_SERIAL1_RX -#define PIN_GPS_TX PIN_SERIAL1_TX +#define PIN_GPS_TX PIN_SERIAL1_RX // gps module's TX pin +#define PIN_GPS_RX PIN_SERIAL1_TX // gps module's RX pin #define PIN_GPS_EN (32+1) // P1.01 PWR_IO2 on schematic. gps power, driven by the sensor manager. // superIO 3-position mode switch (pins from the meshtastic muzi_base variant).