From 8443214730fc1f51a190f1d4dc2e22e591cb7e7c Mon Sep 17 00:00:00 2001 From: sgrimee Date: Mon, 1 Dec 2025 19:31:13 +0100 Subject: [PATCH 1/3] lilygo_tlora_v1_6_1_tcxo: initial port --- .../LilyGoTLoraTCXOBoard.h | 22 ++++ .../lilygo_tlora_v1_6_1_tcxo/platformio.ini | 114 ++++++++++++++++++ variants/lilygo_tlora_v1_6_1_tcxo/target.cpp | 57 +++++++++ variants/lilygo_tlora_v1_6_1_tcxo/target.h | 29 +++++ 4 files changed, 222 insertions(+) create mode 100644 variants/lilygo_tlora_v1_6_1_tcxo/LilyGoTLoraTCXOBoard.h create mode 100644 variants/lilygo_tlora_v1_6_1_tcxo/platformio.ini create mode 100644 variants/lilygo_tlora_v1_6_1_tcxo/target.cpp create mode 100644 variants/lilygo_tlora_v1_6_1_tcxo/target.h diff --git a/variants/lilygo_tlora_v1_6_1_tcxo/LilyGoTLoraTCXOBoard.h b/variants/lilygo_tlora_v1_6_1_tcxo/LilyGoTLoraTCXOBoard.h new file mode 100644 index 000000000..bc695cc3b --- /dev/null +++ b/variants/lilygo_tlora_v1_6_1_tcxo/LilyGoTLoraTCXOBoard.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +// LILYGO T-LoRa V1.6.1 board with SX1276 and TCXO +class LilyGoTLoraTCXOBoard : public ESP32Board { +public: + const char *getManufacturerName() const override { return "LILYGO T-LoRa V1.6.1 TCXO"; } + + uint16_t getBattMilliVolts() override { + analogReadResolution(12); + + uint32_t raw = 0; + for (int i = 0; i < 8; i++) { + raw += analogReadMilliVolts(PIN_VBAT_READ); + } + raw = raw / 8; + + return (2 * raw); + } +}; diff --git a/variants/lilygo_tlora_v1_6_1_tcxo/platformio.ini b/variants/lilygo_tlora_v1_6_1_tcxo/platformio.ini new file mode 100644 index 000000000..ca0d14f5d --- /dev/null +++ b/variants/lilygo_tlora_v1_6_1_tcxo/platformio.ini @@ -0,0 +1,114 @@ +[LilyGo_TLora_V1_6_1_TCXO] +extends = esp32_base +board = ttgo-lora32-v1 ; LILYGO T-LoRa V1.6.1 ESP32 with SX1276 and TCXO +build_unflags = -Os +build_type = release +board_build.partitions = min_spiffs.csv +build_flags = + ${esp32_base.build_flags} + ${sensor_base.build_flags} + -UENV_INCLUDE_GPS + -I variants/lilygo_tlora_v1_6_1_tcxo + -Os -ffunction-sections -fdata-sections + -D LILYGO_TLORA_TCXO + -D P_LORA_DIO_0=26 + -D P_LORA_DIO_1=RADIOLIB_NC ; TCXO variant uses NC for DIO1 + -D P_LORA_NSS=18 + -D P_LORA_RESET=23 + -D P_LORA_TCXO_EN=33 ; TCXO enable pin (required for this variant) + -D P_LORA_SCLK=5 + -D P_LORA_MISO=19 + -D P_LORA_MOSI=27 + -D P_LORA_TX_LED=2 + -D PIN_BOARD_SDA=21 + -D PIN_BOARD_SCL=22 + -D PIN_VBAT_READ=35 + -D PIN_USER_BTN=0 + -D ARDUINO_LOOP_STACK_SIZE=16384 + -D DISPLAY_CLASS=SSD1306Display + -D RADIO_CLASS=CustomSX1276 + -D WRAPPER_CLASS=CustomSX1276Wrapper + -D SX127X_CURRENT_LIMIT=120 + -D LORA_TX_POWER=20 +build_src_filter = ${esp32_base.build_src_filter} + + + +<../variants/lilygo_tlora_v1_6_1_tcxo> + + +lib_deps = + ${esp32_base.lib_deps} + ${sensor_base.lib_deps} + +; === LILYGO T-LoRa V1.6.1 TCXO with SX1276 environments === +[env:LilyGo_TLora_V1_6_1_TCXO_companion_radio_ble] +extends = LilyGo_TLora_V1_6_1_TCXO +build_flags = + ${LilyGo_TLora_V1_6_1_TCXO.build_flags} + -I examples/companion_radio/ui-new + -D MAX_CONTACTS=160 + -D MAX_GROUP_CHANNELS=8 + -D BLE_PIN_CODE=123456 + -D OFFLINE_QUEUE_SIZE=256 + -D BLE_DEBUG_LOGGING=1 + -D MESH_PACKET_LOGGING=1 + -D MESH_DEBUG=1 +build_src_filter = ${LilyGo_TLora_V1_6_1_TCXO.build_src_filter} + + + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> +lib_deps = + ${LilyGo_TLora_V1_6_1_TCXO.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:LilyGo_TLora_V1_6_1_TCXO_companion_radio_usb] +extends = LilyGo_TLora_V1_6_1_TCXO +build_flags = + ${LilyGo_TLora_V1_6_1_TCXO.build_flags} + -I examples/companion_radio/ui-new + -D MAX_CONTACTS=160 + -D MAX_GROUP_CHANNELS=8 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${LilyGo_TLora_V1_6_1_TCXO.build_src_filter} + + + +<../examples/companion_radio/*.cpp> + +<../examples/companion_radio/ui-new/*.cpp> +lib_deps = + ${LilyGo_TLora_V1_6_1_TCXO.lib_deps} + densaugeo/base64 @ ~1.4.0 + +[env:LilyGo_TLora_V1_6_1_TCXO_repeater] +extends = LilyGo_TLora_V1_6_1_TCXO +build_src_filter = ${LilyGo_TLora_V1_6_1_TCXO.build_src_filter} + +<../examples/simple_repeater> +build_flags = + ${LilyGo_TLora_V1_6_1_TCXO.build_flags} + -D ADVERT_NAME='"TLora-V1.6.1-TCXO Repeater"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D MAX_NEIGHBOURS=50 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +; -D CORE_DEBUG_LEVEL=3 +lib_deps = + ${LilyGo_TLora_V1_6_1_TCXO.lib_deps} + ${esp32_ota.lib_deps} + +[env:LilyGo_TLora_V1_6_1_TCXO_room_server] +extends = LilyGo_TLora_V1_6_1_TCXO +build_src_filter = ${LilyGo_TLora_V1_6_1_TCXO.build_src_filter} + + + +<../examples/simple_room_server> +build_flags = + ${LilyGo_TLora_V1_6_1_TCXO.build_flags} + -D ADVERT_NAME='"TLora-V1.6.1-TCXO Room"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D ROOM_PASSWORD='"hello"' +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +lib_deps = + ${LilyGo_TLora_V1_6_1_TCXO.lib_deps} + ${esp32_ota.lib_deps} diff --git a/variants/lilygo_tlora_v1_6_1_tcxo/target.cpp b/variants/lilygo_tlora_v1_6_1_tcxo/target.cpp new file mode 100644 index 000000000..7a385c5ce --- /dev/null +++ b/variants/lilygo_tlora_v1_6_1_tcxo/target.cpp @@ -0,0 +1,57 @@ +#include "target.h" + +#include + +LilyGoTLoraTCXOBoard board; + +static SPIClass spi; +RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi); + +WRAPPER_CLASS radio_driver(radio, board); + +ESP32RTCClock fallback_clock; +AutoDiscoverRTCClock rtc_clock(fallback_clock); +EnvironmentSensorManager sensors; + +#ifdef DISPLAY_CLASS +DISPLAY_CLASS display; +MomentaryButton user_btn(PIN_USER_BTN, 1000, true); +#endif + +bool radio_init() { + fallback_clock.begin(); + rtc_clock.begin(Wire); + + // Enable TCXO before radio initialization (required for SX1276 TCXO variant) +#ifdef P_LORA_TCXO_EN + pinMode(P_LORA_TCXO_EN, OUTPUT); + digitalWrite(P_LORA_TCXO_EN, HIGH); + delay(50); // Allow TCXO to stabilize +#endif + +#if defined(P_LORA_SCLK) + return radio.std_init(&spi); +#else + return radio.std_init(); +#endif +} + +uint32_t radio_get_rng_seed() { + return radio.random(0x7FFFFFFF); +} + +void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) { + radio.setFrequency(freq); + radio.setSpreadingFactor(sf); + radio.setBandwidth(bw); + radio.setCodingRate(cr); +} + +void radio_set_tx_power(uint8_t dbm) { + radio.setOutputPower(dbm); +} + +mesh::LocalIdentity radio_new_identity() { + RadioNoiseListener rng(radio); + return mesh::LocalIdentity(&rng); // create new random identity +} diff --git a/variants/lilygo_tlora_v1_6_1_tcxo/target.h b/variants/lilygo_tlora_v1_6_1_tcxo/target.h new file mode 100644 index 000000000..9dc336458 --- /dev/null +++ b/variants/lilygo_tlora_v1_6_1_tcxo/target.h @@ -0,0 +1,29 @@ +#pragma once + +#define RADIOLIB_STATIC_ONLY 1 +#include +#include +#include +#include +#include +#include +#ifdef DISPLAY_CLASS +#include +#include +#endif + +extern LilyGoTLoraTCXOBoard board; +extern WRAPPER_CLASS radio_driver; +extern AutoDiscoverRTCClock rtc_clock; +extern EnvironmentSensorManager sensors; + +#ifdef DISPLAY_CLASS +extern DISPLAY_CLASS display; +extern MomentaryButton user_btn; +#endif + +bool radio_init(); +uint32_t radio_get_rng_seed(); +void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); +void radio_set_tx_power(uint8_t dbm); +mesh::LocalIdentity radio_new_identity(); From 81f39a75af4c038cfa57572dc19d0c4bb389e444 Mon Sep 17 00:00:00 2001 From: sgrimee Date: Tue, 2 Dec 2025 20:42:36 +0100 Subject: [PATCH 2/3] fix(lilygo_tlora_v2_1): fix lora RST pin as per schematic https://github.com/Xinyuan-LilyGO/LilyGo-LoRa-Series/blob/master/schematic/T3_V1.6.1.pdf and confirmed by https://github.com/meshtastic/firmware/blob/develop/variants/esp32/tlora_v2_1_16/variant.h --- variants/lilygo_tlora_v2_1/platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variants/lilygo_tlora_v2_1/platformio.ini b/variants/lilygo_tlora_v2_1/platformio.ini index 9ef9734e5..ba316943c 100644 --- a/variants/lilygo_tlora_v2_1/platformio.ini +++ b/variants/lilygo_tlora_v2_1/platformio.ini @@ -14,7 +14,7 @@ build_flags = -D P_LORA_DIO_0=26 ; SX1276 DIO0 interrupt pin -D P_LORA_DIO_1=33 ; SX1276 DIO1 interrupt pin -D P_LORA_NSS=18 ; Chip select - SS pin - -D P_LORA_RESET=14 ; Reset pin + -D P_LORA_RESET=23 ; Reset pin -D P_LORA_SCLK=5 ; SPI clock -D P_LORA_MISO=19 ; SPI MISO -D P_LORA_MOSI=27 ; SPI MOSI From 640f0175a4268bd30a245ef7be7aba1b698ba171 Mon Sep 17 00:00:00 2001 From: sgrimee Date: Fri, 12 Dec 2025 17:55:16 +0100 Subject: [PATCH 3/3] feat: merge lilygo_tlora_v1_6_1_tcxo into lilygo_tlora_v2_1 variant Consolidates TCXO hardware variant support into the v2_1 platformio.ini configuration by adding TCXO-specific environments for all build targets (repeater, terminal_chat, companion_radio, room_server, and bridges). Uses shared [tcxo_flags] section to manage TCXO-specific compilation flags. Removes now-redundant v1_6_1_tcxo variant files. --- .../LilyGoTLoraTCXOBoard.h | 22 ---- .../lilygo_tlora_v1_6_1_tcxo/platformio.ini | 114 ------------------ variants/lilygo_tlora_v1_6_1_tcxo/target.cpp | 57 --------- variants/lilygo_tlora_v1_6_1_tcxo/target.h | 29 ----- variants/lilygo_tlora_v2_1/platformio.ini | 98 ++++++++++++--- variants/lilygo_tlora_v2_1/target.cpp | 7 ++ 6 files changed, 88 insertions(+), 239 deletions(-) delete mode 100644 variants/lilygo_tlora_v1_6_1_tcxo/LilyGoTLoraTCXOBoard.h delete mode 100644 variants/lilygo_tlora_v1_6_1_tcxo/platformio.ini delete mode 100644 variants/lilygo_tlora_v1_6_1_tcxo/target.cpp delete mode 100644 variants/lilygo_tlora_v1_6_1_tcxo/target.h diff --git a/variants/lilygo_tlora_v1_6_1_tcxo/LilyGoTLoraTCXOBoard.h b/variants/lilygo_tlora_v1_6_1_tcxo/LilyGoTLoraTCXOBoard.h deleted file mode 100644 index bc695cc3b..000000000 --- a/variants/lilygo_tlora_v1_6_1_tcxo/LilyGoTLoraTCXOBoard.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include - -// LILYGO T-LoRa V1.6.1 board with SX1276 and TCXO -class LilyGoTLoraTCXOBoard : public ESP32Board { -public: - const char *getManufacturerName() const override { return "LILYGO T-LoRa V1.6.1 TCXO"; } - - uint16_t getBattMilliVolts() override { - analogReadResolution(12); - - uint32_t raw = 0; - for (int i = 0; i < 8; i++) { - raw += analogReadMilliVolts(PIN_VBAT_READ); - } - raw = raw / 8; - - return (2 * raw); - } -}; diff --git a/variants/lilygo_tlora_v1_6_1_tcxo/platformio.ini b/variants/lilygo_tlora_v1_6_1_tcxo/platformio.ini deleted file mode 100644 index ca0d14f5d..000000000 --- a/variants/lilygo_tlora_v1_6_1_tcxo/platformio.ini +++ /dev/null @@ -1,114 +0,0 @@ -[LilyGo_TLora_V1_6_1_TCXO] -extends = esp32_base -board = ttgo-lora32-v1 ; LILYGO T-LoRa V1.6.1 ESP32 with SX1276 and TCXO -build_unflags = -Os -build_type = release -board_build.partitions = min_spiffs.csv -build_flags = - ${esp32_base.build_flags} - ${sensor_base.build_flags} - -UENV_INCLUDE_GPS - -I variants/lilygo_tlora_v1_6_1_tcxo - -Os -ffunction-sections -fdata-sections - -D LILYGO_TLORA_TCXO - -D P_LORA_DIO_0=26 - -D P_LORA_DIO_1=RADIOLIB_NC ; TCXO variant uses NC for DIO1 - -D P_LORA_NSS=18 - -D P_LORA_RESET=23 - -D P_LORA_TCXO_EN=33 ; TCXO enable pin (required for this variant) - -D P_LORA_SCLK=5 - -D P_LORA_MISO=19 - -D P_LORA_MOSI=27 - -D P_LORA_TX_LED=2 - -D PIN_BOARD_SDA=21 - -D PIN_BOARD_SCL=22 - -D PIN_VBAT_READ=35 - -D PIN_USER_BTN=0 - -D ARDUINO_LOOP_STACK_SIZE=16384 - -D DISPLAY_CLASS=SSD1306Display - -D RADIO_CLASS=CustomSX1276 - -D WRAPPER_CLASS=CustomSX1276Wrapper - -D SX127X_CURRENT_LIMIT=120 - -D LORA_TX_POWER=20 -build_src_filter = ${esp32_base.build_src_filter} - + - +<../variants/lilygo_tlora_v1_6_1_tcxo> - + -lib_deps = - ${esp32_base.lib_deps} - ${sensor_base.lib_deps} - -; === LILYGO T-LoRa V1.6.1 TCXO with SX1276 environments === -[env:LilyGo_TLora_V1_6_1_TCXO_companion_radio_ble] -extends = LilyGo_TLora_V1_6_1_TCXO -build_flags = - ${LilyGo_TLora_V1_6_1_TCXO.build_flags} - -I examples/companion_radio/ui-new - -D MAX_CONTACTS=160 - -D MAX_GROUP_CHANNELS=8 - -D BLE_PIN_CODE=123456 - -D OFFLINE_QUEUE_SIZE=256 - -D BLE_DEBUG_LOGGING=1 - -D MESH_PACKET_LOGGING=1 - -D MESH_DEBUG=1 -build_src_filter = ${LilyGo_TLora_V1_6_1_TCXO.build_src_filter} - + - + - +<../examples/companion_radio/*.cpp> - +<../examples/companion_radio/ui-new/*.cpp> -lib_deps = - ${LilyGo_TLora_V1_6_1_TCXO.lib_deps} - densaugeo/base64 @ ~1.4.0 - -[env:LilyGo_TLora_V1_6_1_TCXO_companion_radio_usb] -extends = LilyGo_TLora_V1_6_1_TCXO -build_flags = - ${LilyGo_TLora_V1_6_1_TCXO.build_flags} - -I examples/companion_radio/ui-new - -D MAX_CONTACTS=160 - -D MAX_GROUP_CHANNELS=8 -; -D MESH_PACKET_LOGGING=1 -; -D MESH_DEBUG=1 -build_src_filter = ${LilyGo_TLora_V1_6_1_TCXO.build_src_filter} - + - +<../examples/companion_radio/*.cpp> - +<../examples/companion_radio/ui-new/*.cpp> -lib_deps = - ${LilyGo_TLora_V1_6_1_TCXO.lib_deps} - densaugeo/base64 @ ~1.4.0 - -[env:LilyGo_TLora_V1_6_1_TCXO_repeater] -extends = LilyGo_TLora_V1_6_1_TCXO -build_src_filter = ${LilyGo_TLora_V1_6_1_TCXO.build_src_filter} - +<../examples/simple_repeater> -build_flags = - ${LilyGo_TLora_V1_6_1_TCXO.build_flags} - -D ADVERT_NAME='"TLora-V1.6.1-TCXO Repeater"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D MAX_NEIGHBOURS=50 -; -D MESH_PACKET_LOGGING=1 -; -D MESH_DEBUG=1 -; -D CORE_DEBUG_LEVEL=3 -lib_deps = - ${LilyGo_TLora_V1_6_1_TCXO.lib_deps} - ${esp32_ota.lib_deps} - -[env:LilyGo_TLora_V1_6_1_TCXO_room_server] -extends = LilyGo_TLora_V1_6_1_TCXO -build_src_filter = ${LilyGo_TLora_V1_6_1_TCXO.build_src_filter} - + - +<../examples/simple_room_server> -build_flags = - ${LilyGo_TLora_V1_6_1_TCXO.build_flags} - -D ADVERT_NAME='"TLora-V1.6.1-TCXO Room"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D ROOM_PASSWORD='"hello"' -; -D MESH_PACKET_LOGGING=1 -; -D MESH_DEBUG=1 -lib_deps = - ${LilyGo_TLora_V1_6_1_TCXO.lib_deps} - ${esp32_ota.lib_deps} diff --git a/variants/lilygo_tlora_v1_6_1_tcxo/target.cpp b/variants/lilygo_tlora_v1_6_1_tcxo/target.cpp deleted file mode 100644 index 7a385c5ce..000000000 --- a/variants/lilygo_tlora_v1_6_1_tcxo/target.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "target.h" - -#include - -LilyGoTLoraTCXOBoard board; - -static SPIClass spi; -RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_0, P_LORA_RESET, P_LORA_DIO_1, spi); - -WRAPPER_CLASS radio_driver(radio, board); - -ESP32RTCClock fallback_clock; -AutoDiscoverRTCClock rtc_clock(fallback_clock); -EnvironmentSensorManager sensors; - -#ifdef DISPLAY_CLASS -DISPLAY_CLASS display; -MomentaryButton user_btn(PIN_USER_BTN, 1000, true); -#endif - -bool radio_init() { - fallback_clock.begin(); - rtc_clock.begin(Wire); - - // Enable TCXO before radio initialization (required for SX1276 TCXO variant) -#ifdef P_LORA_TCXO_EN - pinMode(P_LORA_TCXO_EN, OUTPUT); - digitalWrite(P_LORA_TCXO_EN, HIGH); - delay(50); // Allow TCXO to stabilize -#endif - -#if defined(P_LORA_SCLK) - return radio.std_init(&spi); -#else - return radio.std_init(); -#endif -} - -uint32_t radio_get_rng_seed() { - return radio.random(0x7FFFFFFF); -} - -void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) { - radio.setFrequency(freq); - radio.setSpreadingFactor(sf); - radio.setBandwidth(bw); - radio.setCodingRate(cr); -} - -void radio_set_tx_power(uint8_t dbm) { - radio.setOutputPower(dbm); -} - -mesh::LocalIdentity radio_new_identity() { - RadioNoiseListener rng(radio); - return mesh::LocalIdentity(&rng); // create new random identity -} diff --git a/variants/lilygo_tlora_v1_6_1_tcxo/target.h b/variants/lilygo_tlora_v1_6_1_tcxo/target.h deleted file mode 100644 index 9dc336458..000000000 --- a/variants/lilygo_tlora_v1_6_1_tcxo/target.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#define RADIOLIB_STATIC_ONLY 1 -#include -#include -#include -#include -#include -#include -#ifdef DISPLAY_CLASS -#include -#include -#endif - -extern LilyGoTLoraTCXOBoard board; -extern WRAPPER_CLASS radio_driver; -extern AutoDiscoverRTCClock rtc_clock; -extern EnvironmentSensorManager sensors; - -#ifdef DISPLAY_CLASS -extern DISPLAY_CLASS display; -extern MomentaryButton user_btn; -#endif - -bool radio_init(); -uint32_t radio_get_rng_seed(); -void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); -void radio_set_tx_power(uint8_t dbm); -mesh::LocalIdentity radio_new_identity(); diff --git a/variants/lilygo_tlora_v2_1/platformio.ini b/variants/lilygo_tlora_v2_1/platformio.ini index ba316943c..f1e10ed4b 100644 --- a/variants/lilygo_tlora_v2_1/platformio.ini +++ b/variants/lilygo_tlora_v2_1/platformio.ini @@ -37,7 +37,17 @@ lib_deps = ${esp32_base.lib_deps} ${sensor_base.lib_deps} +; TCXO-specific flags (for LILYGO T-LoRa V2.1-1.6 TCXO hardware variant) +[tcxo_flags] +build_flags = + -D P_LORA_DIO_1=RADIOLIB_NC ; TCXO uses NC for DIO1 + -D P_LORA_TCXO_EN=33 ; TCXO enable pin + ; === LILYGO T-LoRa V2.1-1.6 with SX1276 environments === + +; +; Repeater +; [env:LilyGo_TLora_V2_1_1_6_repeater] extends = LilyGo_TLora_V2_1_1_6 build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} @@ -56,6 +66,12 @@ lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} ${esp32_ota.lib_deps} +[env:LilyGo_TLora_V2_1_1_6_TCXO_repeater] +extends = env:LilyGo_TLora_V2_1_1_6_repeater +build_flags = + ${env:LilyGo_TLora_V2_1_1_6_repeater.build_flags} + ${tcxo_flags.build_flags} + [env:LilyGo_TLora_V2_1_1_6_terminal_chat] extends = LilyGo_TLora_V2_1_1_6 build_flags = @@ -70,6 +86,15 @@ lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} densaugeo/base64 @ ~1.4.0 +[env:LilyGo_TLora_V2_1_1_6_TCXO_terminal_chat] +extends = env:LilyGo_TLora_V2_1_1_6_terminal_chat +build_flags = + ${env:LilyGo_TLora_V2_1_1_6_terminal_chat.build_flags} + ${tcxo_flags.build_flags} + +; +; Companion Radio +; [env:LilyGo_TLora_V2_1_1_6_companion_radio_usb] extends = LilyGo_TLora_V2_1_1_6 build_flags = @@ -87,6 +112,12 @@ lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} densaugeo/base64 @ ~1.4.0 +[env:LilyGo_TLora_V2_1_1_6_TCXO_companion_radio_usb] +extends = env:LilyGo_TLora_V2_1_1_6_companion_radio_usb +build_flags = + ${env:LilyGo_TLora_V2_1_1_6_companion_radio_usb.build_flags} + ${tcxo_flags.build_flags} + [env:LilyGo_TLora_V2_1_1_6_companion_radio_ble] extends = LilyGo_TLora_V2_1_1_6 build_flags = @@ -108,23 +139,11 @@ lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} densaugeo/base64 @ ~1.4.0 -[env:LilyGo_TLora_V2_1_1_6_room_server] -extends = LilyGo_TLora_V2_1_1_6 -build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} - + - +<../examples/simple_room_server> +[env:LilyGo_TLora_V2_1_1_6_TCXO_companion_radio_ble] +extends = env:LilyGo_TLora_V2_1_1_6_companion_radio_ble build_flags = - ${LilyGo_TLora_V2_1_1_6.build_flags} - -D ADVERT_NAME='"TLora-V2.1-1.6 Room"' - -D ADVERT_LAT=0.0 - -D ADVERT_LON=0.0 - -D ADMIN_PASSWORD='"password"' - -D ROOM_PASSWORD='"hello"' -; -D MESH_PACKET_LOGGING=1 -; -D MESH_DEBUG=1 -lib_deps = - ${LilyGo_TLora_V2_1_1_6.lib_deps} - ${esp32_ota.lib_deps} + ${env:LilyGo_TLora_V2_1_1_6_companion_radio_ble.build_flags} + ${tcxo_flags.build_flags} [env:LilyGo_TLora_V2_1_1_6_companion_radio_wifi] extends = LilyGo_TLora_V2_1_1_6 @@ -145,6 +164,39 @@ lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} densaugeo/base64 @ ~1.4.0 +[env:LilyGo_TLora_V2_1_1_6_TCXO_companion_radio_wifi] +extends = env:LilyGo_TLora_V2_1_1_6_companion_radio_wifi +build_flags = + ${env:LilyGo_TLora_V2_1_1_6_companion_radio_wifi.build_flags} + ${tcxo_flags.build_flags} + +; +; Room Server +; +[env:LilyGo_TLora_V2_1_1_6_room_server] +extends = LilyGo_TLora_V2_1_1_6 +build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} + + + +<../examples/simple_room_server> +build_flags = + ${LilyGo_TLora_V2_1_1_6.build_flags} + -D ADVERT_NAME='"TLora-V2.1-1.6 Room"' + -D ADVERT_LAT=0.0 + -D ADVERT_LON=0.0 + -D ADMIN_PASSWORD='"password"' + -D ROOM_PASSWORD='"hello"' +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +lib_deps = + ${LilyGo_TLora_V2_1_1_6.lib_deps} + ${esp32_ota.lib_deps} + +[env:LilyGo_TLora_V2_1_1_6_TCXO_room_server] +extends = env:LilyGo_TLora_V2_1_1_6_room_server +build_flags = + ${env:LilyGo_TLora_V2_1_1_6_room_server.build_flags} + ${tcxo_flags.build_flags} + ; ; Repeater Bridges ; @@ -171,6 +223,12 @@ lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} ${esp32_ota.lib_deps} +[env:LilyGo_TLora_V2_1_1_6_TCXO_repeater_bridge_rs232] +extends = env:LilyGo_TLora_V2_1_1_6_repeater_bridge_rs232 +build_flags = + ${env:LilyGo_TLora_V2_1_1_6_repeater_bridge_rs232.build_flags} + ${tcxo_flags.build_flags} + [env:LilyGo_TLora_V2_1_1_6_repeater_bridge_espnow] extends = LilyGo_TLora_V2_1_1_6 build_src_filter = ${LilyGo_TLora_V2_1_1_6.build_src_filter} @@ -190,4 +248,10 @@ build_flags = ; -D CORE_DEBUG_LEVEL=3 lib_deps = ${LilyGo_TLora_V2_1_1_6.lib_deps} - ${esp32_ota.lib_deps} \ No newline at end of file + ${esp32_ota.lib_deps} + +[env:LilyGo_TLora_V2_1_1_6_TCXO_repeater_bridge_espnow] +extends = env:LilyGo_TLora_V2_1_1_6_repeater_bridge_espnow +build_flags = + ${env:LilyGo_TLora_V2_1_1_6_repeater_bridge_espnow.build_flags} + ${tcxo_flags.build_flags} diff --git a/variants/lilygo_tlora_v2_1/target.cpp b/variants/lilygo_tlora_v2_1/target.cpp index 65a78c194..eec8e116b 100644 --- a/variants/lilygo_tlora_v2_1/target.cpp +++ b/variants/lilygo_tlora_v2_1/target.cpp @@ -21,6 +21,13 @@ bool radio_init() { fallback_clock.begin(); rtc_clock.begin(Wire); +// Enable TCXO before radio initialization +#ifdef P_LORA_TCXO_EN + pinMode(P_LORA_TCXO_EN, OUTPUT); + digitalWrite(P_LORA_TCXO_EN, HIGH); + delay(50); // Allow TCXO to stabilize +#endif + #if defined(P_LORA_SCLK) return radio.std_init(&spi); #else