Unify Heltec V4 OLED, TFT and headless display selection
Detect OLED or the original stock TFT touch assembly in ordinary V4.2/V4.3 images. Add saved live display.type auto/oled/tft/off selection and report the active selection in board output. Keep sensors on primary I2C, preserve shared power, and isolate TFT FSPI from radio HSPI through sleep and changes. Consolidate future picker/build choices only with application capability proof. Retain exact legacy OTA identities and separate R8 hardware images. Document controls and physical qualification limits. Validation: five serialized Full builds with capability/size/RAM checks; focused host tests, existing R8/T-Deck/OLED regressions, build-profile suite, and picker/provider tests. V4.3 OLED live changes and off/auto reboot persistence passed on Mercerwood. Physical TFT qualification remains pending.
This commit is contained in:
1 parent
5b5708283d
commit
b00d346df7
43 files changed
+2123
-76
No files matched your search
@@ -1,5 +1,9 @@
|
||||
#include "HeltecV4Board.h"
|
||||
#include <helpers/ESP32GpioHold.h>
|
||||
#if defined(HELTEC_V4_DISPLAY_UNIFIED) && HELTEC_V4_DISPLAY_UNIFIED && defined(DISPLAY_CLASS)
|
||||
#include <helpers/ui/HeltecV4DisplaySettings.h>
|
||||
extern HeltecV4Display display;
|
||||
#endif
|
||||
|
||||
void HeltecV4Board::begin() {
|
||||
ESP32Board::begin();
|
||||
@@ -56,7 +60,13 @@ void HeltecV4Board::begin() {
|
||||
}
|
||||
|
||||
const char* HeltecV4Board::getManufacturerName() const {
|
||||
#ifdef HELTEC_LORA_V4_TFT
|
||||
#if defined(HELTEC_V4_DISPLAY_UNIFIED) && HELTEC_V4_DISPLAY_UNIFIED && defined(DISPLAY_CLASS)
|
||||
static char name[64];
|
||||
snprintf(name, sizeof(name), "Heltec V4.%u %s",
|
||||
loRaFEMControl.getFEMType() == KCT8103L_PA ? 3u : 2u,
|
||||
display.status());
|
||||
return name;
|
||||
#elif defined(HELTEC_LORA_V4_TFT)
|
||||
return loRaFEMControl.getFEMType() == KCT8103L_PA ? "Heltec V4.3 TFT" : "Heltec V4 TFT";
|
||||
#else
|
||||
return loRaFEMControl.getFEMType() == KCT8103L_PA ? "Heltec V4.3 OLED" : "Heltec V4 OLED";
|
||||
@@ -98,6 +108,9 @@ bool HeltecV4Board::handleCommand(const char* command, uint32_t sender_timestamp
|
||||
if (command == nullptr || reply == nullptr) {
|
||||
return false;
|
||||
}
|
||||
#if defined(HELTEC_V4_DISPLAY_UNIFIED) && HELTEC_V4_DISPLAY_UNIFIED && defined(DISPLAY_CLASS)
|
||||
if (mesh::ui::handleHeltecV4DisplayCommand(command, reply, 160, display)) return true;
|
||||
#endif
|
||||
|
||||
if (strcmp(command, "get radio.fem.rxgain") == 0) {
|
||||
if (!loRaFEMControl.isLnaCanControl()) {
|
||||
|
||||
@@ -51,29 +51,21 @@ lib_deps =
|
||||
${esp32_base.lib_deps}
|
||||
${sensor_base.lib_deps}
|
||||
|
||||
[heltec_v4_oled]
|
||||
[heltec_v4_display]
|
||||
extends = Heltec_lora32_v4
|
||||
build_flags =
|
||||
${Heltec_lora32_v4.build_flags}
|
||||
-D HELTEC_LORA_V4_OLED
|
||||
-D HELTEC_V4_DISPLAY_UNIFIED=1
|
||||
-D HELTEC_LORA_V4_TFT
|
||||
-D HELTEC_V4_OLED_KIT_COMPAT=1
|
||||
-D PIN_BOARD_SDA=17
|
||||
-D PIN_BOARD_SCL=18
|
||||
; The OLED uses Wire above; the expansion/general sensor connector is 4/3.
|
||||
-D HELTEC_V4_TFT_KIT_COMPAT=1
|
||||
; Keep sensors/RTC on the expansion bus. The display wrapper owns a
|
||||
; separate I2C controller for OLED 17/18 and TFT touch identification.
|
||||
-D PIN_BOARD_SDA=4
|
||||
-D PIN_BOARD_SCL=3
|
||||
-D ENV_PIN_SDA=4
|
||||
-D ENV_PIN_SCL=3
|
||||
-D PIN_OLED_RESET=21
|
||||
build_src_filter= ${Heltec_lora32_v4.build_src_filter}
|
||||
lib_deps = ${Heltec_lora32_v4.lib_deps}
|
||||
|
||||
[heltec_v4_tft]
|
||||
extends = Heltec_lora32_v4
|
||||
build_flags =
|
||||
${Heltec_lora32_v4.build_flags}
|
||||
-D HELTEC_LORA_V4_TFT
|
||||
-D HELTEC_V4_TFT_KIT_COMPAT=1
|
||||
-D PIN_BOARD_SDA=4
|
||||
-D PIN_BOARD_SCL=3
|
||||
-D PIN_TFT_RST=18
|
||||
-D PIN_TFT_VDD_CTL=-1
|
||||
-D PIN_TFT_LEDA_CTL=21
|
||||
@@ -82,16 +74,33 @@ build_flags =
|
||||
-D PIN_TFT_DC=16
|
||||
-D PIN_TFT_SCL=17
|
||||
-D PIN_TFT_SDA=33
|
||||
build_src_filter= ${Heltec_lora32_v4.build_src_filter}
|
||||
lib_deps =
|
||||
build_src_filter = ${Heltec_lora32_v4.build_src_filter}
|
||||
+<helpers/ui/HeltecV4Display.cpp>
|
||||
+<helpers/ui/SSD1306Display.cpp>
|
||||
+<helpers/ui/ST7789LCDDisplay.cpp>
|
||||
lib_deps =
|
||||
${Heltec_lora32_v4.lib_deps}
|
||||
adafruit/Adafruit ST7735 and ST7789 Library @ ^1.11.0
|
||||
|
||||
; Keep explicit historical environments/OTA identities available. Both display
|
||||
; aliases now compile the same auto/OLED/TFT/headless implementation.
|
||||
[heltec_v4_oled]
|
||||
extends = heltec_v4_display
|
||||
build_flags = ${heltec_v4_display.build_flags}
|
||||
build_src_filter = ${heltec_v4_display.build_src_filter}
|
||||
lib_deps = ${heltec_v4_display.lib_deps}
|
||||
|
||||
[heltec_v4_tft]
|
||||
extends = heltec_v4_display
|
||||
build_flags = ${heltec_v4_display.build_flags}
|
||||
build_src_filter = ${heltec_v4_display.build_src_filter}
|
||||
lib_deps = ${heltec_v4_display.lib_deps}
|
||||
|
||||
[env:heltec_v4_repeater]
|
||||
extends = heltec_v4_oled
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"Heltec Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -114,7 +123,7 @@ extends = heltec_v4_oled
|
||||
board_build.partitions = default.csv
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"Heltec Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -132,7 +141,7 @@ lib_deps =
|
||||
extends = heltec_v4_oled
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"Heltec Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -154,7 +163,7 @@ lib_deps =
|
||||
extends = heltec_v4_oled
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"ESPNow Bridge"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -181,7 +190,7 @@ board_ssl_cert_source = adafruit-full
|
||||
board_build.embed_files = src/certs/x509_crt_bundle.bin
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"MQTT Observer"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -231,7 +240,7 @@ board_ssl_cert_source = adafruit-full
|
||||
board_build.embed_files = src/certs/x509_crt_bundle.bin
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"MQTT Observer"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -332,7 +341,7 @@ board_ssl_cert_source = adafruit-full
|
||||
board_build.embed_files = src/certs/x509_crt_bundle.bin
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"Heltec Room Observer"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -374,7 +383,7 @@ board_ssl_cert_source = adafruit-full
|
||||
board_build.embed_files = src/certs/x509_crt_bundle.bin
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"Heltec Room Observer"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -413,7 +422,7 @@ lib_deps =
|
||||
extends = heltec_v4_oled
|
||||
build_flags =
|
||||
${heltec_v4_oled.build_flags}
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"Heltec Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -449,7 +458,7 @@ build_flags =
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ENABLE_USB_INTERFACE
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
@@ -485,7 +494,7 @@ build_flags =
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D BLE_PIN_CODE=123456 ; dynamic, random PIN
|
||||
-D AUTO_SHUTDOWN_MILLIVOLTS=3400
|
||||
-D BLE_DEBUG_LOGGING=1
|
||||
@@ -532,7 +541,7 @@ build_flags =
|
||||
-D ENABLE_WIFI_INTERFACE
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D WIFI_DEBUG_LOGGING=1
|
||||
-D WIFI_SSID='"myssid"'
|
||||
-D WIFI_PWD='"mypwd"'
|
||||
@@ -618,7 +627,7 @@ build_flags =
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${heltec_v4_oled.build_src_filter}
|
||||
@@ -633,7 +642,7 @@ lib_deps =
|
||||
extends = heltec_v4_tft
|
||||
build_flags =
|
||||
${heltec_v4_tft.build_flags}
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"Heltec Repeater"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -654,7 +663,7 @@ lib_deps =
|
||||
extends = heltec_v4_tft
|
||||
build_flags =
|
||||
${heltec_v4_tft.build_flags}
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"ESPNow Bridge"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -676,7 +685,7 @@ lib_deps =
|
||||
extends = heltec_v4_tft
|
||||
build_flags =
|
||||
${heltec_v4_tft.build_flags}
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ADVERT_NAME='"Heltec Room"'
|
||||
-D ADVERT_LAT=0.0
|
||||
-D ADVERT_LON=0.0
|
||||
@@ -712,7 +721,7 @@ build_flags =
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D ENABLE_USB_INTERFACE
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
@@ -736,7 +745,7 @@ extends = heltec_v4_tft
|
||||
build_flags =
|
||||
${heltec_v4_tft.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D BLE_PIN_CODE=123456 ; dynamic, random PIN
|
||||
@@ -793,7 +802,7 @@ build_flags =
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D OFFLINE_QUEUE_SIZE=512
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
-D WIFI_DEBUG_LOGGING=1
|
||||
-D WIFI_SSID='"myssid"'
|
||||
-D WIFI_PWD='"mypwd"'
|
||||
@@ -839,7 +848,7 @@ build_flags =
|
||||
-D ADVERT_LON=0.0
|
||||
-D ADMIN_PASSWORD='"password"'
|
||||
; Environmental sensors use the TFT profile's Wire bus at GPIO4/3.
|
||||
-D DISPLAY_CLASS=ST7789LCDDisplay
|
||||
-D DISPLAY_CLASS=HeltecV4Display
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${heltec_v4_tft.build_src_filter}
|
||||
|
||||
@@ -29,7 +29,11 @@ const char meshcore_capability_heltec_v4_tft_kit[] =
|
||||
#endif
|
||||
|
||||
#if defined(P_LORA_SCLK)
|
||||
#if defined(HELTEC_V4_DISPLAY_UNIFIED) && HELTEC_V4_DISPLAY_UNIFIED
|
||||
static SPIClass spi(HSPI); // TFT owns FSPI; never share its reset/remap.
|
||||
#else
|
||||
static SPIClass spi;
|
||||
#endif
|
||||
static SX126xBufferedRadioHal radio_hal(spi);
|
||||
RADIO_CLASS radio = new Module(&radio_hal, P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
|
||||
#else
|
||||
@@ -51,6 +55,8 @@ AutoDiscoverRTCClock rtc_clock(fallback_clock);
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
// VEXT is shared with the expansion sensors. Display selection must not
|
||||
// acquire or switch that rail when entering headless/off mode.
|
||||
DISPLAY_CLASS display(NULL);
|
||||
MomentaryButton user_btn(PIN_USER_BTN, 1000, true);
|
||||
#endif
|
||||
@@ -61,7 +67,11 @@ bool radio_init() {
|
||||
(void)*capability;
|
||||
#endif
|
||||
#if defined(MESHCORE_HELTEC_V4_TFT_KIT_COMPAT)
|
||||
#if defined(HELTEC_V4_DISPLAY_UNIFIED) && HELTEC_V4_DISPLAY_UNIFIED
|
||||
{
|
||||
#else
|
||||
if (std::is_same<DISPLAY_CLASS, ST7789LCDDisplay>::value) {
|
||||
#endif
|
||||
const volatile char* capability = meshcore_capability_heltec_v4_tft_kit;
|
||||
(void)*capability;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
|
||||
// GPIO40 and GPIO41 are hard-wired to GNSS WAKE and PPS respectively.
|
||||
// Keep them unavailable even when no GNSS data is detected at startup.
|
||||
#define USER_GPIO_RESERVED_PINS 40, 41
|
||||
#if defined(HELTEC_V4_DISPLAY_UNIFIED) && HELTEC_V4_DISPLAY_UNIFIED && defined(DISPLAY_CLASS)
|
||||
// The stock TFT touch controller is probed on 47/48, with reset on 44.
|
||||
#define USER_GPIO_RESERVED_PINS 40, 41, 44, 47, 48
|
||||
#else
|
||||
#define USER_GPIO_RESERVED_PINS 40, 41
|
||||
#endif
|
||||
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
@@ -13,7 +18,9 @@
|
||||
#include <helpers/SensorManager.h>
|
||||
#include <helpers/sensors/EnvironmentSensorManager.h>
|
||||
#ifdef DISPLAY_CLASS
|
||||
#ifdef HELTEC_LORA_V4_OLED
|
||||
#if defined(HELTEC_V4_DISPLAY_UNIFIED) && HELTEC_V4_DISPLAY_UNIFIED
|
||||
#include <helpers/ui/HeltecV4Display.h>
|
||||
#elif defined(HELTEC_LORA_V4_OLED)
|
||||
#include <helpers/ui/SSD1306Display.h>
|
||||
#elif defined(HELTEC_LORA_V4_TFT)
|
||||
#include <helpers/ui/ST7789LCDDisplay.h>
|
||||
|
||||
Reference in new issue
Block a user