diff --git a/variants/lilygo_tlora_v2_1/platformio.ini b/variants/lilygo_tlora_v2_1/platformio.ini index 9ef9734e5..f1e10ed4b 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 @@ -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