diff options
Diffstat (limited to 'quantum/painter/lvgl')
-rw-r--r-- | quantum/painter/lvgl/qp_lvgl.c | 11 | ||||
-rw-r--r-- | quantum/painter/lvgl/qp_lvgl.h | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/quantum/painter/lvgl/qp_lvgl.c b/quantum/painter/lvgl/qp_lvgl.c index 280aeaf91f..877b2652c6 100644 --- a/quantum/painter/lvgl/qp_lvgl.c +++ b/quantum/painter/lvgl/qp_lvgl.c @@ -81,8 +81,8 @@ bool qp_lvgl_attach(painter_device_t device) { lvgl_state_t *lv_task_handler_state = &lvgl_states[1]; lv_task_handler_state->fnc_id = 1; - lv_task_handler_state->delay_ms = 5; - lv_task_handler_state->defer_token = defer_exec_advanced(lvgl_executors, 2, 5, tick_task_callback, lv_task_handler_state); + lv_task_handler_state->delay_ms = QP_LVGL_TASK_PERIOD; + lv_task_handler_state->defer_token = defer_exec_advanced(lvgl_executors, 2, QP_LVGL_TASK_PERIOD, tick_task_callback, lv_task_handler_state); if (lv_task_handler_state->defer_token == INVALID_DEFERRED_TOKEN) { qp_dprintf("qp_lvgl_attach: fail (could not set up qp_lvgl executor)\n"); @@ -96,13 +96,14 @@ bool qp_lvgl_attach(painter_device_t device) { // Set up lvgl display buffer static lv_disp_draw_buf_t draw_buf; // Allocate a buffer for 1/10 screen size - const size_t count_required = driver->panel_width * driver->panel_height / 10; - color_buffer = color_buffer ? realloc(color_buffer, sizeof(lv_color_t) * count_required) : malloc(sizeof(lv_color_t) * count_required); - if (!color_buffer) { + const size_t count_required = driver->panel_width * driver->panel_height / 10; + void * new_color_buffer = realloc(color_buffer, sizeof(lv_color_t) * count_required); + if (!new_color_buffer) { qp_dprintf("qp_lvgl_attach: fail (could not set up memory buffer)\n"); qp_lvgl_detach(); return false; } + color_buffer = new_color_buffer; memset(color_buffer, 0, sizeof(lv_color_t) * count_required); // Initialize the display buffer. lv_disp_draw_buf_init(&draw_buf, color_buffer, NULL, count_required); diff --git a/quantum/painter/lvgl/qp_lvgl.h b/quantum/painter/lvgl/qp_lvgl.h index d9ad5e8df1..87ba3ac0a5 100644 --- a/quantum/painter/lvgl/qp_lvgl.h +++ b/quantum/painter/lvgl/qp_lvgl.h @@ -7,6 +7,10 @@ #include "qp.h" #include "lvgl.h" +#ifndef QP_LVGL_TASK_PERIOD +# define QP_LVGL_TASK_PERIOD 5 +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Quantum Painter - LVGL External API |