Get t-deck working with both UIs for tft build

This commit is contained in:
Jonathan Bennett 2025-05-18 19:46:48 -05:00
parent f1440a27d7
commit 61ebce5241
5 changed files with 46 additions and 37 deletions

View File

@ -953,9 +953,11 @@ void setup()
// the current region name) // the current region name)
#if defined(ST7701_CS) || defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || \ #if defined(ST7701_CS) || defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER) || defined(ILI9342_DRIVER) || \
defined(ST7789_CS) || defined(HX8357_CS) || defined(USE_ST7789) || defined(ILI9488_CS) defined(ST7789_CS) || defined(HX8357_CS) || defined(USE_ST7789) || defined(ILI9488_CS)
screen->setup(); if (screen)
screen->setup();
#elif defined(ARCH_PORTDUINO) #elif defined(ARCH_PORTDUINO)
if ((screen_found.port != ScanI2C::I2CPort::NO_I2C || settingsMap[displayPanel]) && config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) { if ((screen_found.port != ScanI2C::I2CPort::NO_I2C || settingsMap[displayPanel]) &&
config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
screen->setup(); screen->setup();
} }
#else #else
@ -964,8 +966,8 @@ void setup()
#endif #endif
#endif #endif
if (screen) { if (screen) {
screen->print("Started...\n"); screen->print("Started...\n");
} }
#ifdef PIN_PWR_DELAY_MS #ifdef PIN_PWR_DELAY_MS
// This may be required to give the peripherals time to power up. // This may be required to give the peripherals time to power up.

View File

@ -104,7 +104,9 @@ void setupModules()
{ {
if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) { if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
#if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER #if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER
inputBroker = new InputBroker(); if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
inputBroker = new InputBroker();
}
#endif #endif
#if !MESHTASTIC_EXCLUDE_ADMIN #if !MESHTASTIC_EXCLUDE_ADMIN
adminModule = new AdminModule(); adminModule = new AdminModule();
@ -152,36 +154,40 @@ void setupModules()
// Example: Put your module here // Example: Put your module here
// new ReplyModule(); // new ReplyModule();
#if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER #if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
if (!rotaryEncoderInterruptImpl1->init()) { if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
delete rotaryEncoderInterruptImpl1; rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
rotaryEncoderInterruptImpl1 = nullptr; if (!rotaryEncoderInterruptImpl1->init()) {
} delete rotaryEncoderInterruptImpl1;
upDownInterruptImpl1 = new UpDownInterruptImpl1(); rotaryEncoderInterruptImpl1 = nullptr;
if (!upDownInterruptImpl1->init()) { }
delete upDownInterruptImpl1; upDownInterruptImpl1 = new UpDownInterruptImpl1();
upDownInterruptImpl1 = nullptr; if (!upDownInterruptImpl1->init()) {
} delete upDownInterruptImpl1;
upDownInterruptImpl1 = nullptr;
}
#if HAS_SCREEN #if HAS_SCREEN
// In order to have the user button dismiss the canned message frame, this class lightly interacts with the Screen class // In order to have the user button dismiss the canned message frame, this class lightly interacts with the Screen
scanAndSelectInput = new ScanAndSelectInput(); // class
if (!scanAndSelectInput->init()) { scanAndSelectInput = new ScanAndSelectInput();
delete scanAndSelectInput; if (!scanAndSelectInput->init()) {
scanAndSelectInput = nullptr; delete scanAndSelectInput;
} scanAndSelectInput = nullptr;
}
#endif #endif
cardKbI2cImpl = new CardKbI2cImpl(); cardKbI2cImpl = new CardKbI2cImpl();
cardKbI2cImpl->init(); cardKbI2cImpl->init();
#ifdef INPUTBROKER_MATRIX_TYPE #ifdef INPUTBROKER_MATRIX_TYPE
kbMatrixImpl = new KbMatrixImpl(); kbMatrixImpl = new KbMatrixImpl();
kbMatrixImpl->init(); kbMatrixImpl->init();
#endif // INPUTBROKER_MATRIX_TYPE #endif // INPUTBROKER_MATRIX_TYPE
#ifdef INPUTBROKER_SERIAL_TYPE #ifdef INPUTBROKER_SERIAL_TYPE
aSerialKeyboardImpl = new SerialKeyboardImpl(); aSerialKeyboardImpl = new SerialKeyboardImpl();
aSerialKeyboardImpl->init(); aSerialKeyboardImpl->init();
#endif // INPUTBROKER_MATRIX_TYPE #endif // INPUTBROKER_MATRIX_TYPE
}
#endif // HAS_BUTTON #endif // HAS_BUTTON
#if ARCH_PORTDUINO #if ARCH_PORTDUINO
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) { if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
@ -190,14 +196,19 @@ void setupModules()
} }
#endif #endif
#if HAS_TRACKBALL && !MESHTASTIC_EXCLUDE_INPUTBROKER #if HAS_TRACKBALL && !MESHTASTIC_EXCLUDE_INPUTBROKER
trackballInterruptImpl1 = new TrackballInterruptImpl1(); if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
trackballInterruptImpl1->init(); trackballInterruptImpl1 = new TrackballInterruptImpl1();
trackballInterruptImpl1->init();
}
#endif #endif
LOG_DEBUG("location5");
#ifdef INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE #ifdef INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE
expressLRSFiveWayInput = new ExpressLRSFiveWay(); expressLRSFiveWayInput = new ExpressLRSFiveWay();
#endif #endif
#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES #if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
cannedMessageModule = new CannedMessageModule(); if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
cannedMessageModule = new CannedMessageModule();
}
#endif #endif
#if ARCH_PORTDUINO #if ARCH_PORTDUINO
new HostMetricsModule(); new HostMetricsModule();

