Skip to content

Commit

Permalink
Refactoring LVGL integration
Browse files Browse the repository at this point in the history
Co-Authored-By: belese <2719742+belese@users.noreply.github.com>
  • Loading branch information
thinkyhead and belese committed Aug 4, 2023
1 parent fe4819a commit 5f5e59d
Show file tree
Hide file tree
Showing 14 changed files with 1,573 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:

# Native
- linux_native
- linux_native_sdl

# AVR
- mega2560
Expand Down
18 changes: 18 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3187,6 +3187,9 @@
//#define EXTUI_LOCAL_BEEPER // Enables use of local Beeper pin with external display
#endif

// Test LVGL UI
//#define EXTUI_LVGL_TEST

//=============================================================================
//=============================== Graphical TFTs ==============================
//=============================================================================
Expand Down Expand Up @@ -3399,6 +3402,21 @@
//
//#define EASYTHREED_UI

//
// Simple DirectMedia Layer (SDL) Controller (Native / Simulator with LVGL UI only)
//
//#define SDL_CONTROLLER
#if ENABLED(SDL_CONTROLLER)
// SDL Display Resolution
#define TFT_WIDTH 480
#define TFT_HEIGHT 320

// SDL Input Devices
#define SDL_MOUSE_INPUT
#define SDL_MOUSEWHEEL_ENCODER
#define SDL_KEYBOARD_INPUT
#endif

//=============================================================================
//=============================== Extra Features ==============================
//=============================================================================
Expand Down
5 changes: 5 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,11 @@
#endif
#endif

#if HAS_LVGL
#define LVGL_H_BUFFER_LINES 10 // Number of vertical lines for LVGL buffer size. The minimum value is 10.
//#define LVGL_DOUBLE_BUFFERING // Draw into an off-screen buffer for cleaner screen updates.
#endif

// LCD Print Progress options. Multiple times may be displayed in turn.
#if HAS_DISPLAY && ANY(HAS_MEDIA, SET_PROGRESS_MANUALLY)
#define SHOW_PROGRESS_PERCENT // Show print progress percentage (doesn't affect progress bar)
Expand Down
6 changes: 5 additions & 1 deletion Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
#endif

// Extensible UI serial touch screens. (See src/lcd/extui)
#if ANY(HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT, TOUCH_UI_FTDI_EVE)
#if ANY(HAS_DGUS_LCD, MALYAN_LCD, ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, NEXTION_TFT, TOUCH_UI_FTDI_EVE, EXTUI_LVGL_TEST)
#define IS_EXTUI 1
#define EXTENSIBLE_UI
#endif
Expand Down Expand Up @@ -1708,6 +1708,10 @@
#endif
#endif

#if ENABLED(EXTUI_LVGL_TEST) && ANY(HAS_FSMC_TFT, HAS_SPI_TFT, SDL_CONTROLLER)
#define HAS_LVGL 1
#endif

#if ANY(HAS_SPI_TFT, HAS_FSMC_TFT, HAS_LTDC_TFT)
#include "../lcd/tft_io/tft_orientation.h" // for TFT_COLOR_UI_PORTRAIT
#endif
Expand Down
12 changes: 12 additions & 0 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,17 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#error "LIGHTWEIGHT_UI requires a U8GLIB_ST7920-based display."
#endif

/**
* Simple DirectMedia Layer (SDL) Display
*/
#if ENABLED(HAS_SDL_DISPLAY) && DISABLED(HAS_LVGL)
#error "SDL Display requires a UI with LVGL support."
#endif

#if defined(LVGL_H_BUFFER_LINES) && LVGL_H_BUFFER_LINES < 10
#error "LVGL_H_BUFFER_LINES must be set to a value of 10 or larger."
#endif

/**
* SD Card Settings
*/
Expand Down Expand Up @@ -2570,6 +2581,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
* Make sure only one display is enabled
*/
#if 1 < 0 \
+ ENABLED(SDL_CONTROLLER) \
+ ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
+ ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) \
+ (ENABLED(U8GLIB_SSD1306) && DISABLED(IS_U8GLIB_SSD1306)) \
Expand Down
Loading

0 comments on commit 5f5e59d

Please sign in to comment.