From e076e797e68ff9099f1ed22b02c3194f899e04ef Mon Sep 17 00:00:00 2001 From: seagull9000 Date: Wed, 7 May 2025 21:40:27 +1200 Subject: [PATCH] Heltec Wireless Tracker support --- examples/companion_radio/main.cpp | 4 ++- src/helpers/HeltecV3Board.h | 7 +++-- variants/heltec_v3/platformio.ini | 43 ++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 88652697..d43f47bb 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -59,7 +59,9 @@ #ifdef DISPLAY_CLASS #include "UITask.h" - #ifdef ST7789 + #ifdef ST7735 + #include + #elif ST7789 #include #elif defined(HAS_GxEPD) #include diff --git a/src/helpers/HeltecV3Board.h b/src/helpers/HeltecV3Board.h index 605bfe21..fd6352ec 100644 --- a/src/helpers/HeltecV3Board.h +++ b/src/helpers/HeltecV3Board.h @@ -3,6 +3,7 @@ #include // LoRa radio module pins for Heltec V3 +// Also for Heltec Wireless Tracker #define P_LORA_DIO_1 14 #define P_LORA_NSS 8 #define P_LORA_RESET RADIOLIB_NC @@ -13,10 +14,12 @@ // built-ins #define PIN_VBAT_READ 1 -#define PIN_ADC_CTRL 37 +#ifndef PIN_ADC_CTRL // set in platformio.ini for Heltec Wireless Tracker (2) + #define PIN_ADC_CTRL 37 +#endif #define PIN_ADC_CTRL_ACTIVE LOW #define PIN_ADC_CTRL_INACTIVE HIGH -#define PIN_LED_BUILTIN 35 +//#define PIN_LED_BUILTIN 35 #define PIN_VEXT_EN 36 #include "ESP32Board.h" diff --git a/variants/heltec_v3/platformio.ini b/variants/heltec_v3/platformio.ini index 49fa7434..4644f53a 100644 --- a/variants/heltec_v3/platformio.ini +++ b/variants/heltec_v3/platformio.ini @@ -8,9 +8,9 @@ build_flags = -D RADIO_CLASS=CustomSX1262 -D WRAPPER_CLASS=CustomSX1262Wrapper -D LORA_TX_POWER=22 - -D P_LORA_TX_LED=35 - -D PIN_BOARD_SDA=17 - -D PIN_BOARD_SCL=18 + -D P_LORA_TX_LED=35 ; Heltec WT redefines this + -D PIN_BOARD_SDA=17 ; Heltec WT redefines this + -D PIN_BOARD_SCL=18 ; Heltec WT redefines this -D PIN_USER_BTN=0 -D SX126X_DIO2_AS_RF_SWITCH=true -D SX126X_DIO3_TCXO_VOLTAGE=1.8 @@ -185,3 +185,40 @@ build_src_filter = ${Heltec_lora32_v3.build_src_filter} lib_deps = ${Heltec_lora32_v3.lib_deps} densaugeo/base64 @ ~1.4.0 + +[env:Heltec_Wireless_Tracker_companion_radio_ble] +extends = Heltec_lora32_v3 +build_flags = + ${Heltec_lora32_v3.build_flags} + -I src/helpers/ui + ; -D ARDUINO_USB_CDC_ON_BOOT=1 ; need for debugging + -D ST7735 + -D PIN_ADC_CTRL=2 ; redefines the V3 pin + -D DISPLAY_ROTATION=1 + -D DISPLAY_CLASS=ST7735Display + -D USE_PIN_TFT=1 + -D MAX_CONTACTS=100 + -D MAX_GROUP_CHANNELS=8 + -D BLE_PIN_CODE=123456 ; HWT will use display for pin +; -D BLE_DEBUG_LOGGING=1 + -D P_LORA_TX_LED=18 + -D PIN_TFT_SDA=42 ; SDIN + -D PIN_TFT_SCL=41 ; SCLK + -D PIN_TFT_DC=40 ; RS (register select) + -D PIN_TFT_RST=39 ; RES + -D PIN_TFT_CS=38 + -D PIN_TFT_VDD_CTL=3 ; Vext is connected to VDD which is also connected to LEDA + -D PIN_TFT_LEDA_CTL=21 ; LEDK (switches on/off via mosfet to create the ground) +; -D ENABLE_PRIVATE_KEY_IMPORT=1 +; -D ENABLE_PRIVATE_KEY_EXPORT=1 +; -D MESH_PACKET_LOGGING=1 +; -D MESH_DEBUG=1 +build_src_filter = ${Heltec_lora32_v3.build_src_filter} + + + +<../examples/companion_radio> + + +lib_deps = + ${Heltec_lora32_v3.lib_deps} + densaugeo/base64 @ ~1.4.0 + adafruit/Adafruit ST7735 and ST7789 Library @ ^1.11.0 + \ No newline at end of file