Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions variants/lilygo_techo_card/TechoCardBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down
5 changes: 4 additions & 1 deletion variants/lilygo_techo_card/TechoCardBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <MeshCore.h>
#include <Arduino.h>
#include <helpers/NRF52Board.h>
#include <helpers/RefCountedDigitalPin.h>
#include <Adafruit_NeoPixel.h>

// built-ins
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion variants/lilygo_techo_card/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ VolatileRTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);

#ifdef ENV_INCLUDE_GPS
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN, &board.gps_rf_power);
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
#else
EnvironmentSensorManager sensors = EnvironmentSensorManager();
Expand Down
6 changes: 3 additions & 3 deletions variants/lilygo_techo_card/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 6 additions & 3 deletions variants/lilygo_techo_card/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down