Browse Source

update:lvgl默认使用sys内存申请

Dozingfiretruck 1 year ago
parent
commit
997370b343
2 changed files with 5 additions and 4 deletions
  1. 4 3
      components/lvgl/binding/luat_lib_lvgl7.c
  2. 1 1
      components/lvgl/lv_conf.h

+ 4 - 3
components/lvgl/binding/luat_lib_lvgl7.c

@@ -148,7 +148,7 @@ int luat_lv_init(lua_State *L) {
     LLOGD("w %d h %d buff %d mode %d", w, h, fbuff_size, buffmode);
     LLOGD("w %d h %d buff %d mode %d", w, h, fbuff_size, buffmode);
 
 
     if (lcd_conf != NULL && lcd_conf->buff != NULL) {
     if (lcd_conf != NULL && lcd_conf->buff != NULL) {
-        //LLOGD("use LCD buff");
+        // LLOGD("use LCD buff");
         fbuffer = lcd_conf->buff;
         fbuffer = lcd_conf->buff;
         fbuff_size = w * h;
         fbuff_size = w * h;
     }
     }
@@ -198,7 +198,6 @@ int luat_lv_init(lua_State *L) {
     my_disp_drv.hor_res = w;
     my_disp_drv.hor_res = w;
     my_disp_drv.ver_res = h;
     my_disp_drv.ver_res = h;
     my_disp_drv.buffer = &LV.disp_buf;
     my_disp_drv.buffer = &LV.disp_buf;
-    //LLOGD(">>%s %d", __func__, __LINE__);
 
 
 #ifdef LUAT_USE_LVGL_SDL2
 #ifdef LUAT_USE_LVGL_SDL2
     if (lcd_conf == NULL) {
     if (lcd_conf == NULL) {
@@ -210,7 +209,9 @@ int luat_lv_init(lua_State *L) {
     }
     }
 #endif
 #endif
     LV.disp = lv_disp_drv_register(&my_disp_drv);
     LV.disp = lv_disp_drv_register(&my_disp_drv);
-    //LLOGD(">>%s %d", __func__, __LINE__);
+    if (LV.disp == NULL) {
+        LLOGE("lv_disp_drv_register error");
+    }
     lua_pushboolean(L, LV.disp != NULL ? 1 : 0);
     lua_pushboolean(L, LV.disp != NULL ? 1 : 0);
 #ifdef LUAT_USE_LVGL_SDL2
 #ifdef LUAT_USE_LVGL_SDL2
     LLOGD("use LVGL-LCD-SDL2 swap %d", LV_COLOR_16_SWAP);
     LLOGD("use LVGL-LCD-SDL2 swap %d", LV_COLOR_16_SWAP);

+ 1 - 1
components/lvgl/lv_conf.h

@@ -94,7 +94,7 @@ typedef int16_t lv_coord_t;
 
 
 /* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
 /* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
 #ifndef LV_MEM_CUSTOM
 #ifndef LV_MEM_CUSTOM
-#define LV_MEM_CUSTOM      0
+#define LV_MEM_CUSTOM      1
 #endif
 #endif
 #if LV_MEM_CUSTOM == 0
 #if LV_MEM_CUSTOM == 0
 /* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
 /* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/