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).