Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build_windows_bin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
mingw-w64-ucrt-x86_64-jsoncpp
mingw-w64-ucrt-x86_64-openssl
mingw-w64-ucrt-x86_64-libusb
mingw-w64-ucrt-x86_64-SDL2
mingw-w64-ucrt-x86_64-cmake
mingw-w64-ucrt-x86_64-ninja
git
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ lib_deps =
[device-ui_base]
lib_deps =
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
https://github.com/meshtastic/device-ui/archive/ef573c368767625ffbe8c32cf921ea7366f2dd53.zip
https://github.com/meshtastic/device-ui/archive/58abaa541411eb38d813c925c4b3296f0a297169.zip

; Common libs for environmental measurements in telemetry module
[environmental_base]
Expand Down
33 changes: 21 additions & 12 deletions src/graphics/tftSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ void tft_task_handler(void *param = nullptr)
}
}

#if defined(ARCH_PORTDUINO)
void tft_thread_entry(void)
{
// SDL expects window/event/render work on a single thread.
deviceScreen->init(new PacketClient);
tft_task_handler();
}
#endif

void tftSetup(void)
{
#ifndef ARCH_PORTDUINO
Expand All @@ -47,27 +56,28 @@ void tftSetup(void)
#else
if (portduino_config.displayPanel != no_screen) {
DisplayDriverConfig displayConfig;
static char *panels[] = {"NOSCREEN", "X11", "FB", "ST7789", "ST7735", "ST7735S",
"ST7796", "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D"};
static char *panels[] = {"NOSCREEN", "X11", "SDL", "FB", "ST7789", "ST7735", "ST7735S",
"ST7796", "ILI9341", "ILI9342", "ILI9486", "ILI9488", "HX8357D", "HUB75"};
static char *touch[] = {"NOTOUCH", "XPT2046", "STMPE610", "GT911", "FT5x06"};
#if defined(USE_X11)
if (portduino_config.displayPanel == x11) {
if (portduino_config.displayPanel == sdl) {
if (portduino_config.displayWidth && portduino_config.displayHeight)
displayConfig = DisplayDriverConfig(DisplayDriverConfig::device_t::SDL, (uint16_t)portduino_config.displayWidth,
(uint16_t)portduino_config.displayHeight, portduino_config.displayZoom);
else
displayConfig.device(DisplayDriverConfig::device_t::SDL);
} else if (portduino_config.displayPanel == x11) {
if (portduino_config.displayWidth && portduino_config.displayHeight)
displayConfig = DisplayDriverConfig(DisplayDriverConfig::device_t::X11, (uint16_t)portduino_config.displayWidth,
(uint16_t)portduino_config.displayHeight);
else
displayConfig.device(DisplayDriverConfig::device_t::X11);
} else
#elif defined(USE_FRAMEBUFFER)
if (portduino_config.displayPanel == fb) {
} else if (portduino_config.displayPanel == fb) {
if (portduino_config.displayWidth && portduino_config.displayHeight)
displayConfig = DisplayDriverConfig(DisplayDriverConfig::device_t::FB, (uint16_t)portduino_config.displayWidth,
(uint16_t)portduino_config.displayHeight);
else
displayConfig.device(DisplayDriverConfig::device_t::FB);
} else
#endif
{
} else {
displayConfig.device(DisplayDriverConfig::device_t::CUSTOM_TFT)
.panel(DisplayDriverConfig::panel_config_t{.type = panels[portduino_config.displayPanel],
.panel_width = (uint16_t)portduino_config.displayWidth,
Expand Down Expand Up @@ -121,7 +131,6 @@ void tftSetup(void)
}
deviceScreen = &DeviceScreen::create(&displayConfig);
PacketAPI::create(PacketServer::init());
deviceScreen->init(new PacketClient);
} else {
LOG_INFO("Running without TFT display!");
}
Expand All @@ -133,7 +142,7 @@ void tftSetup(void)
endSleepObserver.observe(&notifyLightSleepEnd);
xTaskCreatePinnedToCore(tft_task_handler, "tft", TFT_TASK_STACK_SIZE, NULL, 1, NULL, 0);
#elif defined(ARCH_PORTDUINO)
std::thread *tft_task = new std::thread([] { tft_task_handler(); });
std::thread *tft_task = new std::thread([] { tft_thread_entry(); });
#endif
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,8 +1476,8 @@ void loop()
rebootAtMsec = millis() + 25;
}
}
#if HAS_TFT
if (screen && portduino_config.displayPanel == x11 &&
#if HAS_TFT && HAS_SCREEN
if (screen && (portduino_config.displayPanel == sdl) &&
config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
auto dispdev = screen->getDisplayDevice();
if (dispdev)
Expand Down
1 change: 1 addition & 0 deletions src/platform/portduino/PortduinoGlue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ bool loadConfig(const char *configPath)
}
portduino_config.displayHeight = yamlConfig["Display"]["Height"].as<int>(0);
portduino_config.displayWidth = yamlConfig["Display"]["Width"].as<int>(0);
portduino_config.displayZoom = yamlConfig["Display"]["Zoom"].as<float>(1.0);

readGPIOFromYaml(yamlConfig["Display"]["DC"], portduino_config.displayDC, -1);
readGPIOFromYaml(yamlConfig["Display"]["CS"], portduino_config.displayCS, -1);
Expand Down
29 changes: 23 additions & 6 deletions src/platform/portduino/PortduinoGlue.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@ inline const std::unordered_map<std::string, std::string> configProducts = {
{"RAK6421-13300-S1", "lora-RAK6421-13300-slot1.yaml"},
{"RAK6421-13300-S2", "lora-RAK6421-13300-slot2.yaml"}};

enum screen_modules { no_screen, x11, fb, st7789, st7735, st7735s, st7796, ili9341, ili9342, ili9486, ili9488, hx8357d, hub75 };
enum screen_modules {
no_screen,
x11,
sdl,
fb,
st7789,
st7735,
st7735s,
st7796,
ili9341,
ili9342,
ili9486,
ili9488,
hx8357d,
hub75
};
enum touchscreen_modules { no_touchscreen, xpt2046, stmpe610, gt911, ft5x06 };
enum portduino_log_level { level_error, level_warn, level_info, level_debug, level_trace };
enum lora_module_enum {
Expand Down Expand Up @@ -80,10 +95,10 @@ extern struct portduino_config_struct {
{use_simradio, "sim"}, {use_autoconf, "auto"}, {use_rf95, "RF95"}, {use_sx1262, "sx1262"}, {use_sx1268, "sx1268"},
{use_sx1280, "sx1280"}, {use_lr1110, "lr1110"}, {use_lr1120, "lr1120"}, {use_lr1121, "lr1121"}, {use_llcc68, "LLCC68"}};

std::map<screen_modules, std::string> screen_names = {{x11, "X11"}, {fb, "FB"}, {st7789, "ST7789"},
{st7735, "ST7735"}, {st7735s, "ST7735S"}, {st7796, "ST7796"},
{ili9341, "ILI9341"}, {ili9342, "ILI9342"}, {ili9486, "ILI9486"},
{ili9488, "ILI9488"}, {hx8357d, "HX8357D"}, {hub75, "HUB75"}};
std::map<screen_modules, std::string> screen_names = {
{x11, "X11"}, {sdl, "SDL"}, {fb, "FB"}, {st7789, "ST7789"}, {st7735, "ST7735"},
{st7735s, "ST7735S"}, {st7796, "ST7796"}, {ili9341, "ILI9341"}, {ili9342, "ILI9342"}, {ili9486, "ILI9486"},
{ili9488, "ILI9488"}, {hx8357d, "HX8357D"}, {hub75, "HUB75"}};

lora_module_enum lora_module;
bool has_rfswitch_table = false;
Expand Down Expand Up @@ -134,6 +149,7 @@ extern struct portduino_config_struct {
screen_modules displayPanel = no_screen;
int displayWidth = 0;
int displayHeight = 0;
float displayZoom = 1.0;
bool displayRGBOrder = false;
bool displayBacklightInvert = false;
bool displayRotate = false;
Expand Down Expand Up @@ -431,6 +447,8 @@ extern struct portduino_config_struct {
out << YAML::Key << "Width" << YAML::Value << displayWidth;
if (displayHeight)
out << YAML::Key << "Height" << YAML::Value << displayHeight;
if (displayZoom != 1.0)
out << YAML::Key << "Zoom" << YAML::Value << displayZoom;
if (displayRGBOrder)
out << YAML::Key << "RGBOrder" << YAML::Value << true;
if (displayBacklightInvert)
Expand All @@ -445,7 +463,6 @@ extern struct portduino_config_struct {
out << YAML::Key << "OffsetY" << YAML::Value << displayOffsetY;

out << YAML::Key << "OffsetRotate" << YAML::Value << displayOffsetRotate;

if (displayPanel == hub75) {
out << YAML::Key << "HUB75" << YAML::Value << YAML::BeginMap;
out << YAML::Key << "HardwareMapping" << YAML::Value << hub75_hardware_mapping;
Expand Down
41 changes: 33 additions & 8 deletions variants/native/portduino/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ lib_deps =
${device-ui_base.lib_deps}
build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunction-sections -fdata-sections -Wl,--gc-sections
-D RAM_SIZE=16384
-D USE_X11=1
-D HAS_TFT=1
-D HAS_SCREEN=1
-D LV_CACHE_DEF_SIZE=6291456
-D LV_BUILD_TEST=0
-D USE_X11=1
-D USE_SDL=1
-D LV_USE_EVDEV=1
-D LV_USE_LIBINPUT=1
; -D LV_CACHE_DEF_SIZE=6291456
-D LV_BUILD_TEST=0
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
Expand Down Expand Up @@ -261,7 +263,7 @@ lib_ignore = ${env:native-macos.lib_ignore}
; firmware builds as gnu17/gnu++17 with GNU extensions throughout.
;
; Prerequisites (MSYS2, https://www.msys2.org/):
; pacman -S --needed mingw-w64-ucrt-x86_64-{gcc,pkgconf,yaml-cpp,libuv,jsoncpp,openssl,libusb}
; pacman -S --needed mingw-w64-ucrt-x86_64-{gcc,pkgconf,yaml-cpp,libuv,jsoncpp,openssl,libusb,SDL2}
;
; argp is not packaged for MSYS2's mingw environments (msys/libargp links the
; msys-2.0.dll emulation layer and can't be used for a native binary), yet
Expand Down Expand Up @@ -305,7 +307,28 @@ build_flags = ${portduino_base.build_flags_common}
; screen renderer; EXCLUDE_SCREEN gates the `screen->...` hooks in the sensors.
-DHAS_SCREEN=0
-DMESHTASTIC_EXCLUDE_SCREEN=1
!pkg-config --cflags --libs openssl --silence-errors || :
; MUI
-D RAM_SIZE=16384
-D HAS_TFT=1
-D USE_SDL=1
-D LV_USE_LOG=0
-D LV_USE_EVDEV=1
; -D LV_CACHE_DEF_SIZE=6291456
-D LV_BUILD_TEST=0
-D LV_LVGL_H_INCLUDE_SIMPLE
-D LV_CONF_INCLUDE_SIMPLE
-D LV_COMP_CONF_INCLUDE_SIMPLE
-D USE_LOG_DEBUG
-D LOG_DEBUG_INC=\"DebugConfiguration.h\"
-D USE_PACKET_API
-D VIEW_320x240
; NOTE: PlatformIO invokes this env with a Windows shell, use `cmd /c exit 0` as a Windows-safe fallback.
; pkg-config must be in user environment path, e.g. C:\msys64\ucrt64\bin
; and the .pc files must be in PKG_CONFIG_PATH, e.g. C:\msys64\ucrt64\lib\pkgconfig
!pkg-config --cflags --libs openssl --silence-errors || cmd /c exit 0
!pkg-config --cflags-only-I --libs --static sdl2 --silence-errors || cmd /c exit 0
!pkg-config --cflags --libs --static libcurl --silence-errors || cmd /c exit 0
-Wl,-subsystem,console
Comment thread
coderabbitai[bot] marked this conversation as resolved.
build_unflags =
-fPIC ; ignored on Windows, where all code is position-independent
; Static link, so meshtasticd.exe stands alone and can't be hijacked by a stray
Expand All @@ -320,12 +343,14 @@ build_src_filter = ${native_base.build_src_filter}
-<input/LinuxInputImpl.cpp>
-<graphics/Panel_sdl.cpp>
-<graphics/TFTDisplay.cpp>
; LovyanGFX includes <malloc.h> and is only needed by the TFT variants. The pine64
; libch341 is the libusb backend that libpinedio_ch341dll.c replaces; keeping both

lib_deps =
${native_base.lib_deps}
${device-ui_base.lib_deps}
; Pine libch341 is the libusb backend that libpinedio_ch341dll.c replaces; keeping both
; would duplicate every pinedio_* symbol.
lib_ignore =
${portduino_base.lib_ignore}
LovyanGFX
Pine libch341-spi Userspace library

; ---------------------------------------------------------------------------
Expand Down
Loading