View File

@ -56,7 +56,7 @@ build_flags = ${native_base.build_flags} -Os -ffunction-sections -fdata-sections
-D USE_FRAMEBUFFER=1 -D USE_FRAMEBUFFER=1
-D LV_COLOR_DEPTH=32 -D LV_COLOR_DEPTH=32
-D HAS_TFT=1 -D HAS_TFT=1
-D HAS_SCREEN=0 -D HAS_SCREEN=1
-D LV_BUILD_TEST=0 -D LV_BUILD_TEST=0
-D LV_USE_LOG=0 -D LV_USE_LOG=0
-D LV_USE_EVDEV=1 -D LV_USE_EVDEV=1

View File

@ -26,7 +26,6 @@ build_flags =
${env:t-deck.build_flags} ${env:t-deck.build_flags}
-D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks -D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks
-D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1
-D MESHTASTIC_EXCLUDE_INPUTBROKER=1
-D MESHTASTIC_EXCLUDE_WEBSERVER=1 -D MESHTASTIC_EXCLUDE_WEBSERVER=1
-D MESHTASTIC_EXCLUDE_SERIAL=1 -D MESHTASTIC_EXCLUDE_SERIAL=1
-D MESHTASTIC_EXCLUDE_SOCKETAPI=1 -D MESHTASTIC_EXCLUDE_SOCKETAPI=1
@ -39,7 +38,7 @@ build_flags =
-D INPUTDRIVER_ENCODER_BTN=0 -D INPUTDRIVER_ENCODER_BTN=0
-D INPUTDRIVER_BUTTON_TYPE=0 -D INPUTDRIVER_BUTTON_TYPE=0
-D HAS_SDCARD -D HAS_SDCARD
-D HAS_SCREEN=0 -D HAS_SCREEN=1
-D HAS_TFT=1 -D HAS_TFT=1
-D USE_I2S_BUZZER -D USE_I2S_BUZZER
-D RAM_SIZE=5120 -D RAM_SIZE=5120

View File

@ -1,6 +1,5 @@
#define TFT_CS 12 #define TFT_CS 12
#ifndef HAS_TFT // for TFT-UI the definitions are in device-ui
#define BUTTON_PIN 0 #define BUTTON_PIN 0
// ST7789 TFT LCD // ST7789 TFT LCD
@ -24,7 +23,6 @@
#define SCREEN_ROTATE #define SCREEN_ROTATE
#define SCREEN_TRANSITION_FRAMERATE 5 #define SCREEN_TRANSITION_FRAMERATE 5
#define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness #define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness
#endif
#define HAS_TOUCHSCREEN 1 #define HAS_TOUCHSCREEN 1
#define SCREEN_TOUCH_INT 16 #define SCREEN_TOUCH_INT 16
@ -34,10 +32,9 @@
#define USE_POWERSAVE #define USE_POWERSAVE
#define SLEEP_TIME 120 #define SLEEP_TIME 120
#ifndef HAS_TFT
#define BUTTON_PIN 0 #define BUTTON_PIN 0
// #define BUTTON_NEED_PULLUP // #define BUTTON_NEED_PULLUP
#endif
#define GPS_DEFAULT_NOT_PRESENT 1 #define GPS_DEFAULT_NOT_PRESENT 1
#define GPS_RX_PIN 44 #define GPS_RX_PIN 44
#define GPS_TX_PIN 43 #define GPS_TX_PIN 43