From e7954d0d91d5824dc7faa3d28f59769748e45d9d Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:45:39 +0200 Subject: [PATCH 1/8] add SDL support, use lvgl 9.4.0(dev) --- include/graphics/driver/SDLDriver.h | 22 + include/graphics/driver/TFTDriver.h | 7 +- include/graphics/driver/X11Driver.h | 1 + include/lv_conf.h | 545 ++++++++++++++---- library.json | 2 +- source/graphics/DeviceGUI.cpp | 20 - source/graphics/TFT/TFTView_320x240.cpp | 415 +++++++------ .../graphics/driver/DisplayDriverFactory.cpp | 14 +- source/graphics/driver/SDLDriver.cpp | 66 +++ source/graphics/driver/X11Driver.cpp | 21 + 10 files changed, 740 insertions(+), 373 deletions(-) create mode 100644 include/graphics/driver/SDLDriver.h create mode 100644 source/graphics/driver/SDLDriver.cpp diff --git a/include/graphics/driver/SDLDriver.h b/include/graphics/driver/SDLDriver.h new file mode 100644 index 00000000..1f0ce966 --- /dev/null +++ b/include/graphics/driver/SDLDriver.h @@ -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 + */ +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; +}; \ No newline at end of file diff --git a/include/graphics/driver/TFTDriver.h b/include/graphics/driver/TFTDriver.h index ab26ffa8..f0ca6d6d 100644 --- a/include/graphics/driver/TFTDriver.h +++ b/include/graphics/driver/TFTDriver.h @@ -25,13 +25,12 @@ template void TFTDriver::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 } diff --git a/include/graphics/driver/X11Driver.h b/include/graphics/driver/X11Driver.h index 8df5f6fc..44a51371 100644 --- a/include/graphics/driver/X11Driver.h +++ b/include/graphics/driver/X11Driver.h @@ -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: diff --git a/include/lv_conf.h b/include/lv_conf.h index 9b10305c..f4055240 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -100,6 +100,7 @@ * - LV_OS_RTTHREAD * - LV_OS_WINDOWS * - LV_OS_MQX + * - LV_OS_SDL2 * - LV_OS_CUSTOM */ #define LV_USE_OS LV_OS_NONE @@ -139,10 +140,25 @@ /*The target buffer size for simple layer chunks.*/ #define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/ -/* The stack size of the drawing thread. +/* Limit the max allocated memory for simple and transformed layers. + * It should be at least `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` sized but if transformed layers are also used + * it should be enough to store the largest widget too (width x height x 4 area). + * Set it to 0 to have no limit. */ +#define LV_DRAW_LAYER_MAX_MEMORY 0 /**< No limit by default [bytes]*/ + +/** Stack size of drawing thread. * NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more. */ -#define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /*[bytes]*/ +#define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /**< [bytes]*/ + +/** Thread priority of the drawing task. + * Higher values mean higher priority. + * Can use values from lv_thread_prio_t enum in lv_os.h: LV_THREAD_PRIO_LOWEST, + * LV_THREAD_PRIO_LOW, LV_THREAD_PRIO_MID, LV_THREAD_PRIO_HIGH, LV_THREAD_PRIO_HIGHEST + * Make sure the priority value aligns with the OS-specific priority levels. + * On systems with limited priority levels (e.g., FreeRTOS), a higher value can improve + * rendering performance but might cause other tasks to starve. */ +#define LV_DRAW_THREAD_PRIO LV_THREAD_PRIO_HIGH #define LV_USE_DRAW_SW 1 #if LV_USE_DRAW_SW == 1 @@ -155,18 +171,24 @@ */ #define LV_DRAW_SW_SUPPORT_RGB565 1 + #define LV_DRAW_SW_SUPPORT_RGB565_SWAPPED 1 #define LV_DRAW_SW_SUPPORT_RGB565A8 1 #define LV_DRAW_SW_SUPPORT_RGB888 1 #define LV_DRAW_SW_SUPPORT_XRGB8888 1 #define LV_DRAW_SW_SUPPORT_ARGB8888 1 + #define LV_DRAW_SW_SUPPORT_ARGB8888_PREMULTIPLIED 1 #define LV_DRAW_SW_SUPPORT_L8 1 #define LV_DRAW_SW_SUPPORT_AL88 1 #define LV_DRAW_SW_SUPPORT_A8 1 #define LV_DRAW_SW_SUPPORT_I1 1 - /* Set the number of draw unit. - * > 1 requires an operating system enabled in `LV_USE_OS` - * > 1 means multiple threads will render the screen in parallel */ + /* The threshold of the luminance to consider a pixel as + * active in indexed color format */ + #define LV_DRAW_SW_I1_LUM_THRESHOLD 127 + + /** Set number of draw units. + * - > 1 requires operating system to be enabled in `LV_USE_OS`. + * - > 1 means multiple threads will render the screen in parallel. */ #define LV_DRAW_SW_DRAW_UNIT_CNT 1 /* Use Arm-2D to accelerate the sw render */ @@ -202,28 +224,28 @@ #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 0 #endif -/* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */ -#define LV_USE_DRAW_VGLITE 0 - -#if LV_USE_DRAW_VGLITE - /* Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */ - #define LV_USE_VGLITE_BLIT_SPLIT 0 +/*Use TSi's aka (Think Silicon) NemaGFX */ +#define LV_USE_NEMA_GFX 0 - #if LV_USE_OS - /* Use additional draw thread for VG-Lite processing.*/ - #define LV_USE_VGLITE_DRAW_THREAD 1 - - #if LV_USE_VGLITE_DRAW_THREAD - /* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */ - #define LV_USE_VGLITE_DRAW_ASYNC 1 - #endif +#if LV_USE_NEMA_GFX + /** Select which NemaGFX HAL to use. Possible options: + * - LV_NEMA_HAL_CUSTOM + * - LV_NEMA_HAL_STM32 */ + #define LV_USE_NEMA_HAL LV_NEMA_HAL_CUSTOM + #if LV_USE_NEMA_HAL == LV_NEMA_HAL_STM32 + #define LV_NEMA_STM32_HAL_INCLUDE #endif - /* Enable VGLite asserts. */ - #define LV_USE_VGLITE_ASSERT 0 + /*Enable Vector Graphics Operations. Available only if NemaVG library is present*/ + #define LV_USE_NEMA_VG 0 + #if LV_USE_NEMA_VG + /*Define application's resolution used for VG related buffer allocation */ + #define LV_NEMA_GFX_MAX_RESX 800 + #define LV_NEMA_GFX_MAX_RESY 600 + #endif #endif -/* Use NXP's PXP on iMX RTxxx platforms. */ +/** Use NXP's PXP on iMX RTxxx platforms. */ #define LV_USE_PXP 0 #if LV_USE_PXP @@ -242,11 +264,33 @@ #define LV_USE_PXP_ASSERT 0 #endif -/* Use Renesas Dave2D on RA platforms. */ +/** Use NXP's G2D on MPU platforms. */ +#define LV_USE_DRAW_G2D 0 + +#if LV_USE_DRAW_G2D + /** Maximum number of buffers that can be stored for G2D draw unit. + * Includes the frame buffers and assets. */ + #define LV_G2D_HASH_TABLE_SIZE 50 + + #if LV_USE_OS + /** Use additional draw thread for G2D processing.*/ + #define LV_USE_G2D_DRAW_THREAD 1 + #endif + + /** Enable G2D asserts. */ + #define LV_USE_G2D_ASSERT 0 +#endif + +/** Use Renesas Dave2D on RA platforms. */ #define LV_USE_DRAW_DAVE2D 0 /* Draw using cached SDL textures*/ -#define LV_USE_DRAW_SDL 0 +#ifndef USE_SDL +#define LV_USE_SDL 0 +#else +#define LV_USE_SDL USE_SDL +#endif +#define LV_USE_DRAW_SDL LV_USE_SDL /* Use VG-Lite GPU. */ #define LV_USE_DRAW_VG_LITE 0 @@ -264,7 +308,7 @@ /* Enable border to simulate shadow * NOTE: which usually improves performance, * but does not guarantee the same rendering quality as the software. */ - #define LV_VG_LITE_USE_BOX_SHADOW 0 + #define LV_VG_LITE_USE_BOX_SHADOW 1 /* VG-Lite gradient maximum cache number. * NOTE: The memory usage of a single gradient image is 4K bytes. @@ -275,6 +319,78 @@ */ #define LV_VG_LITE_STROKE_CACHE_CNT 32 + /** Remove VLC_OP_CLOSE path instruction (Workaround for NXP) **/ + #define LV_VG_LITE_DISABLE_VLC_OP_CLOSE 0 + + /** Disable linear gradient extension for some older versions of drivers. */ + #define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT 0 + + /** Enable usage of the LVGL's built-in vg_lite driver */ + #define LV_USE_VG_LITE_DRIVER 0 + #if LV_USE_VG_LITE_DRIVER + /** Used to pick the correct GPU series folder valid options are gc255, gc355 and gc555*/ + #define LV_VG_LITE_HAL_GPU_SERIES gc255 + + /** Used to pick the correct GPU revision header it depends on the vendor */ + #define LV_VG_LITE_HAL_GPU_REVISION 0x40 + + /** Base memory address of the GPU IP it depends on SoC, + * default value is for NXP based devices */ + #define LV_VG_LITE_HAL_GPU_BASE_ADDRESS 0x40240000 + #endif /*LV_USE_VG_LITE_DRIVER*/ + + /** Use ThorVG (a software vector library) as VG-Lite driver to allow testing VGLite on PC + * Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */ + #define LV_USE_VG_LITE_THORVG 0 + #if LV_USE_VG_LITE_THORVG + /** Enable LVGL's blend mode support */ + #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0 + + /** Enable YUV color format support */ + #define LV_VG_LITE_THORVG_YUV_SUPPORT 0 + + /** Enable Linear gradient extension support */ + #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT 0 + + /** Enable alignment on 16 pixels */ + #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 + + /** Buffer address alignment */ + #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64 + + /** Enable multi-thread render */ + #define LV_VG_LITE_THORVG_THREAD_RENDER 0 + #endif /*LV_USE_VG_LITE_THORVG*/ +#endif + +/** Accelerate blends, fills, etc. with STM32 DMA2D */ +#define LV_USE_DRAW_DMA2D 0 +#if LV_USE_DRAW_DMA2D + #define LV_DRAW_DMA2D_HAL_INCLUDE "stm32h7xx_hal.h" + + /* if enabled, the user is required to call `lv_draw_dma2d_transfer_complete_interrupt_handler` + * upon receiving the DMA2D global interrupt + */ + #define LV_USE_DRAW_DMA2D_INTERRUPT 0 +#endif + +/** Draw using cached OpenGLES textures. Requires LV_USE_OPENGLES */ +#define LV_USE_DRAW_OPENGLES 0 +#if LV_USE_DRAW_OPENGLES + #define LV_DRAW_OPENGLES_TEXTURE_CACHE_COUNT 64 +#endif + +/** Draw using espressif PPA accelerator */ +#define LV_USE_PPA 0 +#if LV_USE_PPA + #define LV_USE_PPA_IMG 0 +#endif + +/* Use EVE FT81X GPU. */ +#define LV_USE_DRAW_EVE 0 +#if LV_USE_DRAW_EVE + /* EVE_GEN value: 2, 3, or 4 */ + #define LV_DRAW_EVE_EVE_GENERATION 4 #endif /*======================= @@ -299,7 +415,7 @@ *LV_LOG_LEVEL_USER Only logs added by the user *LV_LOG_LEVEL_NONE Do not log anything*/ - #define LV_LOG_LEVEL LV_LOG_LEVEL_ERROR + #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN /*1: Print the log with 'printf'; *0: User need to register a callback with `lv_log_register_print_cb()`*/ @@ -389,8 +505,12 @@ *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ #define LV_GRADIENT_MAX_STOPS 2 -/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. - * 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */ +/** Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. + * - 0: round down, + * - 64: round up from x.75, + * - 128: round up from half, + * - 192: round up from x.25, + * - 254: round up */ #define LV_COLOR_MIX_ROUND_OFS 0 /* Add 2 x 32 bit variables to each lv_obj_t to speed up getting style properties */ @@ -399,40 +519,29 @@ /* Add `id` field to `lv_obj_t` */ #define LV_USE_OBJ_ID 0 -/* Use lvgl builtin method for obj ID */ -#define LV_USE_OBJ_ID_BUILTIN 0 - -/*Use obj property set/get API*/ -#define LV_USE_OBJ_PROPERTY 0 - -/*Enable property name support*/ -#define LV_USE_OBJ_PROPERTY_NAME 0 - -/* VG-Lite Simulator */ -/*Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */ -#define LV_USE_VG_LITE_THORVG 0 - -#if LV_USE_VG_LITE_THORVG +/** Enable support widget names*/ +#define LV_USE_OBJ_NAME 0 - /*Enable LVGL's blend mode support*/ - #define LV_VG_LITE_THORVG_LVGL_BLEND_SUPPORT 0 +/** Automatically assign an ID when obj is created */ +#define LV_OBJ_ID_AUTO_ASSIGN LV_USE_OBJ_ID - /*Enable YUV color format support*/ - #define LV_VG_LITE_THORVG_YUV_SUPPORT 0 +/** Use builtin obj ID handler functions: +* - lv_obj_assign_id: Called when a widget is created. Use a separate counter for each widget class as an ID. +* - lv_obj_id_compare: Compare the ID to decide if it matches with a requested value. +* - lv_obj_stringify_id: Return string-ified identifier, e.g. "button3". +* - lv_obj_free_id: Does nothing, as there is no memory allocation for the ID. +* When disabled these functions needs to be implemented by the user.*/ +#define LV_USE_OBJ_ID_BUILTIN 1 - /*Enable Linear gradient extension support*/ - #define LV_VG_LITE_THORVG_LINEAR_GRADIENT_EXT_SUPPORT 0 - - /*Enable 16 pixels alignment*/ - #define LV_VG_LITE_THORVG_16PIXELS_ALIGN 1 - - /*Buffer address alignment*/ - #define LV_VG_LITE_THORVG_BUF_ADDR_ALIGN 64 +/** Use obj property set/get API. */ +#define LV_USE_OBJ_PROPERTY 0 - /*Enable multi-thread render*/ - #define LV_VG_LITE_THORVG_THREAD_RENDER 0 +/** Enable property name support. */ +#define LV_USE_OBJ_PROPERTY_NAME 1 -#endif +/* Enable the multi-touch gesture recognition feature */ +/* Gesture recognition requires the use of floats */ +#define LV_USE_GESTURE_RECOGNITION 0 /*===================== * COMPILER SETTINGS @@ -482,8 +591,10 @@ *Requires `LV_USE_FLOAT = 1`*/ #define LV_USE_MATRIX 0 -/*Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default*/ -#define LV_USE_PRIVATE_API 0 +/** Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default */ +#ifndef LV_USE_PRIVATE_API + #define LV_USE_PRIVATE_API 0 +#endif /*================== * FONT USAGE @@ -513,11 +624,11 @@ #define LV_FONT_MONTSERRAT_46 0 #define LV_FONT_MONTSERRAT_48 0 -/*Demonstrate special features*/ -#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ -#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/ -#define LV_FONT_SIMSUN_14_CJK 0 /*1000 most common CJK radicals*/ -#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ +/* Demonstrate special features */ +#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /**< bpp = 3 */ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /**< Hebrew, Arabic, Persian letters and all their forms */ +#define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1338 most common CJK radicals */ +#define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1338 most common CJK radicals */ /*Pixel perfect monospace fonts*/ #define LV_FONT_UNSCII_8 0 @@ -585,18 +696,30 @@ *In these languages characters should be replaced with another form based on their position in the text*/ #define LV_USE_ARABIC_PERSIAN_CHARS 0 +/*The control character to use for signaling text recoloring*/ +#define LV_TXT_COLOR_CMD "#" + /*================== * WIDGETS *================*/ - -/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ - +/* Documentation for widgets can be found here: https://docs.lvgl.io/master/details/widgets/index.html . */ + +/** 1: Causes these widgets to be given default values at creation time. + * - lv_buttonmatrix_t: Get default maps: {"Btn1", "Btn2", "Btn3", "\n", "Btn4", "Btn5", ""}, else map not set. + * - lv_checkbox_t : String label set to "Check box", else set to empty string. + * - lv_dropdown_t : Options set to "Option 1", "Option 2", "Option 3", else no values are set. + * - lv_roller_t : Options set to "Option 1", "Option 2", "Option 3", "Option 4", "Option 5", else no values are set. + * - lv_label_t : Text set to "Text", else empty string. + * - lv_arclabel_t : Text set to "Arced Text", else empty string. + * */ #define LV_WIDGETS_HAS_DEFAULT_VALUE 1 #define LV_USE_ANIMIMG 1 #define LV_USE_ARC 1 +#define LV_USE_ARCLABEL 1 + #define LV_USE_BAR 1 #define LV_USE_BUTTON 1 @@ -669,18 +792,20 @@ #define LV_USE_SWITCH 1 -#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ -#if LV_USE_TEXTAREA != 0 - #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ -#endif - #define LV_USE_TABLE 1 #define LV_USE_TABVIEW 1 -#define LV_USE_TILEVIEW 0 +#define LV_USE_TEXTAREA 1 /**< Requires: lv_label */ +#if LV_USE_TEXTAREA != 0 + #define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /**< [ms] */ +#endif -#define LV_USE_WIN 0 +#define LV_USE_TILEVIEW 1 + +#define LV_USE_WIN 1 + +#define LV_USE_3DTEXTURE 0 /*================== * THEMES @@ -782,8 +907,19 @@ #define LV_FS_ARDUINO_SD_LETTER 'S' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ #endif -/*LODEPNG decoder library*/ -#define LV_USE_LODEPNG 1 +/** API for UEFI */ +#define LV_USE_FS_UEFI 0 +#if LV_USE_FS_UEFI + #define LV_FS_UEFI_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ +#endif + +#define LV_USE_FS_FROGFS 0 +#if LV_USE_FS_FROGFS + #define LV_FS_FROGFS_LETTER '\0' +#endif + +/** LODEPNG decoder library */ +#define LV_USE_LODEPNG 0 /*PNG decoder(libpng) library*/ #define LV_USE_LIBPNG 0 @@ -806,6 +942,8 @@ #define LV_GIF_CACHE_DECODE_DATA 0 #endif +/** GStreamer library */ +#define LV_USE_GSTREAMER 0 /*Decode bin images to RAM*/ #define LV_BIN_DECODER_RAM_LOAD 0 @@ -835,14 +973,18 @@ #if LV_USE_TINY_TTF /* Enable loading TTF data from files */ #define LV_TINY_TTF_FILE_SUPPORT 0 - #define LV_TINY_TTF_CACHE_GLYPH_CNT 256 + #define LV_TINY_TTF_CACHE_GLYPH_CNT 128 + #define LV_TINY_TTF_CACHE_KERNING_CNT 256 #endif /*Rlottie library*/ #define LV_USE_RLOTTIE 0 -/*Enable Vector Graphic APIs - *Requires `LV_USE_MATRIX = 1`*/ +/** Requires `LV_USE_3DTEXTURE = 1` */ +#define LV_USE_GLTF 0 + +/** Enable Vector Graphic APIs + * Requires `LV_USE_MATRIX = 1` */ #define LV_USE_VECTOR_GRAPHIC 0 /* Enable ThorVG (vector graphics library) from the src/libs folder */ @@ -857,17 +999,28 @@ /*Use external LZ4 library*/ #define LV_USE_LZ4_EXTERNAL 0 -/*FFmpeg library for image decoding and playing videos - *Supports all major image formats so do not enable other image decoder with it*/ +/*SVG library + * - Requires `LV_USE_VECTOR_GRAPHIC = 1` */ +#define LV_USE_SVG 0 +#define LV_USE_SVG_ANIMATION 0 +#define LV_USE_SVG_DEBUG 0 + +/** FFmpeg library for image decoding and playing videos. + * Supports all major image formats so do not enable other image decoder with it. */ #define LV_USE_FFMPEG 0 #if LV_USE_FFMPEG /*Dump input information to stderr*/ #define LV_FFMPEG_DUMP_FORMAT 0 + /** Use lvgl file path in FFmpeg Player widget + * You won't be able to open URLs after enabling this feature. + * Note that FFmpeg image decoder will always use lvgl file system. */ + #define LV_FFMPEG_PLAYER_USE_LV_FS 0 #endif /*================== * OTHERS *==================*/ +/* Documentation for several of the below items can be found here: https://docs.lvgl.io/master/details/auxiliary-modules/index.html . */ /*1: Enable API to take snapshot for object*/ #define LV_USE_SNAPSHOT 0 @@ -880,6 +1033,13 @@ #if LV_USE_SYSMON /*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/ #define LV_SYSMON_GET_IDLE lv_timer_get_idle + /** 1: Enable usage of lv_os_get_proc_idle_percent.*/ + #define LV_SYSMON_PROC_IDLE_AVAILABLE 0 + #if LV_SYSMON_PROC_IDLE_AVAILABLE + /** Get the applications idle percentage. + * - Requires `LV_USE_OS == LV_OS_PTHREAD` */ + #define LV_SYSMON_GET_PROC_IDLE lv_os_get_proc_idle_percent + #endif /*1: Show CPU usage and FPS count * Requires `LV_USE_SYSMON = 1`*/ @@ -915,6 +1075,8 @@ #if LV_USE_PROFILER_BUILTIN /*Default profiler trace buffer size*/ #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /*[bytes]*/ + #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE 1 + #define LV_USE_PROFILER_BUILTIN_POSIX 0 /**< Enable POSIX profiler port */ #endif /*Header to include for the profiler*/ @@ -961,6 +1123,9 @@ /*Enable cache profiler*/ #define LV_PROFILER_CACHE 1 + + /*Enable event profiler*/ + #define LV_PROFILER_EVENT 1 #endif /*1: Enable Monkey test*/ @@ -1007,12 +1172,38 @@ #define LV_FILE_EXPLORER_QUICK_ACCESS 1 #endif +/** 1: Enable Font manager */ +#define LV_USE_FONT_MANAGER 0 +#if LV_USE_FONT_MANAGER + +/**Font manager name max length*/ +#define LV_FONT_MANAGER_NAME_MAX_LEN 32 + +#endif + +/** Enable emulated input devices, time emulation, and screenshot compares. */ +#define LV_USE_TEST 0 +#if LV_USE_TEST + +/** Enable `lv_test_screenshot_compare`. + * Requires lodepng and a few MB of extra RAM. */ +#define LV_USE_TEST_SCREENSHOT_COMPARE 0 +#endif /*LV_USE_TEST*/ + +/** Enable loading XML UIs runtime */ +#define LV_USE_XML 0 + +/** 1: Enable text translation support */ +#define LV_USE_TRANSLATION 0 + +/*1: Enable color filter style*/ +#define LV_USE_COLOR_FILTER 0 + /*================== * DEVICES *==================*/ /*Use SDL to open window on PC and handle mouse and keyboard*/ -#define LV_USE_SDL 0 #if LV_USE_SDL #define LV_SDL_INCLUDE_PATH #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/ @@ -1024,7 +1215,11 @@ #endif /*Use X11 to open window on Linux desktop and handle mouse and keyboard*/ +#ifndef USE_X11 +#define LV_USE_X11 0 +#else #define LV_USE_X11 USE_X11 +#endif #if LV_USE_X11 #define LV_X11_DIRECT_EXIT 1 /*Exit the application when all X11 windows have been closed*/ #define LV_X11_DOUBLE_BUFFER 1 /*Use double buffers for endering*/ @@ -1037,8 +1232,11 @@ /*Use Wayland to open a window and handle input on Linux or BSD desktops */ #define LV_USE_WAYLAND 0 #if LV_USE_WAYLAND - #define LV_WAYLAND_WINDOW_DECORATIONS 0 /*Draw client side window decorations only necessary on Mutter/GNOME*/ - #define LV_WAYLAND_WL_SHELL 0 /*Use the legacy wl_shell protocol instead of the default XDG shell*/ + #define LV_WAYLAND_BUF_COUNT 1 /**< Use 1 for single buffer with partial render mode or 2 for double buffer with full render mode*/ + #define LV_WAYLAND_USE_DMABUF 0 /**< Use DMA buffers for frame buffers. Requires LV_DRAW_USE_G2D */ + #define LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL /**< DMABUF supports LV_DISPLAY_RENDER_MODE_FULL and LV_DISPLAY_RENDER_MODE_DIRECT*/ + /**< When LV_WAYLAND_USE_DMABUF is disabled, only LV_DISPLAY_RENDER_MODE_PARTIAL is supported*/ + #define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME. Not supported using DMABUF*/ #endif /*Driver for /dev/fb*/ @@ -1048,12 +1246,18 @@ #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL #define LV_LINUX_FBDEV_BUFFER_COUNT 0 #define LV_LINUX_FBDEV_BUFFER_SIZE 60 + #define LV_LINUX_FBDEV_MMAP 1 #endif /*Use Nuttx to open window and handle touchscreen*/ #define LV_USE_NUTTX 0 #if LV_USE_NUTTX + #define LV_USE_NUTTX_INDEPENDENT_IMAGE_HEAP 0 + + /** Use independent image heap for default draw buffer */ + #define LV_NUTTX_DEFAULT_DRAW_BUF_USE_INDEPENDENT_IMAGE_HEAP 0 + #define LV_USE_NUTTX_LIBUV 0 /*Use Nuttx custom init API to open window and handle touchscreen*/ @@ -1069,18 +1273,50 @@ /*Driver for /dev/input*/ #define LV_USE_NUTTX_TOUCHSCREEN 0 + /** Touchscreen cursor size in pixels(<=0: disable cursor) */ + #define LV_NUTTX_TOUCHSCREEN_CURSOR_SIZE 0 + + /** Driver for /dev/mouse */ + #define LV_USE_NUTTX_MOUSE 0 + + /** Mouse movement step (pixels) */ + #define LV_USE_NUTTX_MOUSE_MOVE_STEP 1 + + /*NuttX trace file and its path*/ + #define LV_USE_NUTTX_TRACE_FILE 0 + #if LV_USE_NUTTX_TRACE_FILE + #define LV_NUTTX_TRACE_FILE_PATH "/data/lvgl-trace.log" + #endif + #endif -/*Driver for /dev/dri/card*/ +/** Driver for /dev/dri/card */ #define LV_USE_LINUX_DRM 0 -/*Interface for TFT_eSPI*/ +#if LV_USE_LINUX_DRM + + /* Use the MESA GBM library to allocate DMA buffers that can be + * shared across sub-systems and libraries using the Linux DMA-BUF API. + * The GBM library aims to provide a platform independent memory management system + * it supports the major GPU vendors - This option requires linking with libgbm */ + #define LV_USE_LINUX_DRM_GBM_BUFFERS 0 + + #define LV_LINUX_DRM_USE_EGL 0 +#endif + +/** Interface for TFT_eSPI */ #define LV_USE_TFT_ESPI 0 -/*Driver for evdev input devices*/ -#ifndef LV_USE_EVDEV +/** Interface for Lovyan_GFX */ +#define LV_USE_LOVYAN_GFX 0 + +#if LV_USE_LOVYAN_GFX + #define LV_LGFX_USER_INCLUDE "lv_lgfx_user.hpp" + +#endif /*LV_USE_LOVYAN_GFX*/ + +/** Driver for evdev input devices */ #define LV_USE_EVDEV 0 -#endif /*Driver for libinput input devices*/ #ifndef LV_USE_LIBINPUT @@ -1103,77 +1339,134 @@ #define LV_USE_ST7789 0 #define LV_USE_ST7796 0 #define LV_USE_ILI9341 0 +#define LV_USE_FT81X 0 +#define LV_USE_NV3007 0 -#define LV_USE_GENERIC_MIPI (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341) +#if (LV_USE_ST7735 | LV_USE_ST7789 | LV_USE_ST7796 | LV_USE_ILI9341 | LV_USE_NV3007) + #define LV_USE_GENERIC_MIPI 1 +#else + #define LV_USE_GENERIC_MIPI 0 +#endif /*Driver for Renesas GLCD*/ #define LV_USE_RENESAS_GLCDC 0 -/* LVGL Windows backend */ +/** Driver for ST LTDC */ +#define LV_USE_ST_LTDC 0 +#if LV_USE_ST_LTDC + /* Only used for partial. */ + #define LV_ST_LTDC_USE_DMA2D_FLUSH 0 +#endif + +/** Driver for NXP ELCDIF */ +#define LV_USE_NXP_ELCDIF 0 + +/** LVGL Windows backend */ #define LV_USE_WINDOWS 0 -/* Use OpenGL to open window on PC and handle mouse and keyboard */ +/** LVGL UEFI backend */ +#define LV_USE_UEFI 0 +#if LV_USE_UEFI + #define LV_USE_UEFI_INCLUDE "myefi.h" /**< Header that hides the actual framework (EDK2, gnu-efi, ...) */ + #define LV_UEFI_USE_MEMORY_SERVICES 0 /**< Use the memory functions from the boot services table */ +#endif + +/** Use a generic OpenGL driver that can be used to embed in other applications or used with GLFW/EGL */ #define LV_USE_OPENGLES 0 #if LV_USE_OPENGLES #define LV_USE_OPENGLES_DEBUG 1 /* Enable or disable debug for opengles */ #endif -/* QNX Screen display and input drivers */ +/** Use GLFW to open window on PC and handle mouse and keyboard. Requires*/ +#define LV_USE_GLFW 0 + + +/** QNX Screen display and input drivers */ #define LV_USE_QNX 0 #if LV_USE_QNX #define LV_QNX_BUF_COUNT 1 /*1 or 2*/ #endif -/*================== -* EXAMPLES -*==================*/ +/*===================== +* BUILD OPTIONS +*======================*/ -/*Enable the examples to be built with the library*/ +/** Enable examples to be built with the library. */ #define LV_BUILD_EXAMPLES 0 +/** Build the demos */ +#define LV_BUILD_DEMOS 0 + /*=================== * DEMO USAGE ====================*/ -/*Show some widget. It might be required to increase `LV_MEM_SIZE` */ -#define LV_USE_DEMO_WIDGETS 0 +#if LV_BUILD_DEMOS + /** Show some widgets. This might be required to increase `LV_MEM_SIZE`. */ + #define LV_USE_DEMO_WIDGETS 0 -/*Demonstrate the usage of encoder and keyboard*/ -#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 + /** Demonstrate usage of encoder and keyboard. */ + #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 -/*Benchmark your system*/ -#define LV_USE_DEMO_BENCHMARK 0 + /** Benchmark your system */ + #define LV_USE_DEMO_BENCHMARK 0 -/*Render test for each primitives. Requires at least 480x272 display*/ -#define LV_USE_DEMO_RENDER 0 + #if LV_USE_DEMO_BENCHMARK + /** Use fonts where bitmaps are aligned 16 byte and has Nx16 byte stride */ + #define LV_DEMO_BENCHMARK_ALIGNED_FONTS 0 + #endif -/*Stress test for LVGL*/ -#define LV_USE_DEMO_STRESS 0 + /** Render test for each primitive. + * - Requires at least 480x272 display. */ + #define LV_USE_DEMO_RENDER 0 + + /** Stress test for LVGL */ + #define LV_USE_DEMO_STRESS 0 + + /** Music player demo */ + #define LV_USE_DEMO_MUSIC 0 + #if LV_USE_DEMO_MUSIC + #define LV_DEMO_MUSIC_SQUARE 0 + #define LV_DEMO_MUSIC_LANDSCAPE 0 + #define LV_DEMO_MUSIC_ROUND 0 + #define LV_DEMO_MUSIC_LARGE 0 + #define LV_DEMO_MUSIC_AUTO_PLAY 0 + #endif -/*Music player demo*/ -#define LV_USE_DEMO_MUSIC 0 -#if LV_USE_DEMO_MUSIC - #define LV_DEMO_MUSIC_SQUARE 0 - #define LV_DEMO_MUSIC_LANDSCAPE 0 - #define LV_DEMO_MUSIC_ROUND 0 - #define LV_DEMO_MUSIC_LARGE 0 - #define LV_DEMO_MUSIC_AUTO_PLAY 0 -#endif + /** Vector graphic demo */ + #define LV_USE_DEMO_VECTOR_GRAPHIC 0 + + /** GLTF demo */ + #define LV_USE_DEMO_GLTF 0 + + /*--------------------------- + * Demos from lvgl/lv_demos + ---------------------------*/ -/*Flex layout demo*/ -#define LV_USE_DEMO_FLEX_LAYOUT 0 + /** Flex layout demo */ + #define LV_USE_DEMO_FLEX_LAYOUT 0 -/*Smart-phone like multi-language demo*/ -#define LV_USE_DEMO_MULTILANG 0 + /** Smart-phone like multi-language demo */ + #define LV_USE_DEMO_MULTILANG 0 -/*Widget transformation demo*/ -#define LV_USE_DEMO_TRANSFORM 0 + /** Widget transformation demo */ + #define LV_USE_DEMO_TRANSFORM 0 + + /** Demonstrate scroll settings */ + #define LV_USE_DEMO_SCROLL 0 + + /*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/ + #define LV_USE_DEMO_EBIKE 0 + #if LV_USE_DEMO_EBIKE + #define LV_DEMO_EBIKE_PORTRAIT 0 /*0: for 480x270..480x320, 1: for 480x800..720x1280*/ + #endif -/*Demonstrate scroll settings*/ -#define LV_USE_DEMO_SCROLL 0 + /** High-resolution demo */ + #define LV_USE_DEMO_HIGH_RES 0 -/*Vector graphic demo*/ -#define LV_USE_DEMO_VECTOR_GRAPHIC 0 + /* Smart watch demo */ + #define LV_USE_DEMO_SMARTWATCH 0 +#endif /* LV_BUILD_DEMOS */ /*--END OF LV_CONF_H--*/ diff --git a/library.json b/library.json index 627c5be9..db66b9cd 100644 --- a/library.json +++ b/library.json @@ -21,7 +21,7 @@ "headers": ["DeviceScreen.h", "SharedQueue.h"], "dependencies": { "ArduinoThread": "https://github.com/meshtastic/ArduinoThread/archive/7c3ee9e1951551b949763b1f5280f8db1fa4068d.zip", - "lvgl/lvgl": "9.3.0", + "lvgl/lvgl": "https://github.com/lvgl/lvgl/archive/283d49ef82ce746f0c0dde8ea4e0f9c3d31b51e8.zip", "greiman/SdFat": "https://github.com/mverch67/SdFat/archive/152a52251fc5e1d581303b42378ea712ab229246.zip", "nanopb/Nanopb": "0.4.91" }, diff --git a/source/graphics/DeviceGUI.cpp b/source/graphics/DeviceGUI.cpp index 03a89fba..18c3e9e0 100644 --- a/source/graphics/DeviceGUI.cpp +++ b/source/graphics/DeviceGUI.cpp @@ -3,7 +3,6 @@ #include "graphics/driver/DisplayDriverConfig.h" #include "input/I2CKeyboardScanner.h" #include "input/InputDriver.h" -#include #include "input/I2CKeyboardInputDriver.h" static I2CKeyboardInputDriver *keyboardDriver = nullptr; @@ -84,28 +83,9 @@ void DeviceGUI::init(IClientBase *client) displaydriver->printConfig(); } -/** - * Linux: measure how long it takes to call displaydriver->task_handler(). - * Then tell the lvgl library how long it took via lv_tick_inc(). - */ void DeviceGUI::task_handler(void) { -#if defined(ARCH_PORTDUINO) - int ms = 10; - auto start = std::chrono::high_resolution_clock::now(); displaydriver->task_handler(); - auto stop = std::chrono::high_resolution_clock::now(); - auto duration = std::chrono::duration_cast(stop - start); - if (duration.count() < ms) { - std::this_thread::sleep_for(std::chrono::milliseconds(ms - duration.count())); - lv_tick_inc(ms); - } else { - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - lv_tick_inc(duration.count() + 1); - } -#else - displaydriver->task_handler(); -#endif }; DeviceGUI::~DeviceGUI() diff --git a/source/graphics/TFT/TFTView_320x240.cpp b/source/graphics/TFT/TFTView_320x240.cpp index aba55926..7e413ea1 100644 --- a/source/graphics/TFT/TFTView_320x240.cpp +++ b/source/graphics/TFT/TFTView_320x240.cpp @@ -238,7 +238,7 @@ bool TFTView_320x240::setupUIConfig(const meshtastic_DeviceUIConfig &uiconfig) Themes::recolorButton(objects.home_bell_button, false); Themes::recolorText(objects.home_bell_label, false); - lv_obj_set_style_bg_img_recolor(objects.home_button, colorMesh, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_recolor(objects.home_button, colorMesh, LV_PART_MAIN); // set brightness if (displaydriver->hasLight()) @@ -318,14 +318,14 @@ bool TFTView_320x240::setupUIConfig(const meshtastic_DeviceUIConfig &uiconfig) lv_img_set_zoom(img, 256); lv_obj_set_pos(img, x - 20, y - 24); // img has 40x35 size, needle at 24 lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TOP_MID); - // lv_obj_set_style_align(img->spec_attr->children[0], LV_ALIGN_BOTTOM_MID, LV_PART_MAIN | LV_STATE_DEFAULT); + // lv_obj_set_style_align(img->spec_attr->children[0], LV_ALIGN_BOTTOM_MID, LV_PART_MAIN); } else { // circle image lv_img_set_src(img, &img_circle_image); lv_img_set_zoom(img, (zoom - 1) * 50 + 80); lv_obj_set_pos(img, x - 20, y - 17); // img has 40x35 size, circle at center lv_image_set_inner_align(img, LV_IMAGE_ALIGN_CENTER); - // lv_obj_set_style_align(img->spec_attr->children[0], LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT); + // lv_obj_set_style_align(img->spec_attr->children[0], LV_ALIGN_CENTER, LV_PART_MAIN); } }; @@ -408,14 +408,14 @@ void TFTView_320x240::init_screens(void) lv_slider_set_range(objects.rssi_slider, -150, -50); lv_label_set_text(objects.signal_scanner_snr_scale_label, "14.0\n12.0\n10.0\n8.0\n6.0\n4.0\n2.0\n0.0\n-2.0\n-4.0\n-8.0\n-10.0\n-12.0\n-14.0\n-16.0"); - lv_obj_set_style_text_line_space(objects.signal_scanner_snr_scale_label, -2, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_line_space(objects.signal_scanner_snr_scale_label, -2, LV_PART_MAIN); lv_slider_set_range(objects.snr_slider, -17, 15); #else lv_label_set_text(objects.signal_scanner_rssi_scale_label, "-20\n-30\n-40\n-50\n-60\n-70\n-80\n-90\n-100\n-110\n-120"); lv_slider_set_range(objects.rssi_slider, -125, -25); lv_label_set_text(objects.signal_scanner_snr_scale_label, "8.0\n6.0\n4.0\n2.0\n0.0\n-2.0\n-4.0\n-8.0\n-10.0\n-12.0\n-14.0\n-16.0\n-18.0"); - lv_obj_set_style_text_line_space(objects.signal_scanner_snr_scale_label, -2, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_line_space(objects.signal_scanner_snr_scale_label, -2, LV_PART_MAIN); lv_slider_set_range(objects.snr_slider, -20, 9); #endif @@ -454,14 +454,14 @@ void TFTView_320x240::init_screens(void) void TFTView_320x240::ui_set_active(lv_obj_t *b, lv_obj_t *p, lv_obj_t *tp) { if (activeButton) { - lv_obj_set_style_border_width(activeButton, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(activeButton, 0, LV_PART_MAIN); if (Themes::get() == Themes::eDark) - lv_obj_set_style_bg_img_recolor_opa(activeButton, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor(activeButton, colorGray, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_recolor_opa(activeButton, 0, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor(activeButton, colorGray, LV_PART_MAIN); } - lv_obj_set_style_border_width(b, 3, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor(b, colorMesh, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor_opa(b, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(b, 3, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor(b, colorMesh, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor_opa(b, 255, LV_PART_MAIN); if (activePanel) { lv_obj_add_flag(activePanel, LV_OBJ_FLAG_HIDDEN); @@ -532,7 +532,7 @@ void TFTView_320x240::enterProgrammingMode(void) state = MeshtasticView::eProgrammingMode; lv_label_set_text(objects.meshtastic_url, _(">> Programming mode <<")); lv_label_set_text_fmt(objects.firmware_label, "%06d", db.config.bluetooth.fixed_pin); - lv_obj_set_style_text_font(objects.firmware_label, &ui_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(objects.firmware_label, &ui_font_montserrat_20, LV_PART_MAIN); lv_obj_add_flag(objects.boot_logo, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(objects.boot_logo_button, LV_OBJ_FLAG_HIDDEN); lv_obj_remove_flag(objects.bluetooth_button, LV_OBJ_FLAG_HIDDEN); @@ -582,7 +582,7 @@ void TFTView_320x240::apply_hotfix(void) buttonSize = 36; } if (h > 400) { - lv_obj_set_style_text_font(objects.home_qr_label, &ui_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_font(objects.home_qr_label, &ui_font_montserrat_16, LV_PART_MAIN); } lv_obj_move_foreground(objects.keyboard); @@ -673,12 +673,12 @@ void TFTView_320x240::updateTheme(void) Themes::recolorText(objects.home_memory_label, (bool)objects.home_memory_button->user_data); lv_opa_t opa = (Themes::get() == Themes::eDark) ? 0 : 255; - lv_obj_set_style_bg_img_recolor_opa(objects.home_button, opa, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor_opa(objects.nodes_button, opa, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor_opa(objects.groups_button, opa, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor_opa(objects.messages_button, opa, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor_opa(objects.map_button, opa, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor_opa(objects.settings_button, opa, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_recolor_opa(objects.home_button, opa, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor_opa(objects.nodes_button, opa, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor_opa(objects.groups_button, opa, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor_opa(objects.messages_button, opa, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor_opa(objects.map_button, opa, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor_opa(objects.settings_button, opa, LV_PART_MAIN); for (int i = 0; i < c_max_channels; i++) { if (db.channel[i].role != meshtastic_Channel_Role_DISABLED) @@ -1212,7 +1212,7 @@ void TFTView_320x240::ui_event_ChatButton(lv_event_t *e) ignoreClicked = false; return; } - lv_obj_set_style_border_color(target, colorMidGray, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(target, colorMidGray, LV_PART_MAIN); uint32_t channelOrNode = (unsigned long)e->user_data; if (channelOrNode < c_max_channels) { @@ -2318,14 +2318,14 @@ void TFTView_320x240::ui_event_lockGps(lv_event_t *e) void TFTView_320x240::ui_event_mapBrightnessSlider(lv_event_t *e) { uint32_t br = lv_slider_get_value(objects.map_brightness_slider); - lv_obj_set_style_bg_color(objects.map_panel, lv_color_make(br, br, br), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(objects.raw_map_panel, lv_color_make(br, br, br), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(objects.map_panel, lv_color_make(br, br, br), LV_PART_MAIN); + lv_obj_set_style_bg_color(objects.raw_map_panel, lv_color_make(br, br, br), LV_PART_MAIN); } void TFTView_320x240::ui_event_mapContrastSlider(lv_event_t *e) { uint32_t ct = lv_slider_get_value(objects.map_contrast_slider); - lv_obj_set_style_opa(objects.raw_map_panel, ct, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_opa(objects.raw_map_panel, ct, LV_PART_MAIN); } void TFTView_320x240::ui_event_map_style_dropdown(lv_event_t *e) @@ -2653,23 +2653,23 @@ void TFTView_320x240::addOrUpdateMap(uint32_t nodeNum, int32_t lat, int32_t lon) lv_obj_set_size(img, 40, 35); lv_img_set_src(img, &img_circle_image); lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TOP_MID); - lv_obj_set_style_opa(img, 180, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_image_recolor(img, lv_color_hex(bgColor), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_image_recolor_opa(img, 255, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_top(img, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_bottom(img, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_left(img, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_right(img, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_opa(img, 180, LV_PART_MAIN); + lv_obj_set_style_image_recolor(img, lv_color_hex(bgColor), LV_PART_MAIN); + lv_obj_set_style_image_recolor_opa(img, 255, LV_PART_MAIN); + lv_obj_set_style_pad_top(img, 0, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(img, 0, LV_PART_MAIN); + lv_obj_set_style_pad_left(img, 0, LV_PART_MAIN); + lv_obj_set_style_pad_right(img, 0, LV_PART_MAIN); lv_obj_t *lbl = lv_label_create(img); lv_obj_set_pos(lbl, 0, 0); lv_obj_set_size(lbl, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_text_color(lbl, lv_color_black(), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_opa(img, 255, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_image_recolor_opa(img, 255, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_font(lbl, &lv_font_montserrat_10, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_align(lbl, LV_ALIGN_BOTTOM_MID, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_align(lbl, LV_ALIGN_BOTTOM_MID, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(lbl, lv_color_black(), LV_PART_MAIN); + lv_obj_set_style_opa(img, 255, LV_PART_MAIN); + lv_obj_set_style_image_recolor_opa(img, 255, LV_PART_MAIN); + lv_obj_set_style_text_font(lbl, &lv_font_montserrat_10, LV_PART_MAIN); + lv_obj_set_style_align(lbl, LV_ALIGN_BOTTOM_MID, LV_PART_MAIN); + lv_obj_set_style_align(lbl, LV_ALIGN_BOTTOM_MID, LV_PART_MAIN); lv_obj_t *p = nodes[nodeNum]; lv_label_set_text_fmt(lbl, "%s", lv_label_get_text(p->LV_OBJ_IDX(node_lbs_idx))); @@ -2791,7 +2791,7 @@ void TFTView_320x240::ui_event_signal_scanner_start(lv_event_t *e) lv_spinner_set_anim_params(obj, 5000, 300); lv_obj_set_pos(obj, 0, -50); lv_obj_set_size(obj, 68, 68); - lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN); add_style_spinner_style(obj); lv_label_set_text(objects.signal_scanner_start_label, "30s"); THIS->scans = 6 + 1; @@ -2876,7 +2876,7 @@ void TFTView_320x240::ui_event_trace_route_start(lv_event_t *e) lv_spinner_set_anim_params(obj, 5000, 300); lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, 68, 68); - lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(obj, LV_ALIGN_CENTER, LV_PART_MAIN); add_style_spinner_style(obj); lv_label_set_text(objects.trace_route_start_label, "30s"); @@ -3107,9 +3107,9 @@ void TFTView_320x240::writePacketLog(const meshtastic_MeshPacket &p) lv_obj_set_size(pLabel, LV_PCT(100), LV_SIZE_CONTENT); uint32_t bgColor, fgColor; std::tie(bgColor, fgColor) = nodeColor(p.from); - lv_obj_set_style_bg_color(pLabel, lv_color_hex(bgColor), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_color(pLabel, lv_color_hex(fgColor), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_opa(pLabel, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(pLabel, lv_color_hex(bgColor), LV_PART_MAIN); + lv_obj_set_style_text_color(pLabel, lv_color_hex(fgColor), LV_PART_MAIN); + lv_obj_set_style_bg_opa(pLabel, 255, LV_PART_MAIN); lv_label_set_text(pLabel, buf); // auto-scroll if last item is visible @@ -3314,22 +3314,17 @@ void TFTView_320x240::updateSignalStrength(int32_t rssi, float snr) sprintf(buf, "(%d%%)", pct); lv_label_set_text(objects.home_signal_pct_label, buf); if (pct > 80) { - lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_signal_button_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_signal_button_image, LV_PART_MAIN); } else if (pct > 60) { - lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_strong_signal_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_strong_signal_image, LV_PART_MAIN); } else if (pct > 40) { - lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_good_signal_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_good_signal_image, LV_PART_MAIN); } else if (pct > 20) { - lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_fair_signal_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_fair_signal_image, LV_PART_MAIN); } else if (pct > 1) { - lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_weak_signal_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_weak_signal_image, LV_PART_MAIN); } else { - lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_no_signal_image, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_no_signal_image, LV_PART_MAIN); } } } @@ -3984,7 +3979,7 @@ void TFTView_320x240::ui_event_ok(lv_event_t *e) THIS->setTheme(value); THIS->db.uiConfig.theme = meshtastic_Theme(value); THIS->controller->storeUIConfig(THIS->db.uiConfig); - lv_obj_set_style_bg_img_recolor(objects.settings_button, colorMesh, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_recolor(objects.settings_button, colorMesh, LV_PART_MAIN); } lv_obj_add_flag(objects.settings_theme_panel, LV_OBJ_FLAG_HIDDEN); @@ -4367,9 +4362,9 @@ void TFTView_320x240::showUserWidget(UserWidgetFunc createWidget) lv_obj_set_size(obj, LV_PCT(88), LV_PCT(90)); lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_style_bg_color(obj, colorDarkGray, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_radius(obj, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(obj, colorDarkGray, LV_PART_MAIN); + lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN); + lv_obj_set_style_radius(obj, 0, LV_PART_MAIN); activeWidget = obj; createWidget(activeWidget, NULL, 0); @@ -4424,14 +4419,14 @@ void TFTView_320x240::addMessage(lv_obj_t *container, uint32_t msgTime, uint32_t lv_obj_set_height(hiddenPanel, LV_SIZE_CONTENT); lv_obj_set_align(hiddenPanel, LV_ALIGN_CENTER); lv_obj_clear_flag(hiddenPanel, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_style_radius(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(hiddenPanel, 0, LV_PART_MAIN); add_style_panel_style(hiddenPanel); - lv_obj_set_style_border_width(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_left(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_right(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_top(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_bottom(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(hiddenPanel, 0, LV_PART_MAIN); + lv_obj_set_style_pad_left(hiddenPanel, 0, LV_PART_MAIN); + lv_obj_set_style_pad_right(hiddenPanel, 0, LV_PART_MAIN); + lv_obj_set_style_pad_top(hiddenPanel, 0, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(hiddenPanel, 0, LV_PART_MAIN); hiddenPanel->user_data = (void *)requestId; // add timestamp @@ -4442,7 +4437,8 @@ void TFTView_320x240::addMessage(lv_obj_t *container, uint32_t msgTime, uint32_t lv_obj_t *textLabel = lv_label_create(hiddenPanel); // calculate expected size of text bubble, to make it look nicer - lv_coord_t width = lv_txt_get_width(buf, strlen(buf), &ui_font_montserrat_12, 0); + lv_text_attributes_t text{}; + lv_coord_t width = lv_txt_get_width(buf, strlen(buf), &ui_font_montserrat_12, &text); lv_obj_set_width(textLabel, std::max(std::min(width, 200) + 10, 40)); lv_obj_set_height(textLabel, LV_SIZE_CONTENT); lv_obj_set_y(textLabel, 0); @@ -4456,13 +4452,13 @@ void TFTView_320x240::addMessage(lv_obj_t *container, uint32_t msgTime, uint32_t switch (status) { case LogMessage::eHeard: - lv_obj_set_style_border_color(textLabel, colorYellow, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(textLabel, colorYellow, LV_PART_MAIN); break; case LogMessage::eAcked: - lv_obj_set_style_border_color(textLabel, colorBlueGreen, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(textLabel, colorBlueGreen, LV_PART_MAIN); break; case LogMessage::eFailed: - lv_obj_set_style_border_color(textLabel, colorRed, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(textLabel, colorRed, LV_PART_MAIN); break; default: break; @@ -4504,8 +4500,8 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor lv_obj_set_pos(p, LV_PCT(0), 0); lv_obj_set_size(p, LV_PCT(100), 53); lv_obj_set_align(p, LV_ALIGN_CENTER); - lv_obj_set_style_pad_top(p, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_bottom(p, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_top(p, 0, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(p, 0, LV_PART_MAIN); lv_obj_remove_flag(p, lv_obj_flag_t(LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_PRESS_LOCK | LV_OBJ_FLAG_CLICK_FOCUSABLE | LV_OBJ_FLAG_GESTURE_BUBBLE | LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLLABLE)); add_style_node_panel_style(p); @@ -4516,12 +4512,12 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor lv_obj_set_pos(img, -5, 3); lv_obj_set_size(img, 32, 32); lv_obj_clear_flag(img, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_style_radius(img, 6, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_opa(img, 255, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_opa(img, 255, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_width(img, 2, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(img, 6, LV_PART_MAIN); + lv_obj_set_style_bg_opa(img, 255, LV_PART_MAIN); + lv_obj_set_style_border_opa(img, 255, LV_PART_MAIN); + lv_obj_set_style_border_width(img, 2, LV_PART_MAIN); if (!hasKey) { - lv_obj_set_style_border_color(img, colorRed, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(img, colorRed, LV_PART_MAIN); } if (unmessagable) { // node role icon is not clickable and replaced with a cancelled icon @@ -4537,9 +4533,9 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor add_style_node_button_style(nodeButton); lv_obj_set_align(nodeButton, LV_ALIGN_CENTER); lv_obj_add_flag(nodeButton, LV_OBJ_FLAG_SCROLL_ON_FOCUS); - lv_obj_set_style_shadow_width(nodeButton, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_max_height(nodeButton, 132, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_min_height(nodeButton, 50, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_shadow_width(nodeButton, 0, LV_PART_MAIN); + lv_obj_set_style_max_height(nodeButton, 132, LV_PART_MAIN); + lv_obj_set_style_min_height(nodeButton, 50, LV_PART_MAIN); nodeButton->user_data = _lv_ll_get_tail(lv_group_ll); // UserNameLabel @@ -4549,17 +4545,18 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor lv_label_set_long_mode(ln_lbl, LV_LABEL_LONG_SCROLL); lv_label_set_text(ln_lbl, userLong); ln_lbl->user_data = (void *)nodeNum; - lv_obj_set_style_align(ln_lbl, LV_ALIGN_TOP_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(ln_lbl, LV_ALIGN_TOP_LEFT, LV_PART_MAIN); // UserNameShortLabel lv_obj_t *sn_lbl = lv_label_create(p); lv_obj_set_pos(sn_lbl, 30, 10); lv_obj_set_size(sn_lbl, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_long_mode(sn_lbl, LV_LABEL_LONG_WRAP); - lv_obj_set_style_align(sn_lbl, LV_ALIGN_TOP_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_font(sn_lbl, &ui_font_montserrat_14, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(sn_lbl, LV_ALIGN_TOP_LEFT, LV_PART_MAIN); + lv_obj_set_style_text_font(sn_lbl, &ui_font_montserrat_14, LV_PART_MAIN); // if short name contains only non-printable glyphs replace with short id - if (lv_txt_get_width(userShort, strlen(userShort), &ui_font_montserrat_14, 0) <= 4) { + lv_text_attributes_t text{}; + if (lv_txt_get_width(userShort, strlen(userShort), &ui_font_montserrat_14, &text) <= 4) { lv_label_set_text_fmt(sn_lbl, "%04x", nodeNum & 0xffff); } else { lv_label_set_text(sn_lbl, userShort); @@ -4587,13 +4584,13 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor lv_obj_set_size(ui_BatteryLabel, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_obj_set_align(ui_BatteryLabel, LV_ALIGN_TOP_RIGHT); lv_label_set_text(ui_BatteryLabel, ""); - lv_obj_set_style_text_align(ui_BatteryLabel, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_align(ui_BatteryLabel, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN); ui_BatteryLabel->user_data = (void *)hasKey; // LastHeardLabel lv_obj_t *ui_lastHeardLabel = lv_label_create(p); lv_obj_set_pos(ui_lastHeardLabel, 8, 33); lv_obj_set_size(ui_lastHeardLabel, LV_SIZE_CONTENT, LV_SIZE_CONTENT); - lv_obj_set_style_align(ui_lastHeardLabel, LV_ALIGN_TOP_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(ui_lastHeardLabel, LV_ALIGN_TOP_RIGHT, LV_PART_MAIN); lv_label_set_long_mode(ui_lastHeardLabel, LV_LABEL_LONG_CLIP); // TODO: devices without actual time will report all nodes as lastseen = now @@ -4610,7 +4607,7 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor lv_label_set_text(ui_lastHeardLabel, ""); } - lv_obj_set_style_text_align(ui_lastHeardLabel, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_align(ui_lastHeardLabel, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN); ui_lastHeardLabel->user_data = (void *)lastHeard; // SignalLabel / hopsAway lv_obj_t *ui_SignalLabel = lv_label_create(p); @@ -4626,8 +4623,8 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor lv_obj_set_size(ui_PositionLabel, 120, LV_SIZE_CONTENT); lv_label_set_long_mode(ui_PositionLabel, LV_LABEL_LONG_CLIP); lv_label_set_text(ui_PositionLabel, ""); - lv_obj_set_style_align(ui_PositionLabel, LV_ALIGN_TOP_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_color(ui_PositionLabel, colorBlueGreen, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(ui_PositionLabel, LV_ALIGN_TOP_LEFT, LV_PART_MAIN); + lv_obj_set_style_text_color(ui_PositionLabel, colorBlueGreen, LV_PART_MAIN); ui_PositionLabel->user_data = 0; // store latitude // Position2Label lv_obj_t *ui_Position2Label = lv_label_create(p); @@ -4635,7 +4632,7 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor lv_obj_set_size(ui_Position2Label, 108, LV_SIZE_CONTENT); lv_label_set_long_mode(ui_Position2Label, LV_LABEL_LONG_SCROLL); lv_label_set_text(ui_Position2Label, ""); - lv_obj_set_style_align(ui_Position2Label, LV_ALIGN_TOP_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(ui_Position2Label, LV_ALIGN_TOP_LEFT, LV_PART_MAIN); ui_Position2Label->user_data = 0; // store longitude // Telemetry1Label lv_obj_t *ui_Telemetry1Label = lv_label_create(p); @@ -4643,16 +4640,16 @@ void TFTView_320x240::addNode(uint32_t nodeNum, uint8_t ch, const char *userShor lv_obj_set_size(ui_Telemetry1Label, 130, LV_SIZE_CONTENT); lv_label_set_long_mode(ui_Telemetry1Label, LV_LABEL_LONG_CLIP); lv_label_set_text(ui_Telemetry1Label, ""); - lv_obj_set_style_align(ui_Telemetry1Label, LV_ALIGN_TOP_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_align(ui_Telemetry1Label, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(ui_Telemetry1Label, LV_ALIGN_TOP_RIGHT, LV_PART_MAIN); + lv_obj_set_style_text_align(ui_Telemetry1Label, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN); // Telemetry2Label lv_obj_t *ui_Telemetry2Label = lv_label_create(p); lv_obj_set_pos(ui_Telemetry2Label, 8, 63); lv_obj_set_size(ui_Telemetry2Label, 130, LV_SIZE_CONTENT); lv_label_set_long_mode(ui_Telemetry2Label, LV_LABEL_LONG_CLIP); lv_label_set_text(ui_Telemetry2Label, ""); - lv_obj_set_style_align(ui_Telemetry2Label, LV_ALIGN_TOP_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_align(ui_Telemetry2Label, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(ui_Telemetry2Label, LV_ALIGN_TOP_RIGHT, LV_PART_MAIN); + lv_obj_set_style_text_align(ui_Telemetry2Label, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN); lv_obj_add_event_cb(nodeButton, ui_event_NodeButton, LV_EVENT_ALL, (void *)nodeNum); @@ -4757,10 +4754,10 @@ void TFTView_320x240::updateNode(uint32_t nodeNum, uint8_t ch, const meshtastic_ if (cfg.public_key.size != 0) { // set border color to bg color - lv_color_t color = lv_obj_get_style_bg_color(it->second->LV_OBJ_IDX(node_img_idx), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_color(it->second->LV_OBJ_IDX(node_img_idx), color, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_color_t color = lv_obj_get_style_bg_color(it->second->LV_OBJ_IDX(node_img_idx), LV_PART_MAIN); + lv_obj_set_style_border_color(it->second->LV_OBJ_IDX(node_img_idx), color, LV_PART_MAIN); } else { - lv_obj_set_style_border_color(it->second->LV_OBJ_IDX(node_img_idx), colorRed, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(it->second->LV_OBJ_IDX(node_img_idx), colorRed, LV_PART_MAIN); } // update chat name @@ -4917,32 +4914,27 @@ void TFTView_320x240::updateMetrics(uint32_t nodeNum, uint32_t bat_level, float BatteryLevel::Status status = level.calcStatus(bat_level, voltage); switch (status) { case BatteryLevel::Plugged: - lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_plug_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_plug_image, LV_PART_MAIN); if (shown_level == 100) buf[0] = '\0'; break; case BatteryLevel::Charging: - lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_bolt_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_bolt_image, LV_PART_MAIN); break; case BatteryLevel::Full: - lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_full_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_full_image, LV_PART_MAIN); break; case BatteryLevel::Mid: - lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_mid_image, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_mid_image, LV_PART_MAIN); break; case BatteryLevel::Low: - lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_low_image, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_low_image, LV_PART_MAIN); break; case BatteryLevel::Empty: - lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_empty_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_empty_image, LV_PART_MAIN); break; case BatteryLevel::Warn: - lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_empty_warn_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.battery_image, &img_battery_empty_warn_image, LV_PART_MAIN); buf[0] = '\0'; alert = true; break; @@ -4951,7 +4943,7 @@ void TFTView_320x240::updateMetrics(uint32_t nodeNum, uint32_t bat_level, float break; } Themes::recolorTopLabel(objects.battery_percentage_label, alert); - lv_obj_set_style_bg_image_recolor_opa(objects.battery_image, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_recolor_opa(objects.battery_image, 255, LV_PART_MAIN); lv_label_set_text(objects.battery_percentage_label, buf); } } @@ -5063,11 +5055,9 @@ void TFTView_320x240::updateConnectionStatus(const meshtastic_DeviceConnectionSt Themes::recolorButton(objects.home_wlan_button, true); Themes::recolorText(objects.home_wlan_label, true); if (status.wifi.status.is_connected) { - lv_obj_set_style_bg_img_src(objects.home_wlan_button, &img_home_wlan_button_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_src(objects.home_wlan_button, &img_home_wlan_button_image, LV_PART_MAIN); } else { - lv_obj_set_style_bg_img_src(objects.home_wlan_button, &img_home_wlan_off_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_src(objects.home_wlan_button, &img_home_wlan_off_image, LV_PART_MAIN); } if (status.wifi.status.is_mqtt_connected) { @@ -5088,7 +5078,7 @@ void TFTView_320x240::updateConnectionStatus(const meshtastic_DeviceConnectionSt Themes::recolorButton(objects.home_mqtt_button, db.module_config.mqtt.enabled, 100); Themes::recolorText(objects.home_mqtt_label, false); } - lv_obj_set_style_bg_img_src(objects.home_wlan_button, &img_home_wlan_off_image, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_src(objects.home_wlan_button, &img_home_wlan_off_image, LV_PART_MAIN); } } else { lv_obj_add_flag(objects.home_wlan_label, LV_OBJ_FLAG_HIDDEN); @@ -5100,24 +5090,21 @@ void TFTView_320x240::updateConnectionStatus(const meshtastic_DeviceConnectionSt if (status.bluetooth.is_connected) { char buf[20]; uint32_t mac = ownNode; - lv_obj_set_style_text_color(objects.home_bluetooth_label, colorLightGray, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(objects.home_bluetooth_label, colorLightGray, LV_PART_MAIN); sprintf(buf, "??:??:%02x:%02x:%02x:%02x", mac & 0xff, (mac & 0xff00) >> 8, (mac & 0xff0000) >> 16, (mac & 0xff000000) >> 24); lv_label_set_text(objects.home_bluetooth_label, buf); - lv_obj_set_style_bg_opa(objects.home_bluetooth_button, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_src(objects.home_bluetooth_button, &img_home_bluetooth_on_button_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_opa(objects.home_bluetooth_button, 0, LV_PART_MAIN); + lv_obj_set_style_bg_img_src(objects.home_bluetooth_button, &img_home_bluetooth_on_button_image, LV_PART_MAIN); } else { - lv_obj_set_style_text_color(objects.home_bluetooth_label, colorMidGray, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_src(objects.home_bluetooth_button, &img_home_bluetooth_on_button_image, - LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor_opa(objects.home_bluetooth_button, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(objects.home_bluetooth_label, colorMidGray, LV_PART_MAIN); + lv_obj_set_style_bg_img_src(objects.home_bluetooth_button, &img_home_bluetooth_on_button_image, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor_opa(objects.home_bluetooth_button, 255, LV_PART_MAIN); } } else { - lv_obj_set_style_text_color(objects.home_bluetooth_label, colorMidGray, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_src(objects.home_bluetooth_button, &img_home_bluetooth_off_button_image, - LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_img_recolor_opa(objects.home_bluetooth_button, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(objects.home_bluetooth_label, colorMidGray, LV_PART_MAIN); + lv_obj_set_style_bg_img_src(objects.home_bluetooth_button, &img_home_bluetooth_off_button_image, LV_PART_MAIN); + lv_obj_set_style_bg_img_recolor_opa(objects.home_bluetooth_button, 255, LV_PART_MAIN); } } else { lv_obj_add_flag(objects.home_bluetooth_label, LV_OBJ_FLAG_HIDDEN); @@ -5130,11 +5117,11 @@ void TFTView_320x240::updateConnectionStatus(const meshtastic_DeviceConnectionSt uint32_t mac = ownNode; sprintf(buf, "??:??:%02x:%02x:%02x:%02x", mac & 0xff000000, mac & 0xff0000, mac & 0xff00, mac & 0xff); lv_label_set_text(objects.home_ethernet_label, buf); - lv_obj_set_style_text_color(objects.home_ethernet_label, colorLightGray, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_opa(objects.home_ethernet_button, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(objects.home_ethernet_label, colorLightGray, LV_PART_MAIN); + lv_obj_set_style_bg_opa(objects.home_ethernet_button, 0, LV_PART_MAIN); } else { - lv_obj_set_style_bg_img_recolor_opa(objects.home_ethernet_button, 255, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_color(objects.home_ethernet_label, colorMidGray, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_recolor_opa(objects.home_ethernet_button, 255, LV_PART_MAIN); + lv_obj_set_style_text_color(objects.home_ethernet_label, colorMidGray, LV_PART_MAIN); } } else { lv_obj_add_flag(objects.home_ethernet_label, LV_OBJ_FLAG_HIDDEN); @@ -5210,10 +5197,8 @@ void TFTView_320x240::handleResponse(uint32_t from, const uint32_t id, const mes if ((unsigned long)nodes[from]->LV_OBJ_IDX(node_bat_idx)->user_data == 1) { ILOG_DEBUG("public key mismatch"); nodes[from]->LV_OBJ_IDX(node_bat_idx)->user_data = (void *)2; - lv_obj_set_style_border_color(nodes[from]->LV_OBJ_IDX(node_img_idx), colorRed, - LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_slash_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(nodes[from]->LV_OBJ_IDX(node_img_idx), colorRed, LV_PART_MAIN); + lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_slash_image, LV_PART_MAIN); } } } else { @@ -5287,8 +5272,7 @@ void TFTView_320x240::handleTraceRouteResponse(const meshtastic_Routing &routing } else { // we got a first ACK to our route request if (spinnerButton) { - lv_obj_set_style_outline_color(objects.trace_route_start_button, lv_color_hex(0xDBD251), - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_outline_color(objects.trace_route_start_button, lv_color_hex(0xDBD251), LV_PART_MAIN); } } } @@ -5328,14 +5312,14 @@ void TFTView_320x240::addNodeToTraceRoute(uint32_t nodeNum, lv_obj_t *panel) lv_obj_set_pos(btn, 0, 0); lv_obj_set_size(btn, LV_PCT(100), 38); add_style_settings_button_style(btn); - lv_obj_set_style_align(btn, LV_ALIGN_TOP_MID, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_top(btn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_bottom(btn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_radius(btn, 6, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_shadow_width(btn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_shadow_ofs_y(btn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_width(btn, 1, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_color(btn, colorMidGray, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(btn, LV_ALIGN_TOP_MID, LV_PART_MAIN); + lv_obj_set_style_pad_top(btn, 0, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(btn, 0, LV_PART_MAIN); + lv_obj_set_style_radius(btn, 6, LV_PART_MAIN); + lv_obj_set_style_shadow_width(btn, 0, LV_PART_MAIN); + lv_obj_set_style_shadow_ofs_y(btn, 0, LV_PART_MAIN); + lv_obj_set_style_border_width(btn, 1, LV_PART_MAIN); + lv_obj_set_style_border_color(btn, colorMidGray, LV_PART_MAIN); { { lv_obj_t *img = lv_img_create(btn); @@ -5348,11 +5332,11 @@ void TFTView_320x240::addNodeToTraceRoute(uint32_t nodeNum, lv_obj_t *panel) lv_obj_set_pos(img, -5, 3); lv_obj_set_size(img, 32, 32); lv_obj_clear_flag(img, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_style_border_width(img, 3, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_image_recolor_opa(img, 255, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_align(img, LV_ALIGN_TOP_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_radius(img, 6, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_opa(img, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_width(img, 3, LV_PART_MAIN); + lv_obj_set_style_image_recolor_opa(img, 255, LV_PART_MAIN); + lv_obj_set_style_align(img, LV_ALIGN_TOP_LEFT, LV_PART_MAIN); + lv_obj_set_style_radius(img, 6, LV_PART_MAIN); + lv_obj_set_style_bg_opa(img, 255, LV_PART_MAIN); } { // TraceRouteToButtonLabel @@ -5377,8 +5361,8 @@ void TFTView_320x240::addNodeToTraceRoute(uint32_t nodeNum, lv_obj_t *panel) } else lv_label_set_text(label, _("unknown")); } - lv_obj_set_style_align(label, LV_ALIGN_TOP_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(label, LV_ALIGN_TOP_LEFT, LV_PART_MAIN); + lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN); } } } @@ -5538,20 +5522,20 @@ bool TFTView_320x240::applyNodesFilter(uint32_t nodeNum, bool reset) if (lv_obj_has_state(objects.nodes_hl_active_chat_switch, LV_STATE_CHECKED)) { auto it = chats.find(nodeNum); if (it != nodes.end()) { - lv_obj_set_style_border_color(panel, colorOrange, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(panel, colorOrange, LV_PART_MAIN); highlight = true; } } if (lv_obj_has_state(objects.nodes_hl_position_switch, LV_STATE_CHECKED)) { if (lv_label_get_text(panel->LV_OBJ_IDX(node_pos1_idx))[0] != '\0') { - lv_obj_set_style_border_color(panel, colorBlueGreen, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(panel, colorBlueGreen, LV_PART_MAIN); highlight = true; } } if (lv_obj_has_state(objects.nodes_hl_telemetry_switch, LV_STATE_CHECKED)) { if (lv_label_get_text(panel->LV_OBJ_IDX(node_tm1_idx))[0] != '\0') { - lv_obj_set_style_border_color(panel, colorBlue, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_width(panel, 2, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(panel, colorBlue, LV_PART_MAIN); + lv_obj_set_style_border_width(panel, 2, LV_PART_MAIN); highlight = true; } } @@ -5579,11 +5563,11 @@ bool TFTView_320x240::applyNodesFilter(uint32_t nodeNum, bool reset) fg = lv_color_hex(0xffffffff); bg = lv_color_hex(0x001d1414); } - lv_obj_set_style_text_color(panel->LV_OBJ_IDX(node_tm2_idx), fg, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(panel->LV_OBJ_IDX(node_tm2_idx), bg, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_opa(panel->LV_OBJ_IDX(node_tm2_idx), 255, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_color(panel, bg, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_width(panel, 2, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_text_color(panel->LV_OBJ_IDX(node_tm2_idx), fg, LV_PART_MAIN); + lv_obj_set_style_bg_color(panel->LV_OBJ_IDX(node_tm2_idx), bg, LV_PART_MAIN); + lv_obj_set_style_bg_opa(panel->LV_OBJ_IDX(node_tm2_idx), 255, LV_PART_MAIN); + lv_obj_set_style_border_color(panel, bg, LV_PART_MAIN); + lv_obj_set_style_border_width(panel, 2, LV_PART_MAIN); highlight = true; } } @@ -5591,14 +5575,14 @@ bool TFTView_320x240::applyNodesFilter(uint32_t nodeNum, bool reset) if (name[0] != '\0') { if (strcasestr(lv_label_get_text(panel->LV_OBJ_IDX(node_lbl_idx)), name) || strcasestr(lv_label_get_text(panel->LV_OBJ_IDX(node_lbs_idx)), name)) { - lv_obj_set_style_border_color(panel, colorMesh, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(panel, colorMesh, LV_PART_MAIN); highlight = true; } } } if (!highlight) { - lv_obj_set_style_border_color(panel, colorMidGray, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_width(panel, 1, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(panel, colorMidGray, LV_PART_MAIN); + lv_obj_set_style_border_width(panel, 1, LV_PART_MAIN); } return hide; // TODO || filter.active; } @@ -5640,11 +5624,7 @@ void TFTView_320x240::handleTextMessageResponse(uint32_t channelOrNode, const ui if (requestId == id) { // now give the textlabel border another color lv_obj_t *textLabel = panel->spec_attr->children[0]; - lv_obj_set_style_border_color(textLabel, - err ? colorRed - : ack ? colorBlueGreen - : colorYellow, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(textLabel, err ? colorRed : ack ? colorBlueGreen : colorYellow, LV_PART_MAIN); // store message break; @@ -5781,7 +5761,7 @@ void TFTView_320x240::updateChannelConfig(const meshtastic_Channel &ch) setChannelName(ch); lv_obj_set_width(btn[ch.index], lv_pct(70)); - lv_obj_set_style_pad_left(btn[ch.index], 8, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_left(btn[ch.index], 8, LV_PART_MAIN); lv_obj_t *lockImage = NULL; if (lv_obj_get_child_cnt(btn[ch.index]) == 1) @@ -5806,8 +5786,8 @@ void TFTView_320x240::updateChannelConfig(const meshtastic_Channel &ch) lv_obj_set_align(lockImage, LV_ALIGN_LEFT_MID); lv_obj_add_flag(lockImage, LV_OBJ_FLAG_ADV_HITTEST); /// Flags lv_obj_clear_flag(lockImage, LV_OBJ_FLAG_SCROLLABLE); /// Flags - lv_obj_set_style_img_recolor(lockImage, lv_color_hex(recolor), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_img_recolor_opa(lockImage, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_img_recolor(lockImage, lv_color_hex(recolor), LV_PART_MAIN); + lv_obj_set_style_img_recolor_opa(lockImage, 255, LV_PART_MAIN); lv_obj_t *bellImage = NULL; if (lv_obj_get_child_cnt(btn[ch.index]) < 3) @@ -5819,7 +5799,7 @@ void TFTView_320x240::updateChannelConfig(const meshtastic_Channel &ch) lv_obj_set_align(bellImage, LV_ALIGN_RIGHT_MID); lv_obj_add_flag(bellImage, LV_OBJ_FLAG_ADV_HITTEST); /// Flags lv_obj_clear_flag(bellImage, LV_OBJ_FLAG_SCROLLABLE); /// Flags - lv_obj_set_style_img_recolor_opa(bellImage, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_img_recolor_opa(bellImage, 255, LV_PART_MAIN); updateGroupChannel(ch.index); } else { // display smaller button with just the channel number @@ -5843,7 +5823,7 @@ void TFTView_320x240::updateGroupChannel(uint8_t chId) lv_obj_t *bellImage = lv_obj_get_child(btn[chId], 2); if (db.channel[chId].settings.module_settings.is_muted) { - lv_obj_set_style_img_recolor(bellImage, lv_color_hex(0xffab0000), LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_img_recolor(bellImage, lv_color_hex(0xffab0000), LV_PART_MAIN); lv_image_set_src(bellImage, &img_groups_bell_slash_image); } else { Themes::recolorImage(bellImage, true); @@ -6289,12 +6269,12 @@ lv_obj_t *TFTView_320x240::newMessageContainer(uint32_t from, uint32_t to, uint8 LV_OBJ_FLAG_SNAPPABLE | LV_OBJ_FLAG_SCROLL_ELASTIC)); /// Flags lv_obj_set_scrollbar_mode(container, LV_SCROLLBAR_MODE_ACTIVE); lv_obj_set_scroll_dir(container, LV_DIR_VER); - lv_obj_set_style_pad_left(container, 6, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_right(container, 6, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_top(container, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_bottom(container, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_row(container, 6, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_column(container, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_left(container, 6, LV_PART_MAIN); + lv_obj_set_style_pad_right(container, 6, LV_PART_MAIN); + lv_obj_set_style_pad_top(container, 0, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(container, 0, LV_PART_MAIN); + lv_obj_set_style_pad_row(container, 6, LV_PART_MAIN); + lv_obj_set_style_pad_column(container, 0, LV_PART_MAIN); // store new message container if (to == UINT32_MAX || from == 0) { @@ -6388,16 +6368,17 @@ void TFTView_320x240::newMessage(uint32_t nodeNum, lv_obj_t *container, uint8_t lv_obj_set_height(hiddenPanel, LV_SIZE_CONTENT); /// 50 lv_obj_set_align(hiddenPanel, LV_ALIGN_CENTER); lv_obj_clear_flag(hiddenPanel, LV_OBJ_FLAG_SCROLLABLE); /// Flags - lv_obj_set_style_radius(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_radius(hiddenPanel, 0, LV_PART_MAIN); add_style_panel_style(hiddenPanel); - lv_obj_set_style_pad_left(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_right(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_top(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_bottom(hiddenPanel, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_pad_left(hiddenPanel, 0, LV_PART_MAIN); + lv_obj_set_style_pad_right(hiddenPanel, 0, LV_PART_MAIN); + lv_obj_set_style_pad_top(hiddenPanel, 0, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(hiddenPanel, 0, LV_PART_MAIN); lv_obj_t *msgLabel = lv_label_create(hiddenPanel); // calculate expected size of text bubble, to make it look nicer - lv_coord_t width = lv_txt_get_width(msg, strlen(msg), &ui_font_montserrat_14, 0); + lv_text_attributes_t text{}; + lv_coord_t width = lv_txt_get_width(msg, strlen(msg), &ui_font_montserrat_14, &text); lv_obj_set_width(msgLabel, std::max(std::min((int32_t)(width), 160) + 10, 40)); lv_obj_set_height(msgLabel, LV_SIZE_CONTENT); lv_obj_set_align(msgLabel, LV_ALIGN_LEFT_MID); @@ -6503,18 +6484,18 @@ void TFTView_320x240::addChat(uint32_t from, uint32_t to, uint8_t ch) lv_obj_add_flag(chatBtn, LV_OBJ_FLAG_SCROLL_ON_FOCUS); lv_obj_clear_flag(chatBtn, LV_OBJ_FLAG_SCROLLABLE); add_style_home_button_style(chatBtn); - lv_obj_set_style_align(chatBtn, LV_ALIGN_TOP_MID, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_color(chatBtn, colorMidGray, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_width(chatBtn, 1, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_shadow_ofs_x(chatBtn, 1, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_shadow_ofs_y(chatBtn, 2, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_radius(chatBtn, 6, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_left(chatBtn, 3, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_right(chatBtn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_top(chatBtn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_bottom(chatBtn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_row(chatBtn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_pad_column(chatBtn, 0, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(chatBtn, LV_ALIGN_TOP_MID, LV_PART_MAIN); + lv_obj_set_style_border_color(chatBtn, colorMidGray, LV_PART_MAIN); + lv_obj_set_style_border_width(chatBtn, 1, LV_PART_MAIN); + lv_obj_set_style_shadow_ofs_x(chatBtn, 1, LV_PART_MAIN); + lv_obj_set_style_shadow_ofs_y(chatBtn, 2, LV_PART_MAIN); + lv_obj_set_style_radius(chatBtn, 6, LV_PART_MAIN); + lv_obj_set_style_pad_left(chatBtn, 3, LV_PART_MAIN); + lv_obj_set_style_pad_right(chatBtn, 0, LV_PART_MAIN); + lv_obj_set_style_pad_top(chatBtn, 0, LV_PART_MAIN); + lv_obj_set_style_pad_bottom(chatBtn, 0, LV_PART_MAIN); + lv_obj_set_style_pad_row(chatBtn, 0, LV_PART_MAIN); + lv_obj_set_style_pad_column(chatBtn, 0, LV_PART_MAIN); char buf[64]; if (to == UINT32_MAX || from == 0) { @@ -6539,8 +6520,8 @@ void TFTView_320x240::addChat(uint32_t from, uint32_t to, uint8_t ch) lv_obj_set_size(obj, LV_PCT(100), LV_SIZE_CONTENT); lv_label_set_long_mode(obj, LV_LABEL_LONG_DOT); lv_label_set_text(obj, buf); - lv_obj_set_style_align(obj, LV_ALIGN_LEFT_MID, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(obj, LV_ALIGN_LEFT_MID, LV_PART_MAIN); + lv_obj_set_style_text_align(obj, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN); } { // ChatDelButton @@ -6549,8 +6530,8 @@ void TFTView_320x240::addChat(uint32_t from, uint32_t to, uint8_t ch) lv_obj_set_pos(obj, -3, -1); lv_obj_set_size(obj, 40, 23); lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_style_align(obj, LV_ALIGN_RIGHT_MID, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(obj, colorDarkRed, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(obj, LV_ALIGN_RIGHT_MID, LV_PART_MAIN); + lv_obj_set_style_bg_color(obj, colorDarkRed, LV_PART_MAIN); lv_obj_add_flag(obj, LV_OBJ_FLAG_HIDDEN); { lv_obj_t *parent_obj = obj; @@ -6560,7 +6541,7 @@ void TFTView_320x240::addChat(uint32_t from, uint32_t to, uint8_t ch) lv_obj_set_pos(chatDelBtn, 0, 0); lv_obj_set_size(chatDelBtn, LV_SIZE_CONTENT, LV_SIZE_CONTENT); lv_label_set_text(chatDelBtn, _("DEL")); - lv_obj_set_style_align(chatDelBtn, LV_ALIGN_CENTER, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_align(chatDelBtn, LV_ALIGN_CENTER, LV_PART_MAIN); } } } @@ -6583,7 +6564,7 @@ void TFTView_320x240::highlightChat(uint32_t from, uint32_t to, uint8_t ch) auto it = chats.find(index); if (it != chats.end()) { // mark chat in color - lv_obj_set_style_border_color(it->second, colorOrange, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(it->second, colorOrange, LV_PART_MAIN); } } @@ -6688,16 +6669,13 @@ void TFTView_320x240::showMessages(uint32_t nodeNum) ui_set_active(objects.messages_button, objects.messages_panel, objects.top_messages_panel); switch ((unsigned long)p->LV_OBJ_IDX(node_bat_idx)->user_data) { case 0: - lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_channel_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_channel_image, LV_PART_MAIN); break; case 1: - lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_secure_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_secure_image, LV_PART_MAIN); break; default: - lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_slash_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_slash_image, LV_PART_MAIN); break; } unreadMessages = 0; // TODO: not all messages may be actually read @@ -6921,10 +6899,10 @@ void TFTView_320x240::setNodeImage(uint32_t nodeNum, eRole role, bool unmessagab std::tie(bgColor, fgColor) = nodeColor(nodeNum); if (unmessagable) { lv_image_set_src(img, &img_unmessagable_image); - lv_obj_set_style_border_color(img, lv_color_hex(bgColor), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_bg_color(img, lv_color_hex(0x202020), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_img_recolor(img, lv_color_hex(0xFF5555), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_img_recolor_opa(img, 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_border_color(img, lv_color_hex(bgColor), LV_PART_MAIN); + lv_obj_set_style_bg_color(img, lv_color_hex(0x202020), LV_PART_MAIN); + lv_obj_set_style_img_recolor(img, lv_color_hex(0xFF5555), LV_PART_MAIN); + lv_obj_set_style_img_recolor_opa(img, 255, LV_PART_MAIN); return; } else { switch (role) { @@ -6961,9 +6939,9 @@ void TFTView_320x240::setNodeImage(uint32_t nodeNum, eRole role, bool unmessagab break; } } - lv_obj_set_style_bg_color(img, lv_color_hex(bgColor), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_border_color(img, lv_color_hex(bgColor), LV_PART_MAIN | LV_STATE_DEFAULT); - lv_obj_set_style_img_recolor_opa(img, fgColor ? 0 : 255, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_color(img, lv_color_hex(bgColor), LV_PART_MAIN); + lv_obj_set_style_border_color(img, lv_color_hex(bgColor), LV_PART_MAIN); + lv_obj_set_style_img_recolor_opa(img, fgColor ? 0 : 255, LV_PART_MAIN); } void TFTView_320x240::updateNodesStatus(void) @@ -7069,11 +7047,10 @@ void TFTView_320x240::updateUnreadMessages(void) char buf[64]; if (unreadMessages > 0) { sprintf(buf, unreadMessages == 1 ? _("%d new message") : _("%d new messages"), unreadMessages); - lv_obj_set_style_bg_img_src(objects.home_mail_button, &img_home_mail_unread_button_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_src(objects.home_mail_button, &img_home_mail_unread_button_image, LV_PART_MAIN); } else { strcpy(buf, _("no new messages")); - lv_obj_set_style_bg_img_src(objects.home_mail_button, &img_home_mail_button_image, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_img_src(objects.home_mail_button, &img_home_mail_button_image, LV_PART_MAIN); } lv_label_set_text(objects.home_mail_label, buf); } @@ -7283,8 +7260,7 @@ void TFTView_320x240::task_handler(void) if (startTime) { if (curtime - startTime > 30) { lv_label_set_text(objects.trace_route_start_label, _("Start")); - lv_obj_set_style_outline_color(objects.trace_route_start_button, colorMesh, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_outline_color(objects.trace_route_start_button, colorMesh, LV_PART_MAIN); removeSpinner(); } else { char buf[16]; @@ -7311,8 +7287,7 @@ void TFTView_320x240::task_handler(void) // if we didn't hear any node for 1h assume we have no signal if (curtime - lastHeard > secs_until_offline) { - lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_no_signal_image, - LV_PART_MAIN | LV_STATE_DEFAULT); + lv_obj_set_style_bg_image_src(objects.home_signal_button, &img_home_no_signal_image, LV_PART_MAIN); lv_label_set_text(objects.home_signal_label, _("no signal")); lv_label_set_text(objects.home_signal_pct_label, ""); } diff --git a/source/graphics/driver/DisplayDriverFactory.cpp b/source/graphics/driver/DisplayDriverFactory.cpp index 41f749c5..a3f65e7d 100644 --- a/source/graphics/driver/DisplayDriverFactory.cpp +++ b/source/graphics/driver/DisplayDriverFactory.cpp @@ -16,6 +16,9 @@ #if defined(USE_X11) #include "graphics/driver/X11Driver.h" #endif +#if defined(USE_SDL) +#include "graphics/driver/SDLDriver.h" +#endif #ifndef ARCH_PORTDUINO #ifdef LGFX_DRIVER_TEMPLATE @@ -178,14 +181,21 @@ DisplayDriver *DisplayDriverFactory::create(const DisplayDriverConfig &cfg) return new LGFXDriver(cfg.width(), cfg.height()); break; #endif -#elif defined(USE_FRAMEBUFFER) +#endif +#if defined(USE_FRAMEBUFFER) case DisplayDriverConfig::device_t::FB: return &FBDriver::create(cfg.width(), cfg.height()); break; -#elif defined(USE_X11) +#endif +#if defined(USE_X11) case DisplayDriverConfig::device_t::X11: return &X11Driver::create(cfg.width(), cfg.height()); break; +#endif +#if defined(USE_SDL) + case DisplayDriverConfig::device_t::SDL: + return &SDLDriver::create(cfg.width(), cfg.height()); + break; #endif default: ILOG_CRIT("LGFX device_t config not implemented: %d", cfg._device); diff --git a/source/graphics/driver/SDLDriver.cpp b/source/graphics/driver/SDLDriver.cpp new file mode 100644 index 00000000..20475d47 --- /dev/null +++ b/source/graphics/driver/SDLDriver.cpp @@ -0,0 +1,66 @@ +#ifdef USE_SDL +#include "graphics/driver/SDLDriver.h" +#include "util/ILog.h" +#include +#include +#include +#include + +LV_IMG_DECLARE(mouse_cursor_icon); + +SDLDriver *SDLDriver::SDLdriver = nullptr; + +SDLDriver &SDLDriver::create(uint16_t width, uint16_t height) +{ + if (!SDLdriver) + SDLdriver = new SDLDriver(width, height); + return *SDLdriver; +} + +SDLDriver::SDLDriver(uint16_t width, uint16_t height) : DisplayDriver(width, height) {} + +void SDLDriver::init(DeviceGUI *gui) +{ + ILOG_DEBUG("SDLDriver::init..."); + // Initialize LVGL + DisplayDriver::init(gui); + + display = lv_sdl_window_create(screenWidth, screenHeight); + lv_display_set_color_format(display, LV_COLOR_FORMAT_RGB565); + char title[25]; + sprintf(title, "Meshtastic (%dx%d)", screenWidth, screenHeight); + lv_sdl_window_set_title(display, title); + lv_indev_t *mouse = lv_sdl_mouse_create(); + lv_indev_t *mouseWheel = lv_sdl_mousewheel_create(); + lv_indev_t *keyboard = lv_sdl_keyboard_create(); +} + +void SDLDriver::task_handler(void) +{ +#if 0 + static Uint32 lastTick = SDL_GetTicks(); + SDL_Delay(5); + Uint32 current = SDL_GetTicks(); + lv_tick_inc(current - lastTick); // Update the tick timer. Tick is new for LVGL 9 + lastTick = current; + lv_timer_handler(); // Update the UI +#elif 0 + const int ms = 10; + auto start = std::chrono::high_resolution_clock::now(); + DisplayDriver::task_handler(); + // lv_timer_handler(); + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(stop - start); + if (duration.count() < ms) { + SDL_Delay(ms - duration.count()); + lv_tick_inc(ms); + } else { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + lv_tick_inc(duration.count() + 1); + } +#else + usleep(lv_timer_handler() * 1000); +#endif +} + +#endif \ No newline at end of file diff --git a/source/graphics/driver/X11Driver.cpp b/source/graphics/driver/X11Driver.cpp index e685e46e..e83c3cdd 100644 --- a/source/graphics/driver/X11Driver.cpp +++ b/source/graphics/driver/X11Driver.cpp @@ -2,6 +2,7 @@ #include "graphics/driver/X11Driver.h" #include "util/ILog.h" #include +#include LV_IMG_DECLARE(mouse_cursor_icon); @@ -28,4 +29,24 @@ void X11Driver::init(DeviceGUI *gui) lv_x11_inputs_create(display, &mouse_cursor_icon); } +/** + * Measure how long it takes to call DisplayDriver::task_handler(). + * Then tell the lvgl library how long it took via lv_tick_inc(). + */ +void X11Driver::task_handler(void) +{ + const int ms = 10; + auto start = std::chrono::high_resolution_clock::now(); + DisplayDriver::task_handler(); + auto stop = std::chrono::high_resolution_clock::now(); + auto duration = std::chrono::duration_cast(stop - start); + if (duration.count() < ms) { + std::this_thread::sleep_for(std::chrono::milliseconds(ms - duration.count())); + lv_tick_inc(ms); + } else { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + lv_tick_inc(duration.count() + 1); + } +} + #endif \ No newline at end of file From bb6445cc70aba9c630f7539f24a7b6f1224779db Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Fri, 17 Jul 2026 00:37:57 +0200 Subject: [PATCH 2/8] update lv_conf.h to v9.5.0 --- include/lv_conf.h | 706 ++++++++++++++++++++++++++-------------------- 1 file changed, 397 insertions(+), 309 deletions(-) diff --git a/include/lv_conf.h b/include/lv_conf.h index b456d0a5..d726c900 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -1,14 +1,14 @@ /** * @file lv_conf.h - * Configuration file for v9.2.2 + * Configuration file for v9.5.0 */ /* * Copy this file as `lv_conf.h` - * 1. simply next to the `lvgl` folder - * 2. or any other places and - * - define `LV_CONF_INCLUDE_SIMPLE` - * - add the path as include path + * 1. simply next to `lvgl` folder + * 2. or to any other place and + * - define `LV_CONF_INCLUDE_SIMPLE`; + * - add the path as an include path. */ /* clang-format off */ @@ -17,7 +17,7 @@ #ifndef LV_CONF_H #define LV_CONF_H -/*If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ +/* If you need to include anything here, do it inside the `__ASSEMBLY__` guard */ #if 0 && defined(__ASSEMBLY__) #include "my_include.h" #endif @@ -26,7 +26,7 @@ COLOR SETTINGS *====================*/ -/*Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/ +/** Color depth: 1 (I1), 8 (L8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888) */ #ifndef LV_COLOR_DEPTH #define LV_COLOR_DEPTH 16 #endif @@ -35,7 +35,7 @@ STDLIB WRAPPER SETTINGS *=========================*/ -/* Possible values +/** Possible values * - LV_STDLIB_BUILTIN: LVGL's built in implementation * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc * - LV_STDLIB_MICROPYTHON: MicroPython implementation @@ -43,7 +43,23 @@ * - LV_STDLIB_CUSTOM: Implement the functions externally */ #define LV_USE_STDLIB_MALLOC LV_STDLIB_BUILTIN + +/** Possible values + * - LV_STDLIB_BUILTIN: LVGL's built in implementation + * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc + * - LV_STDLIB_MICROPYTHON: MicroPython implementation + * - LV_STDLIB_RTTHREAD: RT-Thread implementation + * - LV_STDLIB_CUSTOM: Implement the functions externally + */ #define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN + +/** Possible values + * - LV_STDLIB_BUILTIN: LVGL's built in implementation + * - LV_STDLIB_CLIB: Standard C functions, like malloc, strlen, etc + * - LV_STDLIB_MICROPYTHON: MicroPython implementation + * - LV_STDLIB_RTTHREAD: RT-Thread implementation + * - LV_STDLIB_CUSTOM: Implement the functions externally + */ #define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN #define LV_STDINT_INCLUDE @@ -58,15 +74,15 @@ #define RAM_SIZE 96 #endif - /*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/ - #define LV_MEM_SIZE (RAM_SIZE * 1024U) /*[bytes]*/ + /** Size of the memory available for `lv_malloc()` in bytes (>= 2kB) */ + #define LV_MEM_SIZE (RAM_SIZE * 1024U) /**< [bytes] */ - /*Size of the memory expand for `lv_malloc()` in bytes*/ + /** Size of the memory expand for `lv_malloc()` in bytes */ #define LV_MEM_POOL_EXPAND_SIZE 0 - /*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ - #define LV_MEM_ADR 0 /*0: unused*/ - /*Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ + /** Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ + #define LV_MEM_ADR 0 /**< 0: unused*/ + /* Instead of an address give a memory allocator that will be called to get a memory pool for LVGL. E.g. my_malloc*/ #if LV_MEM_ADR == 0 #if defined BOARD_HAS_PSRAM #define LV_MEM_POOL_INCLUDE @@ -82,17 +98,17 @@ HAL SETTINGS *====================*/ -/*Default display refresh, input device read and animation step period.*/ -#define LV_DEF_REFR_PERIOD 40 /*[ms]*/ +/** Default display refresh, input device read and animation step period. */ +#define LV_DEF_REFR_PERIOD 40 /**< [ms] */ -/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. - *(Not so important, you can adjust it to modify default sizes and spaces)*/ -#define LV_DPI_DEF 140 /*[px/inch]*/ +/** Default Dots Per Inch. Used to initialize default sizes such as widgets sized, style paddings. + * (Not so important, you can adjust it to modify default sizes and spaces.) */ +#define LV_DPI_DEF 130 /**< [px/inch] */ /*================= * OPERATING SYSTEM *=================*/ -/*Select an operating system to use. Possible options: +/** Select operating system to use. Possible options: * - LV_OS_NONE * - LV_OS_PTHREAD * - LV_OS_FREERTOS @@ -120,16 +136,16 @@ * RENDERING CONFIGURATION *========================*/ -/*Align the stride of all layers and images to this bytes*/ +/** Align stride of all layers and images to this bytes */ #define LV_DRAW_BUF_STRIDE_ALIGN 1 /*Align the start address of draw_buf addresses to this bytes*/ #define LV_DRAW_BUF_ALIGN 4 -/*Using matrix for transformations. - *Requirements: - `LV_USE_MATRIX = 1`. - The rendering engine needs to support 3x3 matrix transformations.*/ +/** Using matrix for transformations. + * Requirements: + * - `LV_USE_MATRIX = 1`. + * - Rendering engine needs to support 3x3 matrix transformations. */ #define LV_DRAW_TRANSFORM_USE_MATRIX 0 /* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode @@ -137,8 +153,8 @@ * "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers * and can't be drawn in chunks. */ -/*The target buffer size for simple layer chunks.*/ -#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/ +/** The target buffer size for simple layer chunks. */ +#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /**< [bytes]*/ /* Limit the max allocated memory for simple and transformed layers. * It should be at least `LV_DRAW_LAYER_SIMPLE_BUF_SIZE` sized but if transformed layers are also used @@ -162,7 +178,6 @@ #define LV_USE_DRAW_SW 1 #if LV_USE_DRAW_SW == 1 - /* * Selectively disable color format support in order to reduce code size. * NOTE: some features use certain color formats internally, e.g. @@ -191,26 +206,27 @@ * - > 1 means multiple threads will render the screen in parallel. */ #define LV_DRAW_SW_DRAW_UNIT_CNT 1 - /* Use Arm-2D to accelerate the sw render */ + /** Use Arm-2D to accelerate software (sw) rendering. */ #define LV_USE_DRAW_ARM2D_SYNC 0 /* Enable native helium assembly to be compiled */ #define LV_USE_NATIVE_HELIUM_ASM 0 - /* 0: use a simple renderer capable of drawing only simple rectangles with gradient, images, texts, and straight lines only - * 1: use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too */ + /** + * - 0: Use a simple renderer capable of drawing only simple rectangles with gradient, images, text, and straight lines only. + * - 1: Use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too. */ #define LV_DRAW_SW_COMPLEX 1 #if LV_DRAW_SW_COMPLEX == 1 - /*Allow buffering some shadow calculation. - *LV_DRAW_SW_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` - *Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost*/ + /** Allow buffering some shadow calculation. + * LV_DRAW_SW_SHADOW_CACHE_SIZE is the maximum shadow size to buffer, where shadow size is + * `shadow_width + radius`. Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost. */ #define LV_DRAW_SW_SHADOW_CACHE_SIZE 0 - /* Set number of maximally cached circle data. - * The circumference of 1/4 circle are saved for anti-aliasing - * radius * 4 bytes are used per circle (the most often used radiuses are saved) - * 0: to disable caching */ + /** Set number of maximally-cached circle data. + * The circumference of 1/4 circle are saved for anti-aliasing. + * `radius * 4` bytes are used per circle (the most often used radiuses are saved). + * - 0: disables caching */ #define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4 #endif @@ -220,20 +236,38 @@ #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE "" #endif - /* Enable drawing complex gradients in software: linear at an angle, radial or conical */ + /** Enable drawing complex gradients in software: linear at an angle, radial or conical */ #define LV_USE_DRAW_SW_COMPLEX_GRADIENTS 0 + #endif /*Use TSi's aka (Think Silicon) NemaGFX */ #define LV_USE_NEMA_GFX 0 #if LV_USE_NEMA_GFX + /** Select which NemaGFX static library headers to use. Possible options: + * - LV_NEMA_LIB_NONE an alias of LV_NEMA_LIB_M33_REVC + * - LV_NEMA_LIB_M33_REVC + * - LV_NEMA_LIB_M33_NEMAPVG + * - LV_NEMA_LIB_M55 + * - LV_NEMA_LIB_M7 + * You must also take care to link the correct corresponding static library + * in libs/nema_gfx/lib/core/ + */ + #define LV_USE_NEMA_LIB LV_NEMA_LIB_NONE + /** Select which NemaGFX HAL to use. Possible options: * - LV_NEMA_HAL_CUSTOM * - LV_NEMA_HAL_STM32 */ #define LV_USE_NEMA_HAL LV_NEMA_HAL_CUSTOM #if LV_USE_NEMA_HAL == LV_NEMA_HAL_STM32 #define LV_NEMA_STM32_HAL_INCLUDE + + /** Set it to a value like __attribute__((section("Nemagfx_Memory_Pool_Buffer"))) + * and define the section in the linker script if you need the GPU memory to + * be, e.g. in a region where accesses will not be cached. + */ + #define LV_NEMA_STM32_HAL_ATTRIBUTE_POOL_MEM #endif /*Enable Vector Graphics Operations. Available only if NemaVG library is present*/ @@ -249,30 +283,36 @@ #define LV_USE_PXP 0 #if LV_USE_PXP - /* Use PXP for drawing.*/ + /** Use PXP for drawing.*/ #define LV_USE_DRAW_PXP 1 - /* Use PXP to rotate display.*/ + /** Use PXP to rotate display.*/ #define LV_USE_ROTATE_PXP 0 #if LV_USE_DRAW_PXP && LV_USE_OS - /* Use additional draw thread for PXP processing.*/ + /** Use additional draw thread for PXP processing.*/ #define LV_USE_PXP_DRAW_THREAD 1 #endif - /* Enable PXP asserts. */ + /** Enable PXP asserts. */ #define LV_USE_PXP_ASSERT 0 #endif /** Use NXP's G2D on MPU platforms. */ -#define LV_USE_DRAW_G2D 0 +#define LV_USE_G2D 0 + +#if LV_USE_G2D + /** Use G2D for drawing. **/ + #define LV_USE_DRAW_G2D 1 + + /** Use G2D to rotate display. **/ + #define LV_USE_ROTATE_G2D 0 -#if LV_USE_DRAW_G2D /** Maximum number of buffers that can be stored for G2D draw unit. * Includes the frame buffers and assets. */ #define LV_G2D_HASH_TABLE_SIZE 50 - #if LV_USE_OS + #if LV_USE_DRAW_G2D && LV_USE_OS /** Use additional draw thread for G2D processing.*/ #define LV_USE_G2D_DRAW_THREAD 1 #endif @@ -290,41 +330,47 @@ #else #define LV_USE_SDL USE_SDL #endif -#define LV_USE_DRAW_SDL LV_USE_SDL +#define LV_USE_DRAW_SDL LV_USE_SDL -/* Use VG-Lite GPU. */ +/** Use VG-Lite GPU. */ #define LV_USE_DRAW_VG_LITE 0 - #if LV_USE_DRAW_VG_LITE - /* Enable VG-Lite custom external 'gpu_init()' function */ + /** Enable VG-Lite custom external 'gpu_init()' function */ #define LV_VG_LITE_USE_GPU_INIT 0 - /* Enable VG-Lite assert. */ + /** Enable VG-Lite assert. */ #define LV_VG_LITE_USE_ASSERT 0 - /* VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */ + /** VG-Lite flush commit trigger threshold. GPU will try to batch these many draw tasks. */ #define LV_VG_LITE_FLUSH_MAX_COUNT 8 - /* Enable border to simulate shadow - * NOTE: which usually improves performance, - * but does not guarantee the same rendering quality as the software. */ + /** Enable border to simulate shadow. + * NOTE: which usually improves performance, + * but does not guarantee the same rendering quality as the software. */ #define LV_VG_LITE_USE_BOX_SHADOW 1 - /* VG-Lite gradient maximum cache number. - * NOTE: The memory usage of a single gradient image is 4K bytes. - */ + /** VG-Lite gradient maximum cache number. + * @note The memory usage of a single gradient image is 4K bytes. */ #define LV_VG_LITE_GRAD_CACHE_CNT 32 - /* VG-Lite stroke maximum cache number. - */ + /** VG-Lite stroke maximum cache number. */ #define LV_VG_LITE_STROKE_CACHE_CNT 32 + /** VG-Lite unaligned bitmap font maximum cache number. */ + #define LV_VG_LITE_BITMAP_FONT_CACHE_CNT 256 + /** Remove VLC_OP_CLOSE path instruction (Workaround for NXP) **/ #define LV_VG_LITE_DISABLE_VLC_OP_CLOSE 0 + /** Disable blit rectangular offset to resolve certain hardware errors. */ + #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET 0 + /** Disable linear gradient extension for some older versions of drivers. */ #define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT 0 + /** Maximum path dump print length (in points) */ + #define LV_VG_LITE_PATH_DUMP_MAX_LEN 1000 + /** Enable usage of the LVGL's built-in vg_lite driver */ #define LV_USE_VG_LITE_DRIVER 0 #if LV_USE_VG_LITE_DRIVER @@ -383,7 +429,8 @@ /** Draw using espressif PPA accelerator */ #define LV_USE_PPA 0 #if LV_USE_PPA - #define LV_USE_PPA_IMG 0 + #define LV_USE_PPA_IMG 0 + #define LV_PPA_BURST_LENGTH 128 #endif /* Use EVE FT81X GPU. */ @@ -391,6 +438,31 @@ #if LV_USE_DRAW_EVE /* EVE_GEN value: 2, 3, or 4 */ #define LV_DRAW_EVE_EVE_GENERATION 4 + + /* The maximum number of bytes to buffer before a single SPI transmission. + * Set it to 0 to disable write buffering. + */ + #define LV_DRAW_EVE_WRITE_BUFFER_SIZE 2048 +#endif + +/** Use NanoVG Renderer + * - Requires LV_USE_NANOVG, LV_USE_MATRIX. + */ +#define LV_USE_DRAW_NANOVG 0 +#if LV_USE_DRAW_NANOVG + /** Select OpenGL backend for NanoVG: + * - LV_NANOVG_BACKEND_GL2: OpenGL 2.0 + * - LV_NANOVG_BACKEND_GL3: OpenGL 3.0+ + * - LV_NANOVG_BACKEND_GLES2: OpenGL ES 2.0 + * - LV_NANOVG_BACKEND_GLES3: OpenGL ES 3.0+ + */ + #define LV_NANOVG_BACKEND LV_NANOVG_BACKEND_GLES2 + + /** Draw image texture cache count. */ + #define LV_NANOVG_IMAGE_CACHE_CNT 128 + + /** Draw letter texture cache count. */ + #define LV_NANOVG_LETTER_CACHE_CNT 512 #endif /*======================= @@ -401,82 +473,79 @@ * Logging *-----------*/ -/*Enable the log module*/ +/** Enable the log module */ #ifndef LV_USE_LOG #define LV_USE_LOG 0 #endif #if LV_USE_LOG - - /*How important log should be added: - *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information - *LV_LOG_LEVEL_INFO Log important events - *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem - *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail - *LV_LOG_LEVEL_USER Only logs added by the user - *LV_LOG_LEVEL_NONE Do not log anything*/ - + /** Set value to one of the following levels of logging detail: + * - LV_LOG_LEVEL_TRACE Log detailed information. + * - LV_LOG_LEVEL_INFO Log important events. + * - LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem. + * - LV_LOG_LEVEL_ERROR Log only critical issues, when system may fail. + * - LV_LOG_LEVEL_USER Log only custom log messages added by the user. + * - LV_LOG_LEVEL_NONE Do not log anything. */ #define LV_LOG_LEVEL LV_LOG_LEVEL_WARN - /*1: Print the log with 'printf'; - *0: User need to register a callback with `lv_log_register_print_cb()`*/ + /** - 1: Print log with 'printf'; + * - 0: User needs to register a callback with `lv_log_register_print_cb()`. */ #define LV_LOG_PRINTF 0 - /*Set callback to print the logs. - *E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)` - *Can be overwritten by `lv_log_register_print_cb`*/ + /** Set callback to print logs. + * E.g `my_print`. The prototype should be `void my_print(lv_log_level_t level, const char * buf)`. + * Can be overwritten by `lv_log_register_print_cb`. */ //#define LV_LOG_PRINT_CB - /*1: Enable print timestamp; - *0: Disable print timestamp*/ + /** - 1: Enable printing timestamp; + * - 0: Disable printing timestamp. */ #define LV_LOG_USE_TIMESTAMP 1 - /*1: Print file and line number of the log; - *0: Do not print file and line number of the log*/ + /** - 1: Print file and line number of the log; + * - 0: Do not print file and line number of the log. */ #define LV_LOG_USE_FILE_LINE 1 - - /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ - #define LV_LOG_TRACE_MEM 0 - #define LV_LOG_TRACE_TIMER 0 - #define LV_LOG_TRACE_INDEV 0 - #define LV_LOG_TRACE_DISP_REFR 0 - #define LV_LOG_TRACE_EVENT 0 - #define LV_LOG_TRACE_OBJ_CREATE 0 - #define LV_LOG_TRACE_LAYOUT 0 - #define LV_LOG_TRACE_ANIM 0 - #define LV_LOG_TRACE_CACHE 1 - + /* Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs. */ + #define LV_LOG_TRACE_MEM 0 /**< Enable/disable trace logs in memory operations. */ + #define LV_LOG_TRACE_TIMER 0 /**< Enable/disable trace logs in timer operations. */ + #define LV_LOG_TRACE_INDEV 0 /**< Enable/disable trace logs in input device operations. */ + #define LV_LOG_TRACE_DISP_REFR 0 /**< Enable/disable trace logs in display re-draw operations. */ + #define LV_LOG_TRACE_EVENT 0 /**< Enable/disable trace logs in event dispatch logic. */ + #define LV_LOG_TRACE_OBJ_CREATE 0 /**< Enable/disable trace logs in object creation (core `obj` creation plus every widget). */ + #define LV_LOG_TRACE_LAYOUT 0 /**< Enable/disable trace logs in flex- and grid-layout operations. */ + #define LV_LOG_TRACE_ANIM 0 /**< Enable/disable trace logs in animation logic. */ + #define LV_LOG_TRACE_CACHE 0 /**< Enable/disable trace logs in cache operations. */ #endif /*LV_USE_LOG*/ /*------------- * Asserts *-----------*/ -/*Enable asserts if an operation is failed or an invalid data is found. - *If LV_USE_LOG is enabled an error message will be printed on failure*/ -#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ -#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ -#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ -#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ +/* Enable assertion failures if an operation fails or invalid data is found. + * If LV_USE_LOG is enabled, an error message will be printed on failure. */ +#define LV_USE_ASSERT_NULL 1 /**< Check if the parameter is NULL. (Very fast, recommended) */ +#define LV_USE_ASSERT_MALLOC 1 /**< Checks is the memory is successfully allocated or no. (Very fast, recommended) */ +#define LV_USE_ASSERT_STYLE 0 /**< Check if the styles are properly initialized. (Very fast, recommended) */ +#define LV_USE_ASSERT_MEM_INTEGRITY 0 /**< Check the integrity of `lv_mem` after critical operations. (Slow) */ +#define LV_USE_ASSERT_OBJ 0 /**< Check the object's type and existence (e.g. not deleted). (Slow) */ -/*Add a custom handler when assert happens e.g. to restart the MCU*/ +/** Add a custom handler when assert happens e.g. to restart MCU. */ #define LV_ASSERT_HANDLER_INCLUDE -#define LV_ASSERT_HANDLER while(1); /*Halt by default*/ +#define LV_ASSERT_HANDLER while(1); /**< Halt by default */ /*------------- * Debug *-----------*/ -/*1: Draw random colored rectangles over the redrawn areas*/ +/** 1: Draw random colored rectangles over the redrawn areas. */ #define LV_USE_REFR_DEBUG 0 -/*1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/ +/** 1: Draw a red overlay for ARGB layers and a green overlay for RGB layers*/ #define LV_USE_LAYER_DEBUG 0 -/*1: Draw overlays with different colors for each draw_unit's tasks. - *Also add the index number of the draw unit on white background. - *For layers add the index number of the draw unit on black background.*/ +/** 1: Adds the following behaviors for debugging: + * - Draw overlays with different colors for each draw_unit's tasks. + * - Draw index number of draw unit on white background. + * - For layers, draws index number of draw unit on black background. */ #define LV_USE_PARALLEL_DRAW_DEBUG 0 /*------------- @@ -485,24 +554,25 @@ #define LV_ENABLE_GLOBAL_CUSTOM 0 #if LV_ENABLE_GLOBAL_CUSTOM - /*Header to include for the custom 'lv_global' function"*/ + /** Header to include for custom 'lv_global' function" */ #define LV_GLOBAL_CUSTOM_INCLUDE #endif -/*Default cache size in bytes. - *Used by image decoders such as `lv_lodepng` to keep the decoded image in the memory. - *If size is not set to 0, the decoder will fail to decode when the cache is full. - *If size is 0, the cache function is not enabled and the decoded mem will be released immediately after use.*/ +/** Default cache size in bytes. + * Used by image decoders such as `lv_lodepng` to keep the decoded image in memory. + * If size is not set to 0, the decoder will fail to decode when the cache is full. + * If size is 0, the cache function is not enabled and the decoded memory will be + * released immediately after use. */ #ifndef LV_CACHE_DEF_SIZE #define LV_CACHE_DEF_SIZE 1572864 /* 6 tiles a 192kB */ #endif -/*Default number of image header cache entries. The cache is used to store the headers of images - *The main logic is like `LV_CACHE_DEF_SIZE` but for image headers.*/ +/** Default number of image header cache entries. The cache is used to store the headers of images + * The main logic is like `LV_CACHE_DEF_SIZE` but for image headers. */ #define LV_IMAGE_HEADER_CACHE_DEF_CNT 24 -/*Number of stops allowed per gradient. Increase this to allow more stops. - *This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/ +/** Number of stops allowed per gradient. Increase this to allow more stops. + * This adds (sizeof(lv_color_t) + 1) bytes per additional stop */ #define LV_GRADIENT_MAX_STOPS 2 /** Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently. @@ -513,10 +583,10 @@ * - 254: round up */ #define LV_COLOR_MIX_ROUND_OFS 0 -/* Add 2 x 32 bit variables to each lv_obj_t to speed up getting style properties */ +/** Add 2 x 32-bit variables to each `lv_obj_t` to speed up getting style properties */ #define LV_OBJ_STYLE_CACHE 0 -/* Add `id` field to `lv_obj_t` */ +/** Add `id` field to `lv_obj_t` */ #define LV_USE_OBJ_ID 0 /** Enable support widget names*/ @@ -547,48 +617,49 @@ * COMPILER SETTINGS *====================*/ -/*For big endian systems set to 1*/ +/** For big endian systems set to 1 */ #define LV_BIG_ENDIAN_SYSTEM 0 -/*Define a custom attribute to `lv_tick_inc` function*/ +/** Define a custom attribute for `lv_tick_inc` function */ #define LV_ATTRIBUTE_TICK_INC -/*Define a custom attribute to `lv_timer_handler` function*/ +/** Define a custom attribute for `lv_timer_handler` function */ #define LV_ATTRIBUTE_TIMER_HANDLER -/*Define a custom attribute to `lv_display_flush_ready` function*/ +/** Define a custom attribute for `lv_display_flush_ready` function */ #define LV_ATTRIBUTE_FLUSH_READY -/*Required alignment size for buffers*/ +/** Align VG_LITE buffers on this number of bytes. + * @note vglite_src_buf_aligned() uses this value to validate alignment of passed buffer pointers. */ #define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 -/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default). - * E.g. __attribute__((aligned(4)))*/ +/** Will be added where memory needs to be aligned (with -Os data might not be aligned to boundary by default). + * E.g. __attribute__((aligned(4)))*/ #define LV_ATTRIBUTE_MEM_ALIGN -/*Attribute to mark large constant arrays for example font's bitmaps*/ +/** Attribute to mark large constant arrays, for example for font bitmaps */ #define LV_ATTRIBUTE_LARGE_CONST -/*Compiler prefix for a big array declaration in RAM*/ +/** Compiler prefix for a large array declaration in RAM */ #define LV_ATTRIBUTE_LARGE_RAM_ARRAY -/*Place performance critical functions into a faster memory (e.g RAM)*/ +/** Place performance critical functions into a faster memory (e.g RAM) */ #if defined(ARCH_ESP32) #define LV_ATTRIBUTE_FAST_MEM IRAM_ATTR #endif -/*Export integer constant to binding. This macro is used with constants in the form of LV_ that - *should also appear on LVGL binding API such as MicroPython.*/ -#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ +/** Export integer constant to binding. This macro is used with constants in the form of LV_ that + * should also appear on LVGL binding API such as MicroPython. */ +#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /**< The default value just prevents GCC warning */ -/*Prefix all global extern data with this*/ +/** Prefix all global extern data with this */ #define LV_ATTRIBUTE_EXTERN_DATA -/* Use `float` as `lv_value_precise_t` */ +/** Use `float` as `lv_value_precise_t` */ #define LV_USE_FLOAT 0 -/*Enable matrix support - *Requires `LV_USE_FLOAT = 1`*/ +/** Enable matrix support + * - Requires `LV_USE_FLOAT = 1` */ #define LV_USE_MATRIX 0 /** Include `lvgl_private.h` in `lvgl.h` to access internal data and functions by default */ @@ -600,8 +671,8 @@ * FONT USAGE *===================*/ -/*Montserrat fonts with ASCII range and some symbols using bpp = 4 - *https://fonts.google.com/specimen/Montserrat*/ +/** Montserrat fonts with ASCII range and some symbols using bpp = 4 + * https://fonts.google.com/specimen/Montserrat */ #define LV_FONT_MONTSERRAT_8 0 #define LV_FONT_MONTSERRAT_10 1 #define LV_FONT_MONTSERRAT_12 0 @@ -630,27 +701,33 @@ #define LV_FONT_SOURCE_HAN_SANS_SC_14_CJK 0 /**< 1338 most common CJK radicals */ #define LV_FONT_SOURCE_HAN_SANS_SC_16_CJK 0 /**< 1338 most common CJK radicals */ -/*Pixel perfect monospace fonts*/ +/** Pixel perfect monospaced fonts */ #define LV_FONT_UNSCII_8 0 #define LV_FONT_UNSCII_16 0 -/*Optionally declare custom fonts here. - *You can use these fonts as default font too and they will be available globally. - *E.g. #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2)*/ +/** Optionally declare custom fonts here. + * + * You can use any of these fonts as the default font too and they will be available + * globally. Example: + * + * @code + * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) LV_FONT_DECLARE(my_font_2) + * @endcode + */ #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(ui_font_montserrat_12) LV_FONT_DECLARE(ui_font_montserrat_14) LV_FONT_DECLARE(ui_font_montserrat_16) LV_FONT_DECLARE(ui_font_montserrat_20) -/*Always set a default font*/ +/** Always set a default font */ #define LV_FONT_DEFAULT &ui_font_montserrat_14 -/*Enable handling large font and/or fonts with a lot of characters. - *The limit depends on the font size, font face and bpp. - *Compiler error will be triggered if a font needs it.*/ +/** Enable handling large font and/or fonts with a lot of characters. + * The limit depends on the font size, font face and bpp. + * A compiler error will be triggered if a font needs it. */ #define LV_FONT_FMT_TXT_LARGE 0 -/*Enables/disables support for compressed fonts.*/ +/** Enables/disables support for compressed fonts. */ #define LV_USE_FONT_COMPRESSED 0 -/*Enable drawing placeholders when glyph dsc is not found*/ +/** Enable drawing placeholders when glyph dsc is not found. */ #define LV_USE_FONT_PLACEHOLDER 0 /*================= @@ -659,41 +736,41 @@ /** * Select a character encoding for strings. - * Your IDE or editor should have the same character encoding + * Your IDE or editor should have the same character encoding. * - LV_TXT_ENC_UTF8 * - LV_TXT_ENC_ASCII */ #define LV_TXT_ENC LV_TXT_ENC_UTF8 -/*Can break (wrap) texts on these chars*/ +/** While rendering text strings, break (wrap) text on these chars. */ #define LV_TXT_BREAK_CHARS " ,.;:-_)]}" -/*If a word is at least this long, will break wherever "prettiest" - *To disable, set to a value <= 0*/ +/** If a word is at least this long, will break wherever "prettiest". + * To disable, set to a value <= 0. */ #define LV_TXT_LINE_BREAK_LONG_LEN 0 -/*Minimum number of characters in a long word to put on a line before a break. - *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +/** Minimum number of characters in a long word to put on a line before a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ #define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 -/*Minimum number of characters in a long word to put on a line after a break. - *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +/** Minimum number of characters in a long word to put on a line after a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 -/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. - *The direction will be processed according to the Unicode Bidirectional Algorithm: - *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ +/** Support bidirectional text. Allows mixing Left-to-Right and Right-to-Left text. + * The direction will be processed according to the Unicode Bidirectional Algorithm: + * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */ #define LV_USE_BIDI 0 #if LV_USE_BIDI /*Set the default direction. Supported values: *`LV_BASE_DIR_LTR` Left-to-Right *`LV_BASE_DIR_RTL` Right-to-Left - *`LV_BASE_DIR_AUTO` detect texts base direction*/ + *`LV_BASE_DIR_AUTO` detect text base direction*/ #define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO #endif -/*Enable Arabic/Persian processing - *In these languages characters should be replaced with another form based on their position in the text*/ +/** Enable Arabic/Persian processing + * In these languages characters should be replaced with another form based on their position in the text */ #define LV_USE_ARABIC_PERSIAN_CHARS 0 /*The control character to use for signaling text recoloring*/ @@ -702,7 +779,7 @@ /*================== * WIDGETS *================*/ -/* Documentation for widgets can be found here: https://docs.lvgl.io/master/details/widgets/index.html . */ +/* Documentation for widgets can be found here: https://docs.lvgl.io/master/widgets/index.html . */ /** 1: Causes these widgets to be given default values at creation time. * - lv_buttonmatrix_t: Get default maps: {"Btn1", "Btn2", "Btn3", "\n", "Btn4", "Btn5", ""}, else map not set. @@ -747,9 +824,9 @@ #define LV_USE_CHECKBOX 1 -#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ +#define LV_USE_DROPDOWN 1 /**< Requires: lv_label */ -#define LV_USE_IMAGE 1 /*Requires: lv_label*/ +#define LV_USE_IMAGE 1 /**< Requires: lv_label */ #define LV_USE_IMAGEBUTTON 1 @@ -757,9 +834,9 @@ #define LV_USE_LABEL 1 #if LV_USE_LABEL - #define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ - #define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ - #define LV_LABEL_WAIT_CHAR_COUNT 3 /*The count of wait chart*/ + #define LV_LABEL_TEXT_SELECTION 1 /**< Enable selecting text of the label */ + #define LV_LABEL_LONG_TXT_HINT 1 /**< Store some extra info in labels to speed up drawing of very long text */ + #define LV_LABEL_WAIT_CHAR_COUNT 3 /**< The count of wait chart */ #endif #define LV_USE_LED 0 @@ -768,21 +845,21 @@ #define LV_USE_LIST 1 -#define LV_USE_LOTTIE 0 /*Requires: lv_canvas, thorvg */ +#define LV_USE_LOTTIE 0 /**< Requires: lv_canvas, thorvg */ #define LV_USE_MENU 0 #define LV_USE_MSGBOX 0 -#define LV_USE_ROLLER 0 /*Requires: lv_label*/ +#define LV_USE_ROLLER 0 /**< Requires: lv_label */ #define LV_USE_SCALE 0 -#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ +#define LV_USE_SLIDER 1 /**< Requires: lv_bar */ #define LV_USE_SPAN 0 #if LV_USE_SPAN - /*A line text can contain maximum num of span descriptor */ + /** A line of text can contain this maximum number of span descriptors. */ #define LV_SPAN_SNIPPET_STACK_SIZE 64 #endif @@ -810,101 +887,107 @@ /*================== * THEMES *==================*/ +/* Documentation for themes can be found here: https://docs.lvgl.io/master/common-widget-features/styles/styles.html#themes . */ -/*A simple, impressive and very complete theme*/ +/** A simple, impressive and very complete theme */ #define LV_USE_THEME_DEFAULT 1 #if LV_USE_THEME_DEFAULT - - /*0: Light mode; 1: Dark mode*/ + /** 0: Light mode; 1: Dark mode */ #define LV_THEME_DEFAULT_DARK 1 - /*1: Enable grow on press*/ + /** 1: Enable grow on press */ #define LV_THEME_DEFAULT_GROW 1 - /*Default transition time in [ms]*/ + /** Default transition time in ms. */ #define LV_THEME_DEFAULT_TRANSITION_TIME 80 #endif /*LV_USE_THEME_DEFAULT*/ -/*A very simple theme that is a good starting point for a custom theme*/ +/** A very simple theme that is a good starting point for a custom theme */ #define LV_USE_THEME_SIMPLE 1 -/*A theme designed for monochrome displays*/ +/** A theme designed for monochrome displays */ #define LV_USE_THEME_MONO 1 /*================== * LAYOUTS *==================*/ +/* Documentation for layouts can be found here: https://docs.lvgl.io/master/common-widget-features/layouts/index.html . */ -/*A layout similar to Flexbox in CSS.*/ +/** A layout similar to Flexbox in CSS. */ #define LV_USE_FLEX 1 -/*A layout similar to Grid in CSS.*/ +/** A layout similar to Grid in CSS. */ #define LV_USE_GRID 1 /*==================== * 3RD PARTS LIBRARIES *====================*/ +/* Documentation for libraries can be found here: https://docs.lvgl.io/master/libs/index.html . */ -/*File system interfaces for common APIs */ +/* File system interfaces for common APIs */ -/*Setting a default driver letter allows skipping the driver prefix in filepaths*/ +/** Setting a default driver letter allows skipping the driver prefix in filepaths. + * Documentation about how to use the below driver-identifier letters can be found at + * https://docs.lvgl.io/master/main-modules/fs.html#lv-fs-identifier-letters . */ #define LV_FS_DEFAULT_DRIVER_LETTER '\0' -/*API for fopen, fread, etc*/ +/** API for fopen, fread, etc. */ #define LV_USE_FS_STDIO 0 #if LV_USE_FS_STDIO - #define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #define LV_FS_STDIO_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #define LV_FS_STDIO_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #define LV_FS_STDIO_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ #endif -/*API for open, read, etc*/ +/** API for open, read, etc. */ #define LV_USE_FS_POSIX 0 #if LV_USE_FS_POSIX - #define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #define LV_FS_POSIX_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #define LV_FS_POSIX_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #define LV_FS_POSIX_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ #endif -/*API for CreateFile, ReadFile, etc*/ +/** API for CreateFile, ReadFile, etc. */ #define LV_USE_FS_WIN32 0 #if LV_USE_FS_WIN32 - #define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/ - #define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #define LV_FS_WIN32_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #define LV_FS_WIN32_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #define LV_FS_WIN32_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ #endif -/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/ +/** API for FATFS (needs to be added separately). Uses f_open, f_read, etc. */ #define LV_USE_FS_FATFS 0 #if LV_USE_FS_FATFS - #define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ - #define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/ + #define LV_FS_FATFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #define LV_FS_FATFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ + #define LV_FS_FATFS_CACHE_SIZE 0 /**< >0 to cache this number of bytes in lv_fs_read() */ #endif -/*API for memory-mapped file access. */ +/** API for memory-mapped file access. */ #define LV_USE_FS_MEMFS 0 #if LV_USE_FS_MEMFS - #define LV_FS_MEMFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_MEMFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ #endif -/*API for LittleFs. */ +/** API for LittleFs. */ #define LV_USE_FS_LITTLEFS 0 #if LV_USE_FS_LITTLEFS - #define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_LITTLEFS_LETTER '\0' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #define LV_FS_LITTLEFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ #endif -/*API for Arduino LittleFs. */ +/** API for Arduino LittleFs. */ #define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0 #if LV_USE_FS_ARDUINO_ESP_LITTLEFS - #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER 'F' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER 'F' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #define LV_FS_ARDUINO_ESP_LITTLEFS_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ #endif -/*API for Arduino Sd. */ -#ifndef LV_USE_FS_ARDUINO_SD +/** API for Arduino Sd. */ #define LV_USE_FS_ARDUINO_SD 0 -#endif #if LV_USE_FS_ARDUINO_SD - #define LV_FS_ARDUINO_SD_LETTER 'S' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/ + #define LV_FS_ARDUINO_SD_LETTER 'S' /**< Set an upper-case driver-identifier letter for this driver (e.g. 'A'). */ + #define LV_FS_ARDUINO_SD_PATH "" /**< Set the working directory. File/directory paths will be appended to it. */ #endif /** API for UEFI */ @@ -919,56 +1002,59 @@ #endif /** LODEPNG decoder library */ -#define LV_USE_LODEPNG 0 +#define LV_USE_LODEPNG 1 -/*PNG decoder(libpng) library*/ +/** PNG decoder(libpng) library */ #define LV_USE_LIBPNG 0 -/*BMP decoder library*/ +/** BMP decoder library */ #define LV_USE_BMP 0 -/* JPG + split JPG decoder library. - * Split JPG is a custom format optimized for embedded systems. */ +/** JPG + split JPG decoder library. + * Split JPG is a custom format optimized for embedded systems. */ #define LV_USE_TJPGD 1 -/* libjpeg-turbo decoder library. - * Supports complete JPEG specifications and high-performance JPEG decoding. */ +/** libjpeg-turbo decoder library. + * - Supports complete JPEG specifications and high-performance JPEG decoding. */ #define LV_USE_LIBJPEG_TURBO 0 -/*GIF decoder library*/ +/** WebP decoder library */ +#define LV_USE_LIBWEBP 0 + +/** GIF decoder library */ #define LV_USE_GIF 0 #if LV_USE_GIF - /*GIF decoder accelerate*/ + /** GIF decoder accelerate */ #define LV_GIF_CACHE_DECODE_DATA 0 #endif /** GStreamer library */ #define LV_USE_GSTREAMER 0 -/*Decode bin images to RAM*/ +/** Decode bin images to RAM */ #define LV_BIN_DECODER_RAM_LOAD 0 -/*RLE decompress library*/ +/** RLE decompress library */ #define LV_USE_RLE 0 -/*QR code library*/ +/** QR code library */ #define LV_USE_QRCODE 1 -/*Barcode code library*/ +/** Barcode code library */ #define LV_USE_BARCODE 0 -/*FreeType library*/ +/** FreeType library */ #define LV_USE_FREETYPE 0 #if LV_USE_FREETYPE - /*Let FreeType to use LVGL memory and file porting*/ + /** Let FreeType use LVGL memory and file porting */ #define LV_FREETYPE_USE_LVGL_PORT 0 - /*Cache count of the glyphs in FreeType. It means the number of glyphs that can be cached. - *The higher the value, the more memory will be used.*/ + /** Cache count of glyphs in FreeType, i.e. number of glyphs that can be cached. + * The higher the value, the more memory will be used. */ #define LV_FREETYPE_CACHE_FT_GLYPH_CNT 256 #endif -/* Built-in TTF decoder */ +/** Built-in TTF decoder */ #define LV_USE_TINY_TTF 0 #if LV_USE_TINY_TTF /* Enable loading TTF data from files */ @@ -977,26 +1063,33 @@ #define LV_TINY_TTF_CACHE_KERNING_CNT 256 #endif -/*Rlottie library*/ +/** Rlottie library */ #define LV_USE_RLOTTIE 0 /** Requires `LV_USE_3DTEXTURE = 1` */ #define LV_USE_GLTF 0 /** Enable Vector Graphic APIs - * Requires `LV_USE_MATRIX = 1` */ + * Requires `LV_USE_MATRIX = 1` + * and a rendering engine supporting vector graphics, e.g. + * (LV_USE_DRAW_SW and LV_USE_THORVG) or LV_USE_DRAW_VG_LITE or LV_USE_NEMA_VG. */ #define LV_USE_VECTOR_GRAPHIC 0 -/* Enable ThorVG (vector graphics library) from the src/libs folder */ +/** Enable ThorVG (vector graphics library) from the src/libs folder. + * Requires LV_USE_VECTOR_GRAPHIC */ #define LV_USE_THORVG_INTERNAL 0 -/* Enable ThorVG by assuming that its installed and linked to the project */ +/** Enable ThorVG by assuming that its installed and linked to the project + * Requires LV_USE_VECTOR_GRAPHIC */ #define LV_USE_THORVG_EXTERNAL 0 -/*Use lvgl built-in LZ4 lib*/ +/** Enable NanoVG (vector graphics library) */ +#define LV_USE_NANOVG 0 + +/** Use lvgl built-in LZ4 lib */ #define LV_USE_LZ4_INTERNAL 0 -/*Use external LZ4 library*/ +/** Use external LZ4 library */ #define LV_USE_LZ4_EXTERNAL 0 /*SVG library @@ -1009,7 +1102,7 @@ * Supports all major image formats so do not enable other image decoder with it. */ #define LV_USE_FFMPEG 0 #if LV_USE_FFMPEG - /*Dump input information to stderr*/ + /** Dump input information to stderr */ #define LV_FFMPEG_DUMP_FORMAT 0 /** Use lvgl file path in FFmpeg Player widget * You won't be able to open URLs after enabling this feature. @@ -1020,18 +1113,18 @@ /*================== * OTHERS *==================*/ -/* Documentation for several of the below items can be found here: https://docs.lvgl.io/master/details/auxiliary-modules/index.html . */ +/* Documentation for several of the below items can be found here: https://docs.lvgl.io/master/auxiliary-modules/index.html . */ -/*1: Enable API to take snapshot for object*/ +/** 1: Enable API to take snapshot for object */ #define LV_USE_SNAPSHOT 0 -/*1: Enable system monitor component*/ +/** 1: Enable system monitor component */ #ifndef LV_USE_SYSMON #define LV_USE_SYSMON 0 #endif #if LV_USE_SYSMON - /*Get the idle percentage. E.g. uint32_t my_get_idle(void);*/ + /** Get the idle percentage. E.g. uint32_t my_get_idle(void); */ #define LV_SYSMON_GET_IDLE lv_timer_get_idle /** 1: Enable usage of lv_os_get_proc_idle_percent.*/ #define LV_SYSMON_PROC_IDLE_AVAILABLE 0 @@ -1041,40 +1134,39 @@ #define LV_SYSMON_GET_PROC_IDLE lv_os_get_proc_idle_percent #endif - /*1: Show CPU usage and FPS count - * Requires `LV_USE_SYSMON = 1`*/ + /** 1: Show CPU usage and FPS count. + * - Requires `LV_USE_SYSMON = 1` */ #ifndef LV_USE_PERF_MONITOR #define LV_USE_PERF_MONITOR 0 #endif #if LV_USE_PERF_MONITOR #define LV_USE_PERF_MONITOR_POS LV_ALIGN_BOTTOM_RIGHT - /*0: Displays performance data on the screen, 1: Prints performance data using log.*/ + /** 0: Displays performance data on the screen; 1: Prints performance data using log. */ #define LV_USE_PERF_MONITOR_LOG_MODE 0 #endif - /*1: Show the used memory and the memory fragmentation - * Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` - * Requires `LV_USE_SYSMON = 1`*/ + /** 1: Show used memory and memory fragmentation. + * - Requires `LV_USE_STDLIB_MALLOC = LV_STDLIB_BUILTIN` + * - Requires `LV_USE_SYSMON = 1`*/ #ifndef LV_USE_MEM_MONITOR #define LV_USE_MEM_MONITOR 0 #endif #if LV_USE_MEM_MONITOR #define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT #endif - #endif /*LV_USE_SYSMON*/ -/*1: Enable the runtime performance profiler*/ +/** 1: Enable the runtime performance profiler */ #ifndef LV_USE_PROFILER #define LV_USE_PROFILER 0 #endif #if LV_USE_PROFILER - /*1: Enable the built-in profiler*/ + /** 1: Enable the built-in profiler */ #define LV_USE_PROFILER_BUILTIN 1 #if LV_USE_PROFILER_BUILTIN - /*Default profiler trace buffer size*/ - #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /*[bytes]*/ + /** Default profiler trace buffer size */ + #define LV_PROFILER_BUILTIN_BUF_SIZE (16 * 1024) /**< [bytes] */ #define LV_PROFILER_BUILTIN_DEFAULT_ENABLE 1 #define LV_USE_PROFILER_BUILTIN_POSIX 0 /**< Enable POSIX profiler port */ #endif @@ -1082,16 +1174,16 @@ /*Header to include for the profiler*/ #define LV_PROFILER_INCLUDE "src/misc/lv_profiler_builtin.h" - /*Profiler start point function*/ + /** Profiler start point function */ #define LV_PROFILER_BEGIN LV_PROFILER_BUILTIN_BEGIN - /*Profiler end point function*/ + /** Profiler end point function */ #define LV_PROFILER_END LV_PROFILER_BUILTIN_END - /*Profiler start point function with custom tag*/ + /** Profiler start point function with custom tag */ #define LV_PROFILER_BEGIN_TAG LV_PROFILER_BUILTIN_BEGIN_TAG - /*Profiler end point function with custom tag*/ + /** Profiler end point function with custom tag */ #define LV_PROFILER_END_TAG LV_PROFILER_BUILTIN_END_TAG /*Enable layout profiler*/ @@ -1128,47 +1220,47 @@ #define LV_PROFILER_EVENT 1 #endif -/*1: Enable Monkey test*/ +/** 1: Enable Monkey test */ #define LV_USE_MONKEY 0 -/*1: Enable grid navigation*/ +/** 1: Enable grid navigation */ #define LV_USE_GRIDNAV 1 -/*1: Enable lv_obj fragment*/ +/** 1: Enable `lv_obj` fragment logic */ #define LV_USE_FRAGMENT 0 -/*1: Support using images as font in label or span widgets */ +/** 1: Support using images as font in label or span widgets */ #define LV_USE_IMGFONT 0 -/*1: Enable an observer pattern implementation*/ +/** 1: Enable an observer pattern implementation */ #define LV_USE_OBSERVER 1 -/*1: Enable Pinyin input method*/ -/*Requires: lv_keyboard*/ +/** 1: Enable Pinyin input method + * - Requires: lv_keyboard */ #define LV_USE_IME_PINYIN 0 #if LV_USE_IME_PINYIN - /*1: Use default thesaurus*/ - /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus*/ + /** 1: Use default thesaurus. + * @note If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus. */ #define LV_IME_PINYIN_USE_DEFAULT_DICT 1 - /*Set the maximum number of candidate panels that can be displayed*/ - /*This needs to be adjusted according to the size of the screen*/ + /** Set maximum number of candidate panels that can be displayed. + * @note This needs to be adjusted according to size of screen. */ #define LV_IME_PINYIN_CAND_TEXT_NUM 6 - /*Use 9 key input(k9)*/ + /** Use 9-key input (k9). */ #define LV_IME_PINYIN_USE_K9_MODE 1 #if LV_IME_PINYIN_USE_K9_MODE == 1 #define LV_IME_PINYIN_K9_CAND_TEXT_NUM 3 #endif /*LV_IME_PINYIN_USE_K9_MODE*/ #endif -/*1: Enable file explorer*/ -/*Requires: lv_table*/ +/** 1: Enable file explorer. + * - Requires: lv_table */ #define LV_USE_FILE_EXPLORER 0 #if LV_USE_FILE_EXPLORER - /*Maximum length of path*/ + /** Maximum length of path */ #define LV_FILE_EXPLORER_PATH_MAX_LEN (128) - /*Quick access bar, 1:use, 0:not use*/ - /*Requires: lv_list*/ + /** Quick access bar, 1:use, 0:do not use. + * - Requires: lv_list */ #define LV_FILE_EXPLORER_QUICK_ACCESS 1 #endif @@ -1188,10 +1280,13 @@ /** Enable `lv_test_screenshot_compare`. * Requires lodepng and a few MB of extra RAM. */ #define LV_USE_TEST_SCREENSHOT_COMPARE 0 -#endif /*LV_USE_TEST*/ -/** Enable loading XML UIs runtime */ -#define LV_USE_XML 0 +#if LV_USE_TEST_SCREENSHOT_COMPARE + /** 1: Automatically create missing reference images*/ + #define LV_TEST_SCREENSHOT_CREATE_REFERENCE_IMAGE 1 +#endif /*LV_USE_TEST_SCREENSHOT_COMPARE*/ + +#endif /*LV_USE_TEST*/ /** 1: Enable text translation support */ #define LV_USE_TRANSLATION 0 @@ -1206,11 +1301,11 @@ /*Use SDL to open window on PC and handle mouse and keyboard*/ #if LV_USE_SDL #define LV_SDL_INCLUDE_PATH - #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/ - #define LV_SDL_BUF_COUNT 1 /*1 or 2*/ - #define LV_SDL_ACCELERATED 1 /*1: Use hardware acceleration*/ - #define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/ - #define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL windows are closed*/ + #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /**< LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance */ + #define LV_SDL_BUF_COUNT 1 /**< 1 or 2 */ + #define LV_SDL_ACCELERATED 1 /**< 1: Use hardware acceleration*/ + #define LV_SDL_FULLSCREEN 0 /**< 1: Make the window full screen by default */ + #define LV_SDL_DIRECT_EXIT 1 /**< 1: Exit the application when all SDL windows are closed */ #define LV_SDL_MOUSEWHEEL_MODE LV_SDL_MOUSEWHEEL_MODE_ENCODER /*LV_SDL_MOUSEWHEEL_MODE_ENCODER/CROWN*/ #endif @@ -1221,25 +1316,21 @@ #define LV_USE_X11 USE_X11 #endif #if LV_USE_X11 - #define LV_X11_DIRECT_EXIT 1 /*Exit the application when all X11 windows have been closed*/ - #define LV_X11_DOUBLE_BUFFER 1 /*Use double buffers for endering*/ - /*select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!)*/ - #define LV_X11_RENDER_MODE_PARTIAL 1 /*Partial render mode (preferred)*/ - #define LV_X11_RENDER_MODE_DIRECT 0 /*direct render mode*/ - #define LV_X11_RENDER_MODE_FULL 0 /*Full render mode*/ + #define LV_X11_DIRECT_EXIT 1 /**< Exit application when all X11 windows have been closed */ + #define LV_X11_DOUBLE_BUFFER 1 /**< Use double buffers for rendering */ + /* Select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!). */ + #define LV_X11_RENDER_MODE_PARTIAL 1 /**< Partial render mode (preferred) */ + #define LV_X11_RENDER_MODE_DIRECT 0 /**< Direct render mode */ + #define LV_X11_RENDER_MODE_FULL 0 /**< Full render mode */ #endif -/*Use Wayland to open a window and handle input on Linux or BSD desktops */ +/** Use Wayland to open a window and handle input on Linux or BSD desktops */ #define LV_USE_WAYLAND 0 #if LV_USE_WAYLAND - #define LV_WAYLAND_BUF_COUNT 1 /**< Use 1 for single buffer with partial render mode or 2 for double buffer with full render mode*/ - #define LV_WAYLAND_USE_DMABUF 0 /**< Use DMA buffers for frame buffers. Requires LV_DRAW_USE_G2D */ - #define LV_WAYLAND_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL /**< DMABUF supports LV_DISPLAY_RENDER_MODE_FULL and LV_DISPLAY_RENDER_MODE_DIRECT*/ - /**< When LV_WAYLAND_USE_DMABUF is disabled, only LV_DISPLAY_RENDER_MODE_PARTIAL is supported*/ - #define LV_WAYLAND_WINDOW_DECORATIONS 0 /**< Draw client side window decorations only necessary on Mutter/GNOME. Not supported using DMABUF*/ + #define LV_WAYLAND_DIRECT_EXIT 1 /**< 1: Exit the application when all Wayland windows are closed */ #endif -/*Driver for /dev/fb*/ +/** Driver for /dev/fb */ #define LV_USE_LINUX_FBDEV USE_FRAMEBUFFER #if LV_USE_LINUX_FBDEV #define LV_LINUX_FBDEV_BSD 0 @@ -1249,7 +1340,7 @@ #define LV_LINUX_FBDEV_MMAP 1 #endif -/*Use Nuttx to open window and handle touchscreen*/ +/** Use Nuttx to open window and handle touchscreen */ #define LV_USE_NUTTX 0 #if LV_USE_NUTTX @@ -1260,17 +1351,17 @@ #define LV_USE_NUTTX_LIBUV 0 - /*Use Nuttx custom init API to open window and handle touchscreen*/ + /** Use Nuttx custom init API to open window and handle touchscreen */ #define LV_USE_NUTTX_CUSTOM_INIT 0 - /*Driver for /dev/lcd*/ + /** Driver for /dev/lcd */ #define LV_USE_NUTTX_LCD 0 #if LV_USE_NUTTX_LCD #define LV_NUTTX_LCD_BUFFER_COUNT 0 #define LV_NUTTX_LCD_BUFFER_SIZE 60 #endif - /*Driver for /dev/input*/ + /** Driver for /dev/input */ #define LV_USE_NUTTX_TOUCHSCREEN 0 /** Touchscreen cursor size in pixels(<=0: disable cursor) */ @@ -1300,8 +1391,6 @@ * The GBM library aims to provide a platform independent memory management system * it supports the major GPU vendors - This option requires linking with libgbm */ #define LV_USE_LINUX_DRM_GBM_BUFFERS 0 - - #define LV_LINUX_DRM_USE_EGL 0 #endif /** Interface for TFT_eSPI */ @@ -1318,7 +1407,7 @@ /** Driver for evdev input devices */ #define LV_USE_EVDEV 0 -/*Driver for libinput input devices*/ +/** Driver for libinput input devices */ #ifndef LV_USE_LIBINPUT #define LV_USE_LIBINPUT 0 #endif @@ -1326,15 +1415,15 @@ #if LV_USE_LIBINPUT #define LV_LIBINPUT_BSD 0 - /*Full keyboard support*/ - #define LV_LIBINPUT_XKB 1 + /** Full keyboard support */ + #define LV_LIBINPUT_XKB 0 #if LV_LIBINPUT_XKB - /*"setxkbmap -query" can help find the right values for your keyboard*/ + /** "setxkbmap -query" can help find the right values for your keyboard */ #define LV_LIBINPUT_XKB_KEY_MAP { .rules = "evdev", .model = "pc105", .layout = "us", .variant = NULL, .options = NULL } #endif #endif -/*Drivers for LCD devices connected via SPI/parallel port*/ +/* Drivers for LCD devices connected via SPI/parallel port */ #define LV_USE_ST7735 0 #define LV_USE_ST7789 0 #define LV_USE_ST7796 0 @@ -1348,7 +1437,7 @@ #define LV_USE_GENERIC_MIPI 0 #endif -/*Driver for Renesas GLCD*/ +/** Driver for Renesas GLCD */ #define LV_USE_RENESAS_GLCDC 0 /** Driver for ST LTDC */ @@ -1371,10 +1460,12 @@ #define LV_UEFI_USE_MEMORY_SERVICES 0 /**< Use the memory functions from the boot services table */ #endif -/** Use a generic OpenGL driver that can be used to embed in other applications or used with GLFW/EGL */ +/** Use a generic OpenGL driver that can be used to embed in other applications or used with GLFW/EGL + * - Requires LV_USE_MATRIX. + */ #define LV_USE_OPENGLES 0 #if LV_USE_OPENGLES - #define LV_USE_OPENGLES_DEBUG 1 /* Enable or disable debug for opengles */ + #define LV_USE_OPENGLES_DEBUG 1 /**< Enable or disable debug for opengles */ #endif /** Use GLFW to open window on PC and handle mouse and keyboard. Requires*/ @@ -1384,9 +1475,12 @@ /** QNX Screen display and input drivers */ #define LV_USE_QNX 0 #if LV_USE_QNX - #define LV_QNX_BUF_COUNT 1 /*1 or 2*/ + #define LV_QNX_BUF_COUNT 1 /**< 1 or 2 */ #endif +/** Enable or disable for external data and destructor function */ +#define LV_USE_EXT_DATA 0 + /*===================== * BUILD OPTIONS *======================*/ @@ -1449,12 +1543,6 @@ /** Smart-phone like multi-language demo */ #define LV_USE_DEMO_MULTILANG 0 - /** Widget transformation demo */ - #define LV_USE_DEMO_TRANSFORM 0 - - /** Demonstrate scroll settings */ - #define LV_USE_DEMO_SCROLL 0 - /*E-bike demo with Lottie animations (if LV_USE_LOTTIE is enabled)*/ #define LV_USE_DEMO_EBIKE 0 #if LV_USE_DEMO_EBIKE From b5876d4ec9543c3e978736f94b8ed2f79f07c817 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Fri, 17 Jul 2026 00:43:11 +0200 Subject: [PATCH 3/8] LGFX_SKIP_RGB565_SWAP --- include/graphics/driver/LGFXDriver.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/graphics/driver/LGFXDriver.h b/include/graphics/driver/LGFXDriver.h index fb56e6ca..f0eee2ca 100644 --- a/include/graphics/driver/LGFXDriver.h +++ b/include/graphics/driver/LGFXDriver.h @@ -178,7 +178,9 @@ template void LGFXDriver::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); } From a7877e23df3f534a8e0d9ec231b00ff1aa92a8aa Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Sun, 19 Jul 2026 21:22:56 +0200 Subject: [PATCH 4/8] cleanup SDL task_handler --- source/graphics/driver/SDLDriver.cpp | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/source/graphics/driver/SDLDriver.cpp b/source/graphics/driver/SDLDriver.cpp index 20475d47..45af0920 100644 --- a/source/graphics/driver/SDLDriver.cpp +++ b/source/graphics/driver/SDLDriver.cpp @@ -26,41 +26,28 @@ void SDLDriver::init(DeviceGUI *gui) DisplayDriver::init(gui); display = lv_sdl_window_create(screenWidth, screenHeight); - lv_display_set_color_format(display, LV_COLOR_FORMAT_RGB565); char title[25]; sprintf(title, "Meshtastic (%dx%d)", screenWidth, screenHeight); lv_sdl_window_set_title(display, title); - lv_indev_t *mouse = lv_sdl_mouse_create(); - lv_indev_t *mouseWheel = lv_sdl_mousewheel_create(); - lv_indev_t *keyboard = lv_sdl_keyboard_create(); + lv_sdl_mouse_create(); + lv_sdl_mousewheel_create(); + lv_sdl_keyboard_create(); } void SDLDriver::task_handler(void) { -#if 0 - static Uint32 lastTick = SDL_GetTicks(); - SDL_Delay(5); - Uint32 current = SDL_GetTicks(); - lv_tick_inc(current - lastTick); // Update the tick timer. Tick is new for LVGL 9 - lastTick = current; - lv_timer_handler(); // Update the UI -#elif 0 const int ms = 10; auto start = std::chrono::high_resolution_clock::now(); DisplayDriver::task_handler(); - // lv_timer_handler(); auto stop = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(stop - start); if (duration.count() < ms) { - SDL_Delay(ms - duration.count()); + std::this_thread::sleep_for(std::chrono::milliseconds(ms - duration.count())); lv_tick_inc(ms); } else { std::this_thread::sleep_for(std::chrono::milliseconds(1)); lv_tick_inc(duration.count() + 1); } -#else - usleep(lv_timer_handler() * 1000); -#endif } #endif \ No newline at end of file From 1d50c8c41ee681d4dc4c77937a3d6f7cb245d257 Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Sun, 19 Jul 2026 21:23:28 +0200 Subject: [PATCH 5/8] please code rabbit --- include/lv_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lv_conf.h b/include/lv_conf.h index d726c900..c54ef1c5 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -325,7 +325,7 @@ #define LV_USE_DRAW_DAVE2D 0 /* Draw using cached SDL textures*/ -#ifndef USE_SDL +#if !defined(USE_SDL) || USE_SDL == 0 #define LV_USE_SDL 0 #else #define LV_USE_SDL USE_SDL From bbd6259027f363587826340b927d65ba532f4d0d Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Mon, 20 Jul 2026 10:28:40 +0200 Subject: [PATCH 6/8] resizable --- source/graphics/driver/SDLDriver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/graphics/driver/SDLDriver.cpp b/source/graphics/driver/SDLDriver.cpp index 45af0920..b16980c2 100644 --- a/source/graphics/driver/SDLDriver.cpp +++ b/source/graphics/driver/SDLDriver.cpp @@ -29,6 +29,7 @@ void SDLDriver::init(DeviceGUI *gui) char title[25]; sprintf(title, "Meshtastic (%dx%d)", screenWidth, screenHeight); lv_sdl_window_set_title(display, title); + lv_sdl_window_set_resizeable(display, true); lv_sdl_mouse_create(); lv_sdl_mousewheel_create(); lv_sdl_keyboard_create(); From 9858656041daba3313adf817687c61edfc2b02fb Mon Sep 17 00:00:00 2001 From: Manuel <71137295+mverch67@users.noreply.github.com> Date: Mon, 20 Jul 2026 13:47:35 +0200 Subject: [PATCH 7/8] add USE_SDL definitions --- .../graphics/driver/DisplayDriverFactory.cpp | 19 +++++++++++++------ source/graphics/driver/SDLDriver.cpp | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/source/graphics/driver/DisplayDriverFactory.cpp b/source/graphics/driver/DisplayDriverFactory.cpp index 626b4d92..ab17a9ee 100644 --- a/source/graphics/driver/DisplayDriverFactory.cpp +++ b/source/graphics/driver/DisplayDriverFactory.cpp @@ -13,10 +13,10 @@ #if defined(USE_FRAMEBUFFER) #include "graphics/driver/FBDriver.h" #endif -#if defined(USE_X11) +#if defined(USE_X11) && USE_X11 #include "graphics/driver/X11Driver.h" #endif -#if defined(USE_SDL) +#if defined(USE_SDL) && USE_SDL #include "graphics/driver/SDLDriver.h" #endif @@ -93,8 +93,10 @@ DisplayDriver *DisplayDriverFactory::create(uint16_t width, uint16_t height) #if defined(USE_FRAMEBUFFER) return &FBDriver::create(width, height); #endif -#if defined(USE_X11) +#if defined(USE_X11) && USE_X11 return &X11Driver::create(width, height); +#elif defined(USE_SDL) && USE_SDL + return &SDLDriver::create(width, height); #elif defined(LGFX_DRIVER) return new LGFXDriver(width, height); #endif @@ -126,10 +128,15 @@ DisplayDriver *DisplayDriverFactory::create(const DisplayDriverConfig &cfg) return &FBDriver::create(cfg.width(), cfg.height()); } #endif -#if defined(USE_X11) +#if defined(USE_X11) && USE_X11 if (cfg._device == DisplayDriverConfig::device_t::X11) { return &X11Driver::create(cfg.width(), cfg.height()); } +#endif +#if defined(USE_SDL) && USE_SDL + if (cfg._device == DisplayDriverConfig::device_t::SDL) { + return &SDLDriver::create(cfg.width(), cfg.height()); + } #endif switch (cfg._device) { #ifndef ARCH_PORTDUINO @@ -215,12 +222,12 @@ DisplayDriver *DisplayDriverFactory::create(const DisplayDriverConfig &cfg) return &FBDriver::create(cfg.width(), cfg.height()); break; #endif -#if defined(USE_X11) +#if defined(USE_X11) && USE_X11 case DisplayDriverConfig::device_t::X11: return &X11Driver::create(cfg.width(), cfg.height()); break; #endif -#if defined(USE_SDL) +#if defined(USE_SDL) && USE_SDL case DisplayDriverConfig::device_t::SDL: return &SDLDriver::create(cfg.width(), cfg.height()); break; diff --git a/source/graphics/driver/SDLDriver.cpp b/source/graphics/driver/SDLDriver.cpp index b16980c2..f292d4c0 100644 --- a/source/graphics/driver/SDLDriver.cpp +++ b/source/graphics/driver/SDLDriver.cpp @@ -1,4 +1,4 @@ -#ifdef USE_SDL +#if defined(USE_SDL) && USE_SDL #include "graphics/driver/SDLDriver.h" #include "util/ILog.h" #include From 106b3273e68e97f804233d8bfe7f0b56f0c7199c Mon Sep 17 00:00:00 2001 From: Manuel Verch Date: Tue, 21 Jul 2026 00:46:13 +0200 Subject: [PATCH 8/8] fix issues for win64 build --- source/graphics/TFT/TFTView_320x240.cpp | 172 ++++++++++++++---------- 1 file changed, 102 insertions(+), 70 deletions(-) diff --git a/source/graphics/TFT/TFTView_320x240.cpp b/source/graphics/TFT/TFTView_320x240.cpp index 08bab369..1a74d89a 100644 --- a/source/graphics/TFT/TFTView_320x240.cpp +++ b/source/graphics/TFT/TFTView_320x240.cpp @@ -21,8 +21,11 @@ #include "util/FileLoader.h" #include "util/ILog.h" #include +#include +#include #include #include +#include #include #include #include @@ -31,6 +34,35 @@ #include #include +#if defined(_WIN32) +static const char *strcasestr(const char *haystack, const char *needle) +{ + if (!haystack || !needle) + return nullptr; + + const size_t needleLen = std::strlen(needle); + if (needleLen == 0) + return haystack; + + for (const char *p = haystack; *p; ++p) { + size_t i = 0; + while (i < needleLen && p[i] && std::tolower(static_cast(p[i])) == + std::tolower(static_cast(needle[i]))) { + ++i; + } + if (i == needleLen) + return p; + } + + return nullptr; +} + +static tm *localtime_r(const time_t *source, tm *result) +{ + return (source && result && localtime_s(result, source) == 0) ? result : nullptr; +} +#endif + #if defined(ARCH_PORTDUINO) #include "PortduinoFS.h" fs::FS &fileSystem = PortduinoFS; @@ -473,7 +505,7 @@ void TFTView_320x240::ui_set_active(lv_obj_t *b, lv_obj_t *p, lv_obj_t *tp) if (!lv_obj_has_flag(objects.keyboard, LV_OBJ_FLAG_HIDDEN)) { hideKeyboard(objects.messages_panel); } - uint32_t channelOrNode = (unsigned long)activeMsgContainer->user_data; + uint32_t channelOrNode = (uintptr_t)activeMsgContainer->user_data; // remove empty messageContainer if we are leaving messages panel if (channelOrNode >= c_max_channels) { if (activeMsgContainer->spec_attr->child_cnt == 0) { @@ -1026,7 +1058,7 @@ void TFTView_320x240::ui_event_NodeButton(lv_event_t *e) static auto deleted_cb = [](_lv_anim_t *) { animRunning = false; }; lv_event_code_t event_code = lv_event_get_code(e); if (event_code == LV_EVENT_CLICKED && !animRunning) { - uint32_t nodeNum = (unsigned long)e->user_data; + uint32_t nodeNum = (uintptr_t)e->user_data; if (!nodeNum) // event-handler for own node has value 0 in user_data nodeNum = THIS->ownNode; lv_obj_t *panel = THIS->nodes[nodeNum]; @@ -1076,8 +1108,8 @@ void TFTView_320x240::ui_event_NodeButton(lv_event_t *e) } } else if (event_code == LV_EVENT_LONG_PRESSED) { // set color and text of clicked node - uint32_t nodeNum = (unsigned long)e->user_data; - bool isMessagable = !((unsigned long)(THIS->nodes[nodeNum]->LV_OBJ_IDX(node_img_idx)->user_data) == eRole::unmessagable); + uint32_t nodeNum = (uintptr_t)e->user_data; + bool isMessagable = !((uintptr_t)(THIS->nodes[nodeNum]->LV_OBJ_IDX(node_img_idx)->user_data) == eRole::unmessagable); if (nodeNum != THIS->ownNode && isMessagable) THIS->showMessages(nodeNum); } @@ -1100,7 +1132,7 @@ void TFTView_320x240::ui_event_ChannelButton(lv_event_t *e) ignoreClicked = false; return; } - uint8_t ch = (uint8_t)(unsigned long)e->user_data; + uint8_t ch = (uint8_t)(uintptr_t)e->user_data; if (THIS->db.channel[ch].role != meshtastic_Channel_Role_DISABLED) { if (THIS->messagesRestored) { THIS->showMessages(ch); @@ -1111,7 +1143,7 @@ void TFTView_320x240::ui_event_ChannelButton(lv_event_t *e) } } else if (event_code == LV_EVENT_LONG_PRESSED) { // toggle mute channel - uint8_t ch = (uint8_t)(unsigned long)e->user_data; + uint8_t ch = (uint8_t)(uintptr_t)e->user_data; bool mute = THIS->db.channel[ch].settings.module_settings.is_muted; THIS->db.channel[ch].settings.module_settings.is_muted = !mute; THIS->updateChannelConfig(THIS->db.channel[ch]); @@ -1218,7 +1250,7 @@ void TFTView_320x240::ui_event_ChatButton(lv_event_t *e) } lv_obj_set_style_border_color(target, colorMidGray, LV_PART_MAIN); - uint32_t channelOrNode = (unsigned long)e->user_data; + uint32_t channelOrNode = (uintptr_t)e->user_data; if (channelOrNode < c_max_channels) { uint8_t ch = (uint8_t)channelOrNode; THIS->showMessages(ch); @@ -1243,7 +1275,7 @@ void TFTView_320x240::ui_event_ChatDelButton(lv_event_t *e) lv_obj_t *target = lv_event_get_target_obj(e); lv_obj_add_flag(target, LV_OBJ_FLAG_HIDDEN); - uint32_t channelOrNode = (unsigned long)e->user_data; + uint32_t channelOrNode = (uintptr_t)e->user_data; if (channelOrNode < c_max_channels) { THIS->eraseChat(channelOrNode); THIS->controller->removeTextMessages(THIS->ownNode, UINT32_MAX, channelOrNode); @@ -1271,7 +1303,7 @@ void TFTView_320x240::ui_event_MsgPopupButton(lv_event_t *e) if (target == objects.msg_popup_panel) { THIS->hideMessagePopup(); } else { // msg button was clicked - uint32_t channelOrNode = (unsigned long)objects.msg_popup_button->user_data; + uint32_t channelOrNode = (uintptr_t)objects.msg_popup_button->user_data; if (channelOrNode < c_max_channels) { uint8_t ch = (uint8_t)channelOrNode; THIS->showMessages(ch); @@ -1342,7 +1374,7 @@ void TFTView_320x240::ui_event_TimeButton(lv_event_t *e) lv_event_code_t event_code = lv_event_get_code(e); if (event_code == LV_EVENT_CLICKED) { // toggle date/time <-> uptime display - uint32_t toggle = (unsigned long)objects.home_time_button->user_data; + uint32_t toggle = (uintptr_t)objects.home_time_button->user_data; objects.home_time_button->user_data = (void *)(1 - toggle); THIS->updateTime(); } @@ -1431,12 +1463,12 @@ void TFTView_320x240::ui_event_LocationButton(lv_event_t *e) if (event_code == LV_EVENT_PRESSED && THIS->configComplete) { // TODO: figure out if there is a way to enabled GPS without a reboot (ala triple-click) // over phone api and switch between enabled/disabled with short press - // uint32_t toggle = (unsigned long)objects.home_location_button->user_data; + // uint32_t toggle = (uintptr_t)objects.home_location_button->user_data; // objects.home_location_button->user_data = (void *)(1 - toggle); // Themes::recolorButton(objects.home_location_button, toggle); } else if (event_code == LV_EVENT_LONG_PRESSED && THIS->configComplete) { // toggle GPS not_present <-> enabled - uint32_t toggle = (unsigned long)objects.home_location_button->user_data; + uint32_t toggle = (uintptr_t)objects.home_location_button->user_data; objects.home_location_button->user_data = (void *)(1 - toggle); meshtastic_Config_PositionConfig &position = THIS->db.config.position; @@ -1469,7 +1501,7 @@ void TFTView_320x240::ui_event_WLANButton(lv_event_t *e) THIS->activeSettings = eWifi; } else { // toggle WLAN on/off - uint32_t toggle = (unsigned long)objects.home_wlan_button->user_data; + uint32_t toggle = (uintptr_t)objects.home_wlan_button->user_data; objects.home_wlan_button->user_data = (void *)(1 - toggle); meshtastic_Config_NetworkConfig &network = THIS->db.config.network; network.wifi_enabled = !network.wifi_enabled; @@ -1485,7 +1517,7 @@ void TFTView_320x240::ui_event_MQTTButton(lv_event_t *e) lv_event_code_t event_code = lv_event_get_code(e); if (event_code == LV_EVENT_LONG_PRESSED && THIS->configComplete) { // toggle MQTT on/off - uint32_t toggle = (unsigned long)objects.home_mqtt_button->user_data; + uint32_t toggle = (uintptr_t)objects.home_mqtt_button->user_data; objects.home_mqtt_button->user_data = (void *)(1 - toggle); meshtastic_ModuleConfig_MQTTConfig &mqtt = THIS->db.module_config.mqtt; @@ -1519,11 +1551,11 @@ void TFTView_320x240::ui_event_MemoryButton(lv_event_t *e) lv_event_code_t event_code = lv_event_get_code(e); if (event_code == LV_EVENT_CLICKED) { // toggle memory display updates - uint32_t toggle = (unsigned long)objects.home_memory_button->user_data; + uint32_t toggle = (uintptr_t)objects.home_memory_button->user_data; objects.home_memory_button->user_data = (void *)(1 - toggle); Themes::recolorButton(objects.home_memory_button, !toggle); Themes::recolorText(objects.home_memory_label, !toggle); - if ((unsigned long)objects.home_memory_button->user_data) { + if ((uintptr_t)objects.home_memory_button->user_data) { THIS->updateFreeMem(); } } @@ -1569,7 +1601,7 @@ void TFTView_320x240::ui_event_KeyboardButton(lv_event_t *e) { lv_event_code_t event_code = lv_event_get_code(e); if (event_code == LV_EVENT_CLICKED) { - uint32_t keyBtnIdx = (unsigned long)e->user_data; + uint32_t keyBtnIdx = (uintptr_t)e->user_data; switch (keyBtnIdx) { case 0: if (lv_obj_has_flag(objects.keyboard, LV_OBJ_FLAG_HIDDEN)) { @@ -2110,8 +2142,8 @@ void TFTView_320x240::ui_event_modify_channel(lv_event_t *e) ignoreClicked = false; return; } - uint32_t btn_id = (unsigned long)e->user_data; - int8_t ch = (signed long)THIS->ch_label[btn_id]->user_data; + uint32_t btn_id = (uintptr_t)e->user_data; + int8_t ch = (intptr_t)THIS->ch_label[btn_id]->user_data; if (ch != -1) { meshtastic_ChannelSettings_psk_t &psk = THIS->channel_scratch[ch].settings.psk; std::string base64 = THIS->pskToBase64(psk.bytes, psk.size); @@ -2158,10 +2190,10 @@ void TFTView_320x240::ui_event_modify_channel(lv_event_t *e) else if (event_code == LV_EVENT_LONG_PRESSED && THIS->activeSettings == eChannel) { ignoreClicked = true; // make channel primary on long press; swap with current primary (role, id and name) - uint8_t btn_id = (uint8_t)(unsigned long)e->user_data; - int8_t ch = (signed long)THIS->ch_label[btn_id]->user_data; + uint8_t btn_id = (uint8_t)(uintptr_t)e->user_data; + int8_t ch = (intptr_t)THIS->ch_label[btn_id]->user_data; if (btn_id != 0 && ch != -1) { - int32_t primary_id = (signed long)THIS->ch_label[0]->user_data; + int32_t primary_id = (intptr_t)THIS->ch_label[0]->user_data; THIS->channel_scratch[primary_id].role = meshtastic_Channel_Role_SECONDARY; THIS->channel_scratch[ch].role = meshtastic_Channel_Role_PRIMARY; THIS->ch_label[0]->user_data = (void *)(uint32_t)ch; @@ -2373,7 +2405,7 @@ void TFTView_320x240::ui_event_map_url_dropdown(lv_event_t *e) void TFTView_320x240::ui_event_mapNodeButton(lv_event_t *e) { // navigate to node in node list - uint32_t nodeNum = (unsigned long)e->user_data; + uint32_t nodeNum = (uintptr_t)e->user_data; ILOG_DEBUG("map node %08x", nodeNum); lv_obj_t *panel = THIS->nodes[nodeNum]; THIS->ui_set_active(objects.nodes_button, objects.nodes_panel, objects.top_nodes_panel); @@ -2384,7 +2416,7 @@ void TFTView_320x240::ui_event_mapNodeButton(lv_event_t *e) void TFTView_320x240::ui_event_chatNodeButton(lv_event_t *e) { - uint32_t nodeNum = (unsigned long)e->user_data; + uint32_t nodeNum = (uintptr_t)e->user_data; auto it = THIS->nodes.find(nodeNum); if (it != THIS->nodes.end()) { lv_obj_t *panel = it->second; @@ -2399,8 +2431,8 @@ void TFTView_320x240::ui_event_positionButton(lv_event_t *e) { // navigate to position in map lv_obj_t *p = (lv_obj_t *)e->user_data; - int32_t lat = (long)p->LV_OBJ_IDX(node_pos1_idx)->user_data; - int32_t lon = (long)p->LV_OBJ_IDX(node_pos2_idx)->user_data; + int32_t lat = (intptr_t)p->LV_OBJ_IDX(node_pos1_idx)->user_data; + int32_t lon = (intptr_t)p->LV_OBJ_IDX(node_pos2_idx)->user_data; if (lat && lon) { THIS->ui_set_active(objects.map_button, objects.map_panel, objects.top_map_panel); if (!THIS->map) { @@ -2440,7 +2472,7 @@ void TFTView_320x240::ui_event_arrow(lv_event_t *e) if (THIS->map && THIS->map->redrawComplete()) { uint16_t deltaX = 0; uint16_t deltaY = 0; - ScrollDirection direction = (ScrollDirection)(unsigned long)e->user_data; + ScrollDirection direction = (ScrollDirection)(uintptr_t)e->user_data; switch (direction) { case scrollDownLeft: deltaX = 1; @@ -2575,8 +2607,8 @@ void TFTView_320x240::loadMap(void) sortedLon.reserve(nodeObjects.size()); for (auto it : nodeObjects) { lv_obj_t *p = nodes[it.first]; - int32_t lat = (long)p->LV_OBJ_IDX(node_pos1_idx)->user_data; - int32_t lon = (long)p->LV_OBJ_IDX(node_pos2_idx)->user_data; + int32_t lat = (intptr_t)p->LV_OBJ_IDX(node_pos1_idx)->user_data; + int32_t lon = (intptr_t)p->LV_OBJ_IDX(node_pos2_idx)->user_data; if (lat && lon) { sortedLat.push_back(lat); sortedLon.push_back(lon); @@ -2618,8 +2650,8 @@ void TFTView_320x240::loadMap(void) if (!nodeObjects.empty()) { for (auto it : nodeObjects) { lv_obj_t *p = nodes[it.first]; - float lat = 1e-7 * (long)p->LV_OBJ_IDX(node_pos1_idx)->user_data; - float lon = 1e-7 * (long)p->LV_OBJ_IDX(node_pos2_idx)->user_data; + float lat = 1e-7 * (intptr_t)p->LV_OBJ_IDX(node_pos1_idx)->user_data; + float lon = 1e-7 * (intptr_t)p->LV_OBJ_IDX(node_pos2_idx)->user_data; map->add(it.first, lat, lon, drawObjectCB); lv_obj_add_flag(it.second, LV_OBJ_FLAG_CLICKABLE); lv_obj_add_event_cb(it.second, ui_event_mapNodeButton, LV_EVENT_CLICKED, (void *)it.first); @@ -2795,7 +2827,7 @@ void TFTView_320x240::ui_event_mesh_detector_start(_lv_event_t *e) void TFTView_320x240::ui_event_signal_scanner(lv_event_t *e) { if (currentPanel) { - THIS->setNodeImage(currentNode, (MeshtasticView::eRole)(unsigned long)currentPanel->LV_OBJ_IDX(node_img_idx)->user_data, + THIS->setNodeImage(currentNode, (MeshtasticView::eRole)(uintptr_t)currentPanel->LV_OBJ_IDX(node_img_idx)->user_data, false, objects.signal_scanner_node_image); const char *lbs = lv_label_get_text(currentPanel->LV_OBJ_IDX(node_lbs_idx)); lv_label_set_text(objects.signal_scanner_node_button_label, lbs); @@ -2898,7 +2930,7 @@ void TFTView_320x240::ui_event_trace_route(lv_event_t *e) if (currentPanel) { THIS->setNodeImage(THIS->currentNode, - (MeshtasticView::eRole)(unsigned long)currentPanel->LV_OBJ_IDX(node_img_idx)->user_data, false, + (MeshtasticView::eRole)(uintptr_t)currentPanel->LV_OBJ_IDX(node_img_idx)->user_data, false, objects.trace_route_to_image); const char *lbl = lv_label_get_text(currentPanel->LV_OBJ_IDX(node_lbl_idx)); lv_label_set_text(objects.trace_route_to_button_label, lbl); @@ -2939,9 +2971,9 @@ void TFTView_320x240::ui_event_trace_route_start(lv_event_t *e) if (it.second == currentPanel) { uint32_t requestId; uint32_t to = it.first; - uint8_t ch = (uint8_t)(unsigned long)currentPanel->user_data; + uint8_t ch = (uint8_t)(uintptr_t)currentPanel->user_data; // trial: hoplimit optimization for direct messages - int8_t hopsAway = (signed long)THIS->nodes[to]->LV_OBJ_IDX(node_sig_idx)->user_data; + int8_t hopsAway = (intptr_t)THIS->nodes[to]->LV_OBJ_IDX(node_sig_idx)->user_data; if (hopsAway < 0) hopsAway = 5; uint8_t hopLimit = (hopsAway < THIS->db.config.lora.hop_limit ? hopsAway + 1 : hopsAway); @@ -3019,7 +3051,7 @@ void TFTView_320x240::packetDetected(const meshtastic_MeshPacket &p) lv_obj_add_flag(objects.detector_radar_panel, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(objects.detector_heard_label, LV_OBJ_FLAG_HIDDEN); - setNodeImage(p.from, (MeshtasticView::eRole)(unsigned long)nodes[p.from]->LV_OBJ_IDX(node_img_idx)->user_data, false, + setNodeImage(p.from, (MeshtasticView::eRole)(uintptr_t)nodes[p.from]->LV_OBJ_IDX(node_img_idx)->user_data, false, objects.detector_contact_image); const char *lbl = lv_label_get_text(nodes[p.from]->LV_OBJ_IDX(node_lbl_idx)); @@ -3971,7 +4003,7 @@ void TFTView_320x240::ui_event_ok(lv_event_t *e) } } - int8_t ch = (signed long)THIS->ch_label[0]->user_data; + int8_t ch = (intptr_t)THIS->ch_label[0]->user_data; THIS->setChannelName(THIS->db.channel[ch]); lv_obj_clear_state(objects.settings_channel_panel, LV_STATE_DISABLED); lv_obj_add_flag(objects.settings_channel_panel, LV_OBJ_FLAG_HIDDEN); @@ -4190,8 +4222,8 @@ void TFTView_320x240::ui_event_ok(lv_event_t *e) meshtastic_ChannelSettings_psk_t psk = {}; const char *name = lv_textarea_get_text(objects.settings_modify_channel_name_textarea); const char *base64 = lv_textarea_get_text(objects.settings_modify_channel_psk_textarea); - uint8_t btn_id = (unsigned long)objects.settings_modify_channel_name_textarea->user_data; - int8_t ch = (signed long)THIS->ch_label[btn_id]->user_data; + uint8_t btn_id = (uintptr_t)objects.settings_modify_channel_name_textarea->user_data; + int8_t ch = (intptr_t)THIS->ch_label[btn_id]->user_data; if (strlen(base64) == 0 && strlen(name) == 0) { // delete channel @@ -4461,7 +4493,7 @@ void TFTView_320x240::handleAddMessage(char *msg) uint8_t ch = 0; uint8_t hopLimit = db.config.lora.hop_limit; uint32_t requestId; - uint32_t channelOrNode = (unsigned long)activeMsgContainer->user_data; + uint32_t channelOrNode = (uintptr_t)activeMsgContainer->user_data; bool usePkc = false; auto callback = [this](const ResponseHandler::Request &req, ResponseHandler::EventType evt, int32_t pass) { @@ -4470,14 +4502,14 @@ void TFTView_320x240::handleAddMessage(char *msg) if (channelOrNode < c_max_channels) { ch = (uint8_t)channelOrNode; - requestId = requests.addRequest(ch, ResponseHandler::TextMessageRequest, (void *)(long)ch, callback); + requestId = requests.addRequest(ch, ResponseHandler::TextMessageRequest, (void *)(intptr_t)ch, callback); } else { - ch = (uint8_t)(unsigned long)nodes[channelOrNode]->user_data; + ch = (uint8_t)(uintptr_t)nodes[channelOrNode]->user_data; to = channelOrNode; - usePkc = (unsigned long)nodes[to]->LV_OBJ_IDX(node_bat_idx)->user_data; // hasKey + usePkc = (uintptr_t)nodes[to]->LV_OBJ_IDX(node_bat_idx)->user_data; // hasKey requestId = requests.addRequest(to, ResponseHandler::TextMessageRequest, (void *)to, callback); // trial: hoplimit optimization for direct text messages - int8_t hopsAway = (signed long)nodes[to]->LV_OBJ_IDX(node_sig_idx)->user_data; + int8_t hopsAway = (intptr_t)nodes[to]->LV_OBJ_IDX(node_sig_idx)->user_data; if (hopsAway < 0) hopsAway = db.config.lora.hop_limit; hopLimit = (hopsAway < db.config.lora.hop_limit ? hopsAway + 1 : hopsAway); @@ -4909,8 +4941,8 @@ void TFTView_320x240::updatePosition(uint32_t nodeNum, int32_t lat, int32_t lon, // TODO: need incremental update!? for (auto &it : nodes) { if (it.first != ownNode) { - int32_t nlat = (long)it.second->LV_OBJ_IDX(node_pos1_idx)->user_data; - int32_t nlon = (long)it.second->LV_OBJ_IDX(node_pos2_idx)->user_data; + int32_t nlat = (intptr_t)it.second->LV_OBJ_IDX(node_pos1_idx)->user_data; + int32_t nlon = (intptr_t)it.second->LV_OBJ_IDX(node_pos2_idx)->user_data; if (nlat != 0 && nlon != 0) { updateDistance(it.first, nlat, nlon); } @@ -5136,7 +5168,7 @@ void TFTView_320x240::updateHopsAway(uint32_t nodeNum, uint8_t hopsAway) char buf[32]; sprintf(buf, _("hops: %d"), (int)hopsAway); lv_label_set_text(it->second->LV_OBJ_IDX(node_sig_idx), buf); - it->second->LV_OBJ_IDX(node_sig_idx)->user_data = (void *)(unsigned long)hopsAway; + it->second->LV_OBJ_IDX(node_sig_idx)->user_data = (void *)(uintptr_t)hopsAway; lv_obj_remove_flag(it->second->LV_OBJ_IDX(node_sig_idx), LV_OBJ_FLAG_HIDDEN); } } @@ -5235,9 +5267,9 @@ void TFTView_320x240::onTextMessageCallback(const ResponseHandler::Request &req, { ILOG_DEBUG("onTextMessageCallback: %d %d", evt, result); if (evt == ResponseHandler::found) { - handleTextMessageResponse((unsigned long)req.cookie, req.id, false, result); + handleTextMessageResponse((uintptr_t)req.cookie, req.id, false, result); } else if (evt == ResponseHandler::removed) { - handleTextMessageResponse((unsigned long)req.cookie, req.id, true, result); + handleTextMessageResponse((uintptr_t)req.cookie, req.id, true, result); } else { ILOG_DEBUG("onTextMessageCallback: timeout!"); } @@ -5274,7 +5306,7 @@ void TFTView_320x240::handleResponse(uint32_t from, const uint32_t id, const mes if (req.type == ResponseHandler::TraceRouteRequest) { handleTraceRouteResponse(routing); } else if (req.type == ResponseHandler::TextMessageRequest) { - handleTextMessageResponse((unsigned long)req.cookie, id, ack, false); + handleTextMessageResponse((uintptr_t)req.cookie, id, ack, false); } else if (req.type == ResponseHandler::PositionRequest) { handlePositionResponse(from, id, p.rx_rssi, p.rx_snr, p.hop_limit == p.hop_start); } @@ -5283,7 +5315,7 @@ void TFTView_320x240::handleResponse(uint32_t from, const uint32_t id, const mes if (req.type == ResponseHandler::TraceRouteRequest) { handleTraceRouteResponse(routing); } else if (req.type == ResponseHandler::TextMessageRequest) { - handleTextMessageResponse((unsigned long)req.cookie, id, ack, true); + handleTextMessageResponse((uintptr_t)req.cookie, id, ack, true); } } else if (routing.error_reason == meshtastic_Routing_Error_NO_RESPONSE) { if (req.type == ResponseHandler::PositionRequest) { @@ -5292,9 +5324,9 @@ void TFTView_320x240::handleResponse(uint32_t from, const uint32_t id, const mes } else if (routing.error_reason == meshtastic_Routing_Error_NO_CHANNEL || routing.error_reason == meshtastic_Routing_Error_PKI_UNKNOWN_PUBKEY) { if (req.type == ResponseHandler::TextMessageRequest) { - handleTextMessageResponse((unsigned long)req.cookie, id, ack, true); + handleTextMessageResponse((uintptr_t)req.cookie, id, ack, true); // we probably have a wrong key; mark it as bad and don't use in future - if ((unsigned long)nodes[from]->LV_OBJ_IDX(node_bat_idx)->user_data == 1) { + if ((uintptr_t)nodes[from]->LV_OBJ_IDX(node_bat_idx)->user_data == 1) { ILOG_DEBUG("public key mismatch"); nodes[from]->LV_OBJ_IDX(node_bat_idx)->user_data = (void *)2; lv_obj_set_style_border_color(nodes[from]->LV_OBJ_IDX(node_img_idx), colorRed, LV_PART_MAIN); @@ -5332,7 +5364,7 @@ void TFTView_320x240::scanSignal(uint32_t scanNo) } else { uint32_t requestId; uint32_t to = currentNode; - uint8_t ch = (uint8_t)(unsigned long)currentPanel->user_data; + uint8_t ch = (uint8_t)(uintptr_t)currentPanel->user_data; requestId = requests.addRequest(to, ResponseHandler::PositionRequest, (void *)to); controller->requestPosition(to, ch, requestId); objects.signal_scanner_panel->user_data = (void *)requestId; @@ -5341,7 +5373,7 @@ void TFTView_320x240::scanSignal(uint32_t scanNo) void TFTView_320x240::handlePositionResponse(uint32_t from, uint32_t request_id, int32_t rx_rssi, float rx_snr, bool isNeighbor) { - if (request_id == (unsigned long)objects.signal_scanner_panel->user_data) { + if (request_id == (uintptr_t)objects.signal_scanner_panel->user_data) { requests.removeRequest(request_id); if (from == currentNode && isNeighbor) { @@ -5424,7 +5456,7 @@ void TFTView_320x240::addNodeToTraceRoute(uint32_t nodeNum, lv_obj_t *panel) { lv_obj_t *img = lv_img_create(btn); if (nodePanel) { - setNodeImage(nodeNum, (MeshtasticView::eRole)(unsigned long)nodePanel->LV_OBJ_IDX(node_img_idx)->user_data, false, + setNodeImage(nodeNum, (MeshtasticView::eRole)(uintptr_t)nodePanel->LV_OBJ_IDX(node_img_idx)->user_data, false, img); } else { setNodeImage(0, eRole::unknown, false, img); @@ -5488,10 +5520,10 @@ void TFTView_320x240::purgeNode(uint32_t nodeNum) curr_time = actTime; #endif // prefer purging older unknown nodes first (but not the brand new ones) - while ((eRole)(long)(children[i]->LV_OBJ_IDX(node_img_idx)->user_data) != eRole::unknown || + while ((eRole)(intptr_t)(children[i]->LV_OBJ_IDX(node_img_idx)->user_data) != eRole::unknown || curr_time < (time_t)(children[i]->LV_OBJ_IDX(node_lh_idx)->user_data) + 120 || - (unsigned long)(children[i]->LV_OBJ_IDX(node_lbl_idx)->user_data) == nodeNum || - chats.find((unsigned long)(children[i]->LV_OBJ_IDX(node_lbl_idx)->user_data)) != chats.end()) { + (uintptr_t)(children[i]->LV_OBJ_IDX(node_lbl_idx)->user_data) == nodeNum || + chats.find((uintptr_t)(children[i]->LV_OBJ_IDX(node_lbl_idx)->user_data)) != chats.end()) { if (i < (last + 1) / 5) { // keep 80% named nodes and 20% unknown (not fresh) nodes i = last; break; @@ -5500,8 +5532,8 @@ void TFTView_320x240::purgeNode(uint32_t nodeNum) } #endif lv_obj_t *p = children[i]; - uint32_t oldest = (unsigned long)(p->LV_OBJ_IDX(node_lbl_idx)->user_data); - uint32_t lastHeard = (unsigned long)p->LV_OBJ_IDX(node_lh_idx)->user_data; + uint32_t oldest = (uintptr_t)(p->LV_OBJ_IDX(node_lbl_idx)->user_data); + uint32_t lastHeard = (uintptr_t)p->LV_OBJ_IDX(node_lh_idx)->user_data; if (lastHeard > 0 && (curtime - lastHeard <= secs_until_offline)) nodesOnline--; @@ -5553,20 +5585,20 @@ bool TFTView_320x240::applyNodesFilter(uint32_t nodeNum, bool reset) hide = true; } if (lv_obj_has_state(objects.nodes_filter_public_key_switch, LV_STATE_CHECKED)) { - bool hasKey = (unsigned long)panel->LV_OBJ_IDX(node_bat_idx)->user_data == 1; + bool hasKey = (uintptr_t)panel->LV_OBJ_IDX(node_bat_idx)->user_data == 1; if (!hasKey) hide = true; } if (lv_dropdown_get_selected(objects.nodes_filter_channel_dropdown) != 0) { int selected = lv_dropdown_get_selected(objects.nodes_filter_channel_dropdown); if (selected != 0) { - uint8_t ch = (uint8_t)(unsigned long)panel->user_data; + uint8_t ch = (uint8_t)(uintptr_t)panel->user_data; if (selected - 1 != ch) hide = true; } } if (lv_dropdown_get_selected(objects.nodes_filter_hops_dropdown) != 0) { - int32_t hopsAway = (signed long)panel->LV_OBJ_IDX(node_sig_idx)->user_data; + int32_t hopsAway = (intptr_t)panel->LV_OBJ_IDX(node_sig_idx)->user_data; int selected = lv_dropdown_get_selected(objects.nodes_filter_hops_dropdown) - 7; if (hopsAway < 0) hide = true; @@ -5580,7 +5612,7 @@ bool TFTView_320x240::applyNodesFilter(uint32_t nodeNum, bool reset) } #if 0 if (lv_obj_has_state(objects.nodes_filter_mqtt_switch, LV_STATE_CHECKED)) { - bool viaMqtt = false; // TODO (unsigned long)panel->LV_OBJ_IDX(node_sig_idx)->user_data; + bool viaMqtt = false; // TODO (uintptr_t)panel->LV_OBJ_IDX(node_sig_idx)->user_data; if (viaMqtt) hide = true; } @@ -5641,7 +5673,7 @@ bool TFTView_320x240::applyNodesFilter(uint32_t nodeNum, bool reset) } if (lv_obj_has_state(objects.nodes_hliaq_switch, LV_STATE_CHECKED)) { if (lv_label_get_text(panel->LV_OBJ_IDX(node_tm2_idx))[0] != '\0') { - uint32_t iaq = (unsigned long)panel->LV_OBJ_IDX(node_tm2_idx)->user_data; + uint32_t iaq = (uintptr_t)panel->LV_OBJ_IDX(node_tm2_idx)->user_data; // IAQ color code lv_color_t fg, bg; if (iaq <= 50) { @@ -5720,7 +5752,7 @@ void TFTView_320x240::handleTextMessageResponse(uint32_t channelOrNode, const ui uint16_t i = msgContainer->spec_attr->child_cnt; while (i-- > 0) { lv_obj_t *panel = msgContainer->spec_attr->children[i]; - uint32_t requestId = (unsigned long)panel->user_data; + uint32_t requestId = (uintptr_t)panel->user_data; if (requestId == id) { // now give the textlabel border another color lv_obj_t *textLabel = panel->spec_attr->children[0]; @@ -6769,7 +6801,7 @@ void TFTView_320x240::showMessages(uint32_t nodeNum) if (p) { lv_label_set_text(objects.top_messages_node_label, lv_label_get_text(p->LV_OBJ_IDX(node_lbl_idx))); ui_set_active(objects.messages_button, objects.messages_panel, objects.top_messages_panel); - switch ((unsigned long)p->LV_OBJ_IDX(node_bat_idx)->user_data) { + switch ((uintptr_t)p->LV_OBJ_IDX(node_bat_idx)->user_data) { case 0: lv_obj_set_style_bg_image_src(objects.top_messages_node_image, &img_lock_channel_image, LV_PART_MAIN); break; @@ -7173,7 +7205,7 @@ void TFTView_320x240::updateTime(void) tm *curr_tm = localtime(&curr_time); int len = 0; - if (VALID_TIME(curr_time) && (unsigned long)objects.home_time_button->user_data == 0) { + if (VALID_TIME(curr_time) && (uintptr_t)objects.home_time_button->user_data == 0) { if (db.config.display.use_12h_clock) { len = strftime(buf, 40, "%I:%M:%S %p\n%a %d-%b-%g", curr_tm); } else { @@ -7310,7 +7342,7 @@ void TFTView_320x240::formatSDCard(void) void TFTView_320x240::updateFreeMem(void) { // only update if HomePanel is active (since this is some critical code that did crash sporadically) - if (activePanel == objects.home_panel && (unsigned long)objects.home_memory_button->user_data) { + if (activePanel == objects.home_panel && (uintptr_t)objects.home_memory_button->user_data) { char buf[64]; uint32_t freeHeap = 0; uint32_t freeHeap_pct = 0;