From ca45888f3e729f7681f09dac27816f00fbdcb23b Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 30 Jan 2024 14:06:47 +0100 Subject: [PATCH] feat(variants): Add support for TXCO on TLORA_V2_1_6 devices (#3124) * feat(variants): Add support for TXCO on TLORA_V2_1_6 devices * chore: remove long comment * feat(variants): Add tlora-v2-1-1_6-tcxo to build matrix * feat(variants): Use RADIOLIB_NC as DIO1 pin for tlora_v2_1_16 with TXCO * Use generic naming scheme, add variant to build envs --------- Co-authored-by: Ben Meadors Co-authored-by: code8buster <20384924+code8buster@users.noreply.github.com> --- .github/workflows/main_matrix.yml | 1 + platformio.ini | 1 + src/main.cpp | 5 +++++ variants/tlora_v2_1_16/variant.h | 8 ++++++++ variants/tlora_v2_1_16_tcxo/platformio.ini | 9 +++++++++ 5 files changed, 24 insertions(+) create mode 100644 variants/tlora_v2_1_16_tcxo/platformio.ini diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 76f9841e9..af40d95b6 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -64,6 +64,7 @@ jobs: - board: tlora-v1 - board: tlora_v1_3 - board: tlora-v2-1-1_6 + - board: tlora-v2-1-1_6-tcxo - board: tlora-v2-1-1_8 - board: tbeam - board: heltec-ht62-esp32c3-sx1262 diff --git a/platformio.ini b/platformio.ini index fbd1d6a74..51106cdac 100644 --- a/platformio.ini +++ b/platformio.ini @@ -15,6 +15,7 @@ default_envs = tbeam ;default_envs = tlora_v1_3 ;default_envs = tlora-v2 ;default_envs = tlora-v2-1-1_6 +;default_envs = tlora-v2-1-1_6-tcxo ;default_envs = tlora-t3s3-v1 ;default_envs = lora-relay-v1 # nrf board ;default_envs = t-echo diff --git a/src/main.cpp b/src/main.cpp index 84419c70c..f853dc0ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -248,6 +248,11 @@ void setup() digitalWrite(PIN_EINK_PWR_ON, HIGH); #endif +#if defined(LORA_TCXO_GPIO) + pinMode(LORA_TCXO_GPIO, OUTPUT); + digitalWrite(LORA_TCXO_GPIO, HIGH); +#endif + #ifdef ST7735_BL_V03 // Heltec Wireless Tracker PCB Change Detect/Hack rtc_clk_32k_enable(true); diff --git a/variants/tlora_v2_1_16/variant.h b/variants/tlora_v2_1_16/variant.h index b8c43e557..8bb5ce3b1 100644 --- a/variants/tlora_v2_1_16/variant.h +++ b/variants/tlora_v2_1_16/variant.h @@ -16,5 +16,13 @@ #define USE_RF95 #define LORA_DIO0 26 // a No connect on the SX1262 module #define LORA_RESET 23 + +// In the T3 V1.6.1 TXCO version, GPIO 33 is connected to Radio’s +// internal temperature-compensated crystal oscillator enable +#ifdef LORA_TCXO_GPIO +#define LORA_DIO1 RADIOLIB_NC // no-connect on sx127x module +#else #define LORA_DIO1 33 // https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436 +#endif + #define LORA_DIO2 32 // Not really used \ No newline at end of file diff --git a/variants/tlora_v2_1_16_tcxo/platformio.ini b/variants/tlora_v2_1_16_tcxo/platformio.ini new file mode 100644 index 000000000..e54c1a920 --- /dev/null +++ b/variants/tlora_v2_1_16_tcxo/platformio.ini @@ -0,0 +1,9 @@ +[env:tlora-v2-1-1_6-tcxo] +extends = esp32_base +board = ttgo-lora32-v21 +build_flags = + ${esp32_base.build_flags} + -D TLORA_V2_1_16 + -I variants/tlora_v2_1_16 + -D GPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely. + -D LORA_TCXO_GPIO=33 \ No newline at end of file