diff --git a/src/drivers/nuttx/lv_nuttx_entry.c b/src/drivers/nuttx/lv_nuttx_entry.c index 559f9bbac4..90adf790cb 100644 --- a/src/drivers/nuttx/lv_nuttx_entry.c +++ b/src/drivers/nuttx/lv_nuttx_entry.c @@ -104,9 +104,7 @@ void lv_nuttx_init(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result) lv_nuttx_cache_init(); -#if LV_CACHE_DEF_SIZE > 0 lv_nuttx_image_cache_init(); -#endif #if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN lv_nuttx_profiler_init(); diff --git a/src/drivers/nuttx/lv_nuttx_entry.h b/src/drivers/nuttx/lv_nuttx_entry.h index a6f178a87d..93449e046f 100644 --- a/src/drivers/nuttx/lv_nuttx_entry.h +++ b/src/drivers/nuttx/lv_nuttx_entry.h @@ -44,13 +44,7 @@ typedef struct { } lv_nuttx_result_t; typedef struct _lv_nuttx_ctx_t { - -#if LV_CACHE_DEF_SIZE > 0 void * image_cache; -#else - void * dummy; -#endif - } lv_nuttx_ctx_t; /********************** diff --git a/src/drivers/nuttx/lv_nuttx_image_cache.c b/src/drivers/nuttx/lv_nuttx_image_cache.c index b052062c7b..00efd163a4 100644 --- a/src/drivers/nuttx/lv_nuttx_image_cache.c +++ b/src/drivers/nuttx/lv_nuttx_image_cache.c @@ -10,8 +10,6 @@ #include "lv_nuttx_image_cache.h" #include "../../../lvgl.h" -#if LV_CACHE_DEF_SIZE > 0 - #if LV_USE_NUTTX #include @@ -78,6 +76,11 @@ static bool defer_init(void) return true; } + if(img_cache_p->max_size == 0) { + LV_LOG_INFO("Image cache is not initialized yet. Skipping deferred initialization. Because max_size is 0."); + return false; + } + ctx->mem_size = img_cache_p->max_size; ctx->mem = malloc(ctx->mem_size); LV_ASSERT_MALLOC(ctx->mem); @@ -150,4 +153,3 @@ static void free_cb(void * draw_buf) } #endif /* LV_USE_NUTTX */ -#endif /* LV_CACHE_DEF_SIZE > 0 */ diff --git a/src/drivers/nuttx/lv_nuttx_image_cache.h b/src/drivers/nuttx/lv_nuttx_image_cache.h index e2af31f417..d8f74fbca0 100644 --- a/src/drivers/nuttx/lv_nuttx_image_cache.h +++ b/src/drivers/nuttx/lv_nuttx_image_cache.h @@ -16,8 +16,6 @@ extern "C" { #include "../../lv_conf_internal.h" -#if LV_CACHE_DEF_SIZE > 0 - /********************* * DEFINES *********************/ @@ -36,8 +34,6 @@ void lv_nuttx_image_cache_init(void); * MACROS **********************/ -#endif /*LV_CACHE_DEF_SIZE > 0*/ - #ifdef __cplusplus } /*extern "C"*/ #endif