T-Echo Card: switch GPS LNA with GPS power, enable L76K config

- GPS_RF_EN (P0.29) drives the GNSS antenna LNA. It was set HIGH in
  initVariant() and never released, so the LNA stayed powered while GPS
  was off. It is now a RefCountedDigitalPin on TechoCardBoard, passed to
  NmeaGpsDriver as peripheral power: claimed when the driver starts the
  GPS, released when it stops it (same pattern as heltec_tracker).
- Rename PIN_GPS_STANDBY to PIN_GPS_RF_EN to match LilyGo's pin name.
- Define GPS_L76K so the driver applies $PCAS04,7 (GPS+BDS+GLONASS)
  after each reset.

LilyGo's reference firmware (T-Echo-Card examples/original_test) turns
the GPS on/off by driving GPS_WAKE_UP and GPS_RF_EN together.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rc3a98a3t3ZankTSKCxwjP
This commit is contained in:
ktobias-devandClaude Opus 5.5 committed 2026-11-22 15:29:24 -06:00
1 parent ae283810e1
commit efc05eaffa
5 files changed
+16 -8

No files matched your search

@@ -20,6 +20,7 @@ Adafruit_NeoPixel *Led[] =
void TechoCardBoard::begin() {
NRF52BoardDCDC::begin();
gps_rf_power.begin(); // LNA stays off until the GPS is started
Wire.begin();
for (uint8_t i = 0; i < sizeof(Led) / sizeof(Led[0]); i++)
+4 -1
View File
@@ -3,6 +3,7 @@
#include <MeshCore.h>
#include <Arduino.h>
#include <helpers/NRF52Board.h>
#include <helpers/RefCountedDigitalPin.h>
#include <Adafruit_NeoPixel.h>
// built-ins
@@ -17,7 +18,9 @@
class TechoCardBoard : public NRF52BoardDCDC {
bool _torchStatus = false;
public:
TechoCardBoard() : NRF52Board("TECHO_OTA") {}
RefCountedDigitalPin gps_rf_power; // GPS antenna LNA, claimed while the GPS is running
TechoCardBoard() : NRF52Board("TECHO_OTA"), gps_rf_power(PIN_GPS_RF_EN, HIGH) {}
void begin();
uint16_t getBattMilliVolts() override;
void onBeforeTransmit(void) override;
+2 -1
View File
@@ -13,7 +13,8 @@ VolatileRTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);
#ifdef ENV_INCLUDE_GPS
NmeaGpsDriver gps_driver(Serial1);
// GPS_RF_EN (antenna LNA) is claimed while the GPS runs and released when it stops
NmeaGpsDriver gps_driver(Serial1, PIN_GPS_TX, PIN_GPS_RX, GPS_RESET, GPS_EN, &board.gps_rf_power);
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
#else
+3 -3
View File
@@ -34,9 +34,9 @@ void initVariant() {
pinMode(SPEAKER_EN_2, OUTPUT);
digitalWrite(SPEAKER_EN_2, LOW);
// gps
pinMode(PIN_GPS_STANDBY, OUTPUT);
digitalWrite(PIN_GPS_STANDBY, HIGH);
// gps - PIN_GPS_RF_EN (LNA) is switched by TechoCardBoard::gps_rf_power
pinMode(PIN_GPS_RF_EN, OUTPUT);
digitalWrite(PIN_GPS_RF_EN, LOW);
pinMode(PIN_GPS_EN, OUTPUT);
digitalWrite(PIN_GPS_EN, HIGH);
pinMode(PIN_GPS_RESET, OUTPUT);
+6 -3
View File
@@ -113,15 +113,18 @@
////////////////////////////////////////////////////////////////////////////////
// GPS
// NOTE: these pins are defined differently to how lilygo does them but they
// seem to work properly for how EnvironmentSensorManager operates.
// NOTE: these pins are named differently to how lilygo does them but they
// work properly for how EnvironmentSensorManager operates. LilyGo's own
// examples switch the GPS on/off by driving GPS_WAKE_UP and GPS_RF_EN together.
// TODO: MAYBE? migrate to board based sensor manager / add GPS_WAKE_UP to ESM
#define GPS_L76K // Quectel L76K: applies GPS+BDS+GLONASS config on start
#define PIN_GPS_RX (21) // GPS_UART_RX in lilygo pin defs
#define PIN_GPS_TX (19) // GPS_UART_TX in lilygo pin defs
#define PIN_GPS_EN (25) // GPS_WAKE_UP in lilygo pin defs
#define PIN_GPS_RESET (47) // GPS_EN in lilygo pin defs
#define PIN_GPS_STANDBY (29) // GPS_RF_EN in lilygo pin defs
#define PIN_GPS_RF_EN (29) // GPS_RF_EN in lilygo pin defs (antenna LNA), follows GPS on/off
#define PIN_GPS_PPS (23) // GPS_1PPS in lilygo pin defs
// buzzer - enabled in platformio.ini so it can be easily turned off if not wanted.