diff --git a/.gitmodules b/.gitmodules index e6f376a0b..eb08b2291 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "protobufs"] path = protobufs url = https://github.com/meshtastic/protobufs.git +[submodule "lib/device-ui"] + path = lib/device-ui + url = https://github.com/mverch67/device-ui.git diff --git a/lib/device-ui b/lib/device-ui new file mode 160000 index 000000000..de3a8b6e2 --- /dev/null +++ b/lib/device-ui @@ -0,0 +1 @@ +Subproject commit de3a8b6e2503cdc199b6dde9a90c34ffbda72cb6 diff --git a/src/ButtonThread.cpp b/src/ButtonThread.cpp index 84d433285..b4cf46b99 100644 --- a/src/ButtonThread.cpp +++ b/src/ButtonThread.cpp @@ -3,7 +3,6 @@ #include "MeshService.h" #include "PowerFSM.h" #include "RadioLibInterface.h" -#include "buzz.h" #include "graphics/Screen.h" #include "main.h" #include "modules/ExternalNotificationModule.h" diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 33df78462..286f57da5 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -895,7 +895,7 @@ Screen::Screen(ScanI2C::DeviceAddress address, meshtastic_Config_DisplayConfig_O #elif defined(USE_SSD1306) dispdev = new SSD1306Wire(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); -#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014) +#elif (defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014)) && !HAS_TFT dispdev = new TFTDisplay(address.address, -1, -1, geometry, (address.port == ScanI2C::I2CPort::WIRE1) ? HW_I2C::I2C_TWO : HW_I2C::I2C_ONE); #elif defined(USE_EINK) && !defined(USE_EINK_DYNAMICDISPLAY) diff --git a/src/main.cpp b/src/main.cpp index 92c651489..3f3686374 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -94,6 +94,11 @@ AudioThread *audioThread; #include "sharedMem/PacketClient.h" #endif +#ifdef LGFX_TDECK +#include "DeviceScreen.h" +DeviceScreen *screen = nullptr; +#endif + using namespace concurrency; // We always create a screen object, but we only init it if we find the hardware @@ -352,13 +357,17 @@ void setup() #endif #endif -#ifdef T_DECK +#if defined(T_DECK) // enable keyboard pinMode(KB_POWERON, OUTPUT); digitalWrite(KB_POWERON, HIGH); // There needs to be a delay after power on, give LILYGO-KEYBOARD some startup time // otherwise keyboard and touch screen will not work - delay(800); + delay(200); +#ifdef LGFX_TDECK + screen = &DeviceScreen::create(); + screen->init(); +#endif #endif // Currently only the tbeam has a PMU @@ -888,6 +897,11 @@ void setup() PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS powerFSMthread = new PowerFSMThread(); setCPUFast(false); // 80MHz is fine for our slow peripherals + +#ifdef ARDUINO_ARCH_ESP32 + LOG_DEBUG("--- Free heap : %8d bytes ---\n", ESP.getFreeHeap()); + LOG_DEBUG("--- PSRAM : %8d bytes ---\n", ESP.getFreePsram()); +#endif } uint32_t rebootAtMsec; // If not zero we will reboot at this time (used to reboot shortly after the update completes) diff --git a/src/mesh/sharedMem/PacketClient.cpp b/src/mesh/sharedMem/PacketClient.cpp index 82eb4f67e..4ef7b0c9d 100644 --- a/src/mesh/sharedMem/PacketClient.cpp +++ b/src/mesh/sharedMem/PacketClient.cpp @@ -1,5 +1,5 @@ #include "sharedMem/PacketClient.h" -#include "DebugConfiguration.h" +#include "configuration.h" #include "sharedMem/SharedQueue.h" #include diff --git a/src/modules/CannedMessageModule.h b/src/modules/CannedMessageModule.h index 4802be078..2f5b57241 100644 --- a/src/modules/CannedMessageModule.h +++ b/src/modules/CannedMessageModule.h @@ -1,5 +1,5 @@ #pragma once -#if HAS_SCREEN +#if HAS_SCREEN || HAS_TFT #include "ProtobufModule.h" #include "input/InputBroker.h" diff --git a/src/modules/Modules.cpp b/src/modules/Modules.cpp index 2d45868fd..96e3ee30d 100644 --- a/src/modules/Modules.cpp +++ b/src/modules/Modules.cpp @@ -94,7 +94,7 @@ void setupModules() trackballInterruptImpl1 = new TrackballInterruptImpl1(); trackballInterruptImpl1->init(); #endif -#if HAS_SCREEN +#if HAS_SCREEN || HAS_TFT cannedMessageModule = new CannedMessageModule(); #endif #if HAS_TELEMETRY diff --git a/variants/t-deck/platformio.ini b/variants/t-deck/platformio.ini index 14ab09804..6dca51279 100644 --- a/variants/t-deck/platformio.ini +++ b/variants/t-deck/platformio.ini @@ -2,17 +2,29 @@ [env:t-deck] extends = esp32s3_base board = t-deck -upload_protocol = esptool -#upload_port = COM29 - +upload_protocol = esp-builtin +build_flags = ${esp32_base.build_flags} + -D T_DECK + -D HAS_SCREEN=0 + -D HAS_TFT=1 + -D GPS_POWER_TOGGLE + -D LV_LVGL_H_INCLUDE_SIMPLE + -D LV_CONF_INCLUDE_SIMPLE + -D LV_COMP_CONF_INCLUDE_SIMPLE + -D CALIBRATE_TOUCH + -D KB_POWERON=10 + -D LGFX_DRIVER=LGFX_TDECK + -D LGFX_DRIVER_INC=\"LGFX_T_DECK.h\" + -D VIEW_320x240 + -D VIEW_CLASS=TFTView_320x240 + -D VIEW_CLASS_INC=\"TFTView_320x240.h\" + -D USE_DOUBLE_BUFFER + -I lib/device-ui/generated/ui_320x240 + -I variants/t-deck build_src_filter = ${esp32_base.build_src_filter} + -build_flags = ${esp32_base.build_flags} - -DT_DECK - -DBOARD_HAS_PSRAM - -DGPS_POWER_TOGGLE - -Ivariants/t-deck - -lib_deps = ${esp32s3_base.lib_deps} - lovyan03/LovyanGFX@^1.1.9 + +<../lib/device-ui/generated/ui_320x240> +libdeps = + ${esp32_base.lib_deps} + lovyan03/LovyanGFX@^1.1.12 earlephilhower/ESP8266Audio@^1.9.7 - earlephilhower/ESP8266SAM@^1.0.1 \ No newline at end of file + earlephilhower/ESP8266SAM@^1.0.1