Skip to content
Open
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
2 changes: 2 additions & 0 deletions include/graphics/driver/LGFXDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ template <class LGFX> void LGFXDriver<LGFX>::display_flush(lv_display_t *disp, c
{
uint32_t w = lv_area_get_width(area);
uint32_t h = lv_area_get_height(area);
#if !defined(LGFX_SKIP_RGB565_SWAP)
lv_draw_sw_rgb565_swap(px_map, w * h);
#endif
lgfx->pushImage(area->x1, area->y1, w, h, (uint16_t *)px_map);
lv_display_flush_ready(disp);
}
Expand Down
22 changes: 22 additions & 0 deletions include/graphics/driver/SDLDriver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once
#include "graphics/driver/DisplayDriver.h"

/**
* @brief For simulation on pc/raspberry
* This class provides an SDL GUI on the local desktop; dimensions are defined
* in lv_drv_conf.h Usage: define USE_SDL=1 for the rasbian/portduino target and
* link with -lSDL
*/
Comment on lines +4 to +9

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -- '-lSDL(2)?\b|sdl2-config|pkg-config.*sdl2|SDL2::SDL2' .

Repository: meshtastic/device-ui

Length of output: 217


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== SDLDriver.h =="
cat -n include/graphics/driver/SDLDriver.h

echo
echo "== SDL-related files =="
git ls-files | rg '(^|/)(CMakeLists\.txt|.*\.cmake|.*\.(h|hpp|c|cc|cpp))$' | rg 'SDL|sdl|graphics/driver'

echo
echo "== SDL includes/usages =="
rg -n --glob '!**/build/**' --glob '!**/dist/**' --glob '!**/node_modules/**' 'SDL2?|sdl2-config|pkg-config.*sdl2|SDL_' include src .github CMakeLists.txt *.cmake

echo
echo "== Build/link config mentions =="
rg -n --glob '!**/build/**' --glob '!**/dist/**' --glob '!**/node_modules/**' '-lSDL(2)?\b|SDL2::SDL2|PkgConfig::.*SDL2|find_package\(SDL2|find_package\(SDL' .

Repository: meshtastic/device-ui

Length of output: 3592


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== SDL driver implementation =="
cat -n source/graphics/driver/SDLDriver.cpp

echo
echo "== SDL2 and linker config mentions =="
rg -n --glob '!**/build/**' --glob '!**/dist/**' --glob '!**/node_modules/**' \
  'SDL2|sdl2-config|pkg-config.*sdl2|find_package\(SDL|find_package\(SDL2|SDL2::SDL2|PkgConfig::.*SDL2|SDL_INCLUDE|SDL_LIB|USE_SDL|LV_USE_SDL' \
  include source .

echo
echo "== Build files =="
git ls-files | rg '(^|/)(CMakeLists\.txt|.*\.cmake|Makefile|GNUmakefile|Kconfig|platformio\.ini)$'

Repository: meshtastic/device-ui

Length of output: 4303


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== CMakeLists.txt =="
cat -n CMakeLists.txt

echo
echo "== cmake/Portduino.cmake =="
cat -n cmake/Portduino.cmake

echo
echo "== cmake/LVGL.cmake =="
cat -n cmake/LVGL.cmake

echo
echo "== SDL build references =="
rg -n --glob '!**/build/**' --glob '!**/dist/**' --glob '!**/node_modules/**' \
  'SDL2|SDL|sdl2-config|pkg-config|target_link_libraries|find_package' CMakeLists.txt cmake include source

Repository: meshtastic/device-ui

Length of output: 10711


Document the SDL2 linker flag

This code uses SDL2 (<SDL2/SDL.h> and LV_SDL_INCLUDE_PATH), so -lSDL is misleading. Update the note to point to SDL2 linking (-lSDL2 or the project’s SDL2 build config).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@include/graphics/driver/SDLDriver.h` around lines 4 - 9, Update the
documentation comment above the SDL driver class to reference SDL2 linking,
replacing the misleading -lSDL flag with -lSDL2 or the project’s established
SDL2 build configuration. Keep the existing usage and platform guidance
unchanged.

class SDLDriver : public DisplayDriver
{
public:
static SDLDriver &create(uint16_t width, uint16_t height);
void init(DeviceGUI *gui) override;
void task_handler(void) override;
virtual ~SDLDriver() {}

private:
SDLDriver(uint16_t width, uint16_t height);

static SDLDriver *SDLdriver;
};
7 changes: 3 additions & 4 deletions include/graphics/driver/TFTDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ template <class TFT> void TFTDriver<TFT>::init(DeviceGUI *gui)
lv_tick_set_cb(xTaskGetTickCount);
#else
// Create esp timer to call lvgl lv_tick_inc()
const esp_timer_create_args_t lvgl_tick_timer_args = {.callback = [](void *arg) { lv_tick_inc(20); }, .name = "lvgl_tick"};
const esp_timer_create_args_t lvgl_tick_timer_args = {.callback = [](void *arg) { lv_tick_inc(5); }, .name = "lvgl_tick"};
esp_timer_handle_t lvgl_tick_timer = nullptr;
ESP_ERROR_CHECK(esp_timer_create(&lvgl_tick_timer_args, &lvgl_tick_timer));
ESP_ERROR_CHECK(esp_timer_start_periodic(lvgl_tick_timer, 20000));
ESP_ERROR_CHECK(esp_timer_start_periodic(lvgl_tick_timer, 5000));
#endif
#elif defined(ARCH_PORTDUINO)
// for linux we use lv_tick_inc() in DeviceGUI::task_handler()
// lv_tick_set_cb([]() -> uint32_t { return millis(); });
lv_tick_set_cb([]() -> uint32_t { return millis(); });
#endif
}
1 change: 1 addition & 0 deletions include/graphics/driver/X11Driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class X11Driver : public DisplayDriver
public:
static X11Driver &create(uint16_t width, uint16_t height);
void init(DeviceGUI *gui) override;
void task_handler(void) override;
virtual ~X11Driver() {}

private:
Expand Down
Loading
Loading