diff --git a/src/main.cpp b/src/main.cpp index 0a08dec69..de6d175f8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -953,9 +953,11 @@ void setup() // the current region name) #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) - screen->setup(); + if (screen) + screen->setup(); #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(); } #else @@ -964,8 +966,8 @@ void setup() #endif #endif if (screen) { - screen->print("Started...\n"); - } + screen->print("Started...\n"); + } #ifdef PIN_PWR_DELAY_MS // This may be required to give the peripherals time to power up. diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index f5e815765..f0dafa332 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -104,7 +104,9 @@ void setupModules() { if (config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) { #if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER - inputBroker = new InputBroker(); + if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) { + inputBroker = new InputBroker(); + } #endif #if !MESHTASTIC_EXCLUDE_ADMIN adminModule = new AdminModule(); @@ -152,36 +154,40 @@ void setupModules() // Example: Put your module here // new ReplyModule(); #if (HAS_BUTTON || ARCH_PORTDUINO) && !MESHTASTIC_EXCLUDE_INPUTBROKER - rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1(); - if (!rotaryEncoderInterruptImpl1->init()) { - delete rotaryEncoderInterruptImpl1; - rotaryEncoderInterruptImpl1 = nullptr; - } - upDownInterruptImpl1 = new UpDownInterruptImpl1(); - if (!upDownInterruptImpl1->init()) { - delete upDownInterruptImpl1; - upDownInterruptImpl1 = nullptr; - } + + if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) { + rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1(); + if (!rotaryEncoderInterruptImpl1->init()) { + delete rotaryEncoderInterruptImpl1; + rotaryEncoderInterruptImpl1 = nullptr; + } + upDownInterruptImpl1 = new UpDownInterruptImpl1(); + if (!upDownInterruptImpl1->init()) { + delete upDownInterruptImpl1; + upDownInterruptImpl1 = nullptr; + } #if HAS_SCREEN - // In order to have the user button dismiss the canned message frame, this class lightly interacts with the Screen class - scanAndSelectInput = new ScanAndSelectInput(); - if (!scanAndSelectInput->init()) { - delete scanAndSelectInput; - scanAndSelectInput = nullptr; - } + // In order to have the user button dismiss the canned message frame, this class lightly interacts with the Screen + // class + scanAndSelectInput = new ScanAndSelectInput(); + if (!scanAndSelectInput->init()) { + delete scanAndSelectInput; + scanAndSelectInput = nullptr; + } #endif - cardKbI2cImpl = new CardKbI2cImpl(); - cardKbI2cImpl->init(); + cardKbI2cImpl = new CardKbI2cImpl(); + cardKbI2cImpl->init(); #ifdef INPUTBROKER_MATRIX_TYPE - kbMatrixImpl = new KbMatrixImpl(); - kbMatrixImpl->init(); + kbMatrixImpl = new KbMatrixImpl(); + kbMatrixImpl->init(); #endif // INPUTBROKER_MATRIX_TYPE #ifdef INPUTBROKER_SERIAL_TYPE - aSerialKeyboardImpl = new SerialKeyboardImpl(); - aSerialKeyboardImpl->init(); + aSerialKeyboardImpl = new SerialKeyboardImpl(); + aSerialKeyboardImpl->init(); #endif // INPUTBROKER_MATRIX_TYPE + } #endif // HAS_BUTTON #if ARCH_PORTDUINO if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) { @@ -190,14 +196,19 @@ void setupModules() } #endif #if HAS_TRACKBALL && !MESHTASTIC_EXCLUDE_INPUTBROKER - trackballInterruptImpl1 = new TrackballInterruptImpl1(); - trackballInterruptImpl1->init(); + if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) { + trackballInterruptImpl1 = new TrackballInterruptImpl1(); + trackballInterruptImpl1->init(); + } #endif + LOG_DEBUG("location5"); #ifdef INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE expressLRSFiveWayInput = new ExpressLRSFiveWay(); #endif #if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES - cannedMessageModule = new CannedMessageModule(); + if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) { + cannedMessageModule = new CannedMessageModule(); + } #endif #if ARCH_PORTDUINO new HostMetricsModule(); diff --git a/variants/portduino/platformio.ini b/variants/portduino/platformio.ini index 4f1d25f02..6da827508 100644 --- a/variants/portduino/platformio.ini +++ b/variants/portduino/platformio.ini @@ -56,7 +56,7 @@ build_flags = ${native_base.build_flags} -Os -ffunction-sections -fdata-sections -D USE_FRAMEBUFFER=1 -D LV_COLOR_DEPTH=32 -D HAS_TFT=1 - -D HAS_SCREEN=0 + -D HAS_SCREEN=1 -D LV_BUILD_TEST=0 -D LV_USE_LOG=0 -D LV_USE_EVDEV=1 diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 14fbee6cf..48d2eef89 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -26,7 +26,6 @@ build_flags = ${env:t-deck.build_flags} -D CONFIG_DISABLE_HAL_LOCKS=1 ; "feels" to be a bit more stable without locks -D MESHTASTIC_EXCLUDE_CANNEDMESSAGES=1 - -D MESHTASTIC_EXCLUDE_INPUTBROKER=1 -D MESHTASTIC_EXCLUDE_WEBSERVER=1 -D MESHTASTIC_EXCLUDE_SERIAL=1 -D MESHTASTIC_EXCLUDE_SOCKETAPI=1 @@ -39,7 +38,7 @@ build_flags = -D INPUTDRIVER_ENCODER_BTN=0 -D INPUTDRIVER_BUTTON_TYPE=0 -D HAS_SDCARD - -D HAS_SCREEN=0 + -D HAS_SCREEN=1 -D HAS_TFT=1 -D USE_I2S_BUZZER -D RAM_SIZE=5120 diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index a21c786b3..d63e235b0 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -1,6 +1,5 @@ #define TFT_CS 12 -#ifndef HAS_TFT // for TFT-UI the definitions are in device-ui #define BUTTON_PIN 0 // ST7789 TFT LCD @@ -24,7 +23,6 @@ #define SCREEN_ROTATE #define SCREEN_TRANSITION_FRAMERATE 5 #define BRIGHTNESS_DEFAULT 130 // Medium Low Brightness -#endif #define HAS_TOUCHSCREEN 1 #define SCREEN_TOUCH_INT 16 @@ -34,10 +32,9 @@ #define USE_POWERSAVE #define SLEEP_TIME 120 -#ifndef HAS_TFT #define BUTTON_PIN 0 // #define BUTTON_NEED_PULLUP -#endif + #define GPS_DEFAULT_NOT_PRESENT 1 #define GPS_RX_PIN 44 #define GPS_TX_PIN 43