: restructure to allow asserting in from too

This commit is contained in:
Gabor Kiss-Vamosi
2020-06-08 13:10:43 +02:00
parent df08d0bd54
commit 479851e968
57 changed files with 246 additions and 181 deletions

View File

@@ -14,6 +14,8 @@
- Add log in true double buffering mode with `set_px_cb` - Add log in true double buffering mode with `set_px_cb`
- `lv_dropdown`: fix missing `LV_EVENT_VALUE_CHANGED` event when used with encoder - `lv_dropdown`: fix missing `LV_EVENT_VALUE_CHANGED` event when used with encoder
- `lv_tileview`: fix if not the {0;0} tile is created first - `lv_tileview`: fix if not the {0;0} tile is created first
- `lv_debug`: restructure to allow asserting in from `lv_misc` too
- add assert if `_lv_mem_buf_get()` fails
## v7.0.1 (01.06.2020) ## v7.0.1 (01.06.2020)

View File

@@ -4,7 +4,6 @@ CSRCS += lv_disp.c
CSRCS += lv_obj.c CSRCS += lv_obj.c
CSRCS += lv_refr.c CSRCS += lv_refr.c
CSRCS += lv_style.c CSRCS += lv_style.c
CSRCS += lv_debug.c
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core

View File

@@ -9,7 +9,7 @@
#include "lv_group.h" #include "lv_group.h"
#if LV_USE_GROUP != 0 #if LV_USE_GROUP != 0
#include <stddef.h> #include <stddef.h>
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_gc.h" #include "../lv_misc/lv_gc.h"

View File

@@ -11,7 +11,7 @@
#include "lv_refr.h" #include "lv_refr.h"
#include "lv_group.h" #include "lv_group.h"
#include "lv_disp.h" #include "lv_disp.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_anim.h"
@@ -92,6 +92,7 @@ static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
static void fade_in_anim_ready(lv_anim_t * a); static void fade_in_anim_ready(lv_anim_t * a);
#endif #endif
static void lv_event_mark_deleted(lv_obj_t * obj); static void lv_event_mark_deleted(lv_obj_t * obj);
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
static void lv_obj_del_async_cb(void * obj); static void lv_obj_del_async_cb(void * obj);
static void obj_del_core(lv_obj_t * obj); static void obj_del_core(lv_obj_t * obj);
@@ -3405,6 +3406,52 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay)
#endif #endif
} }
/**
* Check if any object has a given type
* @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn")
* @return true: valid
*/
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type)
{
if(obj_type[0] == '\0') return true;
lv_obj_type_t types;
lv_obj_get_type((lv_obj_t *)obj, &types);
uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) {
if(types.type[i] == NULL) break;
if(strcmp(types.type[i], obj_type) == 0) return true;
}
return false;
}
/**
* Check if any object is still "alive", and part of the hierarchy
* @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn")
* @return true: valid
*/
bool lv_debug_check_obj_valid(const lv_obj_t * obj)
{
lv_disp_t * disp = lv_disp_get_next(NULL);
while(disp) {
lv_obj_t * scr;
_LV_LL_READ(disp->scr_ll, scr) {
if(scr == obj) return true;
bool found = obj_valid_child(scr, obj);
if(found) return true;
}
disp = lv_disp_get_next(disp);
}
return false;
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
@@ -4001,4 +4048,19 @@ static void lv_event_mark_deleted(lv_obj_t * obj)
} }
} }
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find)
{
/*Check all children of `parent`*/
lv_obj_t * child;
_LV_LL_READ(parent->child_ll, child) {
if(child == obj_to_find) return true;
/*Check the children*/
bool found = obj_valid_child(child, obj_to_find);
if(found) return true;
}
return false;
}

View File

@@ -21,6 +21,7 @@ extern "C" {
#include "../lv_misc/lv_types.h" #include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_area.h" #include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_color.h" #include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_hal/lv_hal.h" #include "../lv_hal/lv_hal.h"
#include "../lv_draw/lv_draw_rect.h" #include "../lv_draw/lv_draw_rect.h"
#include "../lv_draw/lv_draw_label.h" #include "../lv_draw/lv_draw_label.h"
@@ -1369,6 +1370,23 @@ void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
*/ */
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay); void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
/**
* Check if any object has a given type
* @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn")
* @return true: valid
*/
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type);
/**
* Check if any object is still "alive", and part of the hierarchy
* @param obj pointer to an object
* @param obj_type type of the object. (e.g. "lv_btn")
* @return true: valid
*/
bool lv_debug_check_obj_valid(const lv_obj_t * obj);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/
@@ -1389,6 +1407,32 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
*/ */
#define LV_EVENT_CB_DECLARE(name) static void name(lv_obj_t * obj, lv_event_t e) #define LV_EVENT_CB_DECLARE(name) static void name(lv_obj_t * obj, lv_event_t e)
#if LV_USE_DEBUG
# ifndef LV_DEBUG_IS_OBJ
# define LV_DEBUG_IS_OBJ(obj_p, obj_type) (lv_debug_check_null(obj_p) && \
lv_debug_check_obj_valid(obj_p) && \
lv_debug_check_obj_type(obj_p, obj_type))
# endif
# if LV_USE_ASSERT_OBJ
# ifndef LV_ASSERT_OBJ
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_DEBUG_ASSERT(LV_DEBUG_IS_OBJ(obj_p, obj_type), "Invalid object", obj_p);
# endif
# else /* LV_USE_ASSERT_OBJ == 0 */
# if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_ASSERT_NULL(obj_p)
# else
# define LV_ASSERT_OBJ(obj_p, obj_type) true
# endif
# endif
#else
# define LV_ASSERT_OBJ(obj, obj_type) true
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif

View File

@@ -221,7 +221,7 @@ void _lv_disp_refr_task(lv_task_t * task)
LV_UNUSED(copy_buf); LV_UNUSED(copy_buf);
#else #else
copy_buf = _lv_mem_buf_get(disp_refr->driver.hor_res * sizeof(lv_color_t)); copy_buf = _lv_mem_buf_get(disp_refr->driver.hor_res * sizeof(lv_color_t));
#endif #endif
uint8_t * buf_act = (uint8_t *)vdb->buf_act; uint8_t * buf_act = (uint8_t *)vdb->buf_act;
uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1; uint8_t * buf_ina = (uint8_t *)vdb->buf_act == vdb->buf1 ? vdb->buf2 : vdb->buf1;

View File

@@ -7,7 +7,6 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_obj.h" #include "lv_obj.h"
#include "../lv_core/lv_debug.h"
#include "../lv_misc/lv_mem.h" #include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_anim.h"
@@ -1003,6 +1002,45 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
else return LV_RES_INV; else return LV_RES_INV;
} }
/**
* Check whether a style is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style(const lv_style_t * style)
{
if(style == NULL) return true; /*NULL style is still valid*/
#if LV_USE_ASSERT_STYLE
if(style->sentinel != LV_DEBUG_STYLE_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif
return true;
}
/**
* Check whether a style list is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style_list(const lv_style_list_t * list)
{
if(list == NULL) return true; /*NULL list is still valid*/
#if LV_USE_ASSERT_STYLE
if(list->sentinel != LV_DEBUG_STYLE_LIST_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif
return true;
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/

View File

@@ -19,6 +19,7 @@ extern "C" {
#include "../lv_misc/lv_area.h" #include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_types.h" #include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw_blend.h" #include "../lv_draw/lv_draw_blend.h"
/********************* /*********************
@@ -541,6 +542,19 @@ lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop
*/ */
lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res); lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res);
/**
* Check whether a style is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style(const lv_style_t * style);
/**
* Check whether a style list is valid (initialized correctly)
* @param style pointer to a style
* @return true: valid
*/
bool lv_debug_check_style_list(const lv_style_list_t * list);
/************************* /*************************
* GLOBAL VARIABLES * GLOBAL VARIABLES
@@ -562,6 +576,34 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy); #define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy);
#if LV_USE_DEBUG
# ifndef LV_DEBUG_IS_STYLE
# define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p))
# endif
# ifndef LV_DEBUG_IS_STYLE_LIST
# define LV_DEBUG_IS_STYLE_LIST(list_p) (lv_debug_check_style_list(list_p))
# endif
# if LV_USE_ASSERT_STYLE
# ifndef LV_ASSERT_STYLE
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
# endif
# ifndef LV_ASSERT_STYLE_LIST
# define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p);
# endif
# else
# define LV_ASSERT_STYLE(style_p) true
# define LV_ASSERT_STYLE_LIST(list_p) true
# endif
#else
# define LV_ASSERT_STYLE(p) true
# define LV_ASSERT_STYLE_LIST(p) true
#endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif

View File

@@ -11,7 +11,7 @@
#include "../lv_hal/lv_hal_disp.h" #include "../lv_hal/lv_hal_disp.h"
#include "../lv_core/lv_refr.h" #include "../lv_core/lv_refr.h"
#include "../lv_misc/lv_bidi.h" #include "../lv_misc/lv_bidi.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@@ -13,7 +13,7 @@
#include "lv_draw_mask.h" #include "lv_draw_mask.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_log.h" #include "../lv_misc/lv_log.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_misc/lv_gc.h" #include "../lv_misc/lv_gc.h"
#if defined(LV_GC_INCLUDE) #if defined(LV_GC_INCLUDE)

View File

@@ -11,7 +11,7 @@
#include "lv_draw_mask.h" #include "lv_draw_mask.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_core/lv_refr.h" #include "../lv_core/lv_refr.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
/********************* /*********************
* DEFINES * DEFINES

View File

@@ -6,7 +6,7 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "lv_img_cache.h" #include "lv_img_cache.h"
#include "lv_img_decoder.h" #include "lv_img_decoder.h"
#include "lv_draw_img.h" #include "lv_draw_img.h"

View File

@@ -7,7 +7,7 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_img_decoder.h" #include "lv_img_decoder.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw_img.h" #include "../lv_draw/lv_draw_img.h"
#include "../lv_misc/lv_ll.h" #include "../lv_misc/lv_ll.h"
#include "../lv_misc/lv_color.h" #include "../lv_misc/lv_color.h"

View File

@@ -8,7 +8,7 @@
*********************/ *********************/
#include "lv_font.h" #include "lv_font.h"
#include "lv_font_fmt_txt.h" #include "lv_font_fmt_txt.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_types.h" #include "../lv_misc/lv_types.h"
#include "../lv_misc/lv_log.h" #include "../lv_misc/lv_log.h"

View File

@@ -14,7 +14,7 @@
#include "lv_hal.h" #include "lv_hal.h"
#include "../lv_misc/lv_mem.h" #include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_gc.h" #include "../lv_misc/lv_gc.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_obj.h" #include "../lv_core/lv_obj.h"
#include "../lv_core/lv_refr.h" #include "../lv_core/lv_refr.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -8,7 +8,7 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_hal/lv_hal_indev.h" #include "../lv_hal/lv_hal_indev.h"
#include "../lv_core/lv_indev.h" #include "../lv_core/lv_indev.h"
#include "../lv_misc/lv_mem.h" #include "../lv_misc/lv_mem.h"

View File

@@ -11,7 +11,7 @@
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_hal/lv_hal_tick.h" #include "../lv_hal/lv_hal_tick.h"
#include "lv_task.h" #include "lv_task.h"
#include "lv_math.h" #include "lv_math.h"

View File

@@ -6,11 +6,13 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_obj.h"
#include "lv_debug.h" #include "lv_debug.h"
#if LV_USE_DEBUG #if LV_USE_DEBUG
#include "lv_mem.h"
#include <string.h>
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
@@ -28,7 +30,6 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -54,68 +55,6 @@ bool lv_debug_check_mem_integrity(void)
return lv_mem_test() == LV_RES_OK ? true : false; return lv_mem_test() == LV_RES_OK ? true : false;
} }
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type)
{
if(obj_type[0] == '\0') return true;
lv_obj_type_t types;
lv_obj_get_type((lv_obj_t *)obj, &types);
uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) {
if(types.type[i] == NULL) break;
if(strcmp(types.type[i], obj_type) == 0) return true;
}
return false;
}
bool lv_debug_check_obj_valid(const lv_obj_t * obj)
{
lv_disp_t * disp = lv_disp_get_next(NULL);
while(disp) {
lv_obj_t * scr;
_LV_LL_READ(disp->scr_ll, scr) {
if(scr == obj) return true;
bool found = obj_valid_child(scr, obj);
if(found) return true;
}
disp = lv_disp_get_next(disp);
}
return false;
}
bool lv_debug_check_style(const lv_style_t * style)
{
if(style == NULL) return true; /*NULL style is still valid*/
#if LV_USE_ASSERT_STYLE
if(style->sentinel != LV_DEBUG_STYLE_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif
return true;
}
bool lv_debug_check_style_list(const lv_style_list_t * list)
{
if(list == NULL) return true; /*NULL list is still valid*/
#if LV_USE_ASSERT_STYLE
if(list->sentinel != LV_DEBUG_STYLE_LIST_SENTINEL_VALUE) {
LV_LOG_WARN("Invalid style (local variable or not initialized?)");
return false;
}
#endif
return true;
}
bool lv_debug_check_str(const void * str) bool lv_debug_check_str(const void * str)
{ {
const uint8_t * s = (const uint8_t *)str; const uint8_t * s = (const uint8_t *)str;
@@ -196,20 +135,6 @@ void lv_debug_log_error(const char * msg, uint64_t value)
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find)
{
/*Check all children of `parent`*/
lv_obj_t * child;
_LV_LL_READ(parent->child_ll, child) {
if(child == obj_to_find) return true;
/*Check the children*/
bool found = obj_valid_child(child, obj_to_find);
if(found) return true;
}
return false;
}
#endif /*LV_USE_DEBUG*/ #endif /*LV_USE_DEBUG*/

View File

@@ -13,9 +13,10 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_obj.h" #include "../lv_conf_internal.h"
#if LV_USE_DEBUG #if LV_USE_DEBUG
#include <stdbool.h>
/********************* /*********************
* DEFINES * DEFINES
@@ -32,14 +33,6 @@ bool lv_debug_check_null(const void * p);
bool lv_debug_check_mem_integrity(void); bool lv_debug_check_mem_integrity(void);
bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type);
bool lv_debug_check_obj_valid(const lv_obj_t * obj);
bool lv_debug_check_style(const lv_style_t * style);
bool lv_debug_check_style_list(const lv_style_list_t * list);
bool lv_debug_check_str(const void * str); bool lv_debug_check_str(const void * str);
void lv_debug_log_error(const char * msg, uint64_t value); void lv_debug_log_error(const char * msg, uint64_t value);
@@ -77,20 +70,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
lv_debug_check_str(str)) lv_debug_check_str(str))
#endif #endif
#ifndef LV_DEBUG_IS_OBJ
#define LV_DEBUG_IS_OBJ(obj_p, obj_type) (lv_debug_check_null(obj_p) && \
lv_debug_check_obj_valid(obj_p) && \
lv_debug_check_obj_type(obj_p, obj_type))
#endif
#ifndef LV_DEBUG_IS_STYLE
#define LV_DEBUG_IS_STYLE(style_p) (lv_debug_check_style(style_p))
#endif
#ifndef LV_DEBUG_IS_STYLE_LIST
#define LV_DEBUG_IS_STYLE_LIST(list_p) (lv_debug_check_style_list(list_p))
#endif
/*----------------- /*-----------------
* ASSERTS * ASSERTS
*-----------------*/ *-----------------*/
@@ -133,30 +112,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
# endif # endif
#endif #endif
#if LV_USE_ASSERT_OBJ
# ifndef LV_ASSERT_OBJ
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_DEBUG_ASSERT(LV_DEBUG_IS_OBJ(obj_p, obj_type), "Invalid object", obj_p);
# endif
#else /* LV_USE_ASSERT_OBJ == 0 */
# if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/
# define LV_ASSERT_OBJ(obj_p, obj_type) LV_ASSERT_NULL(obj_p)
# else
# define LV_ASSERT_OBJ(obj_p, obj_type) true
# endif
#endif
#if LV_USE_ASSERT_STYLE
# ifndef LV_ASSERT_STYLE
# define LV_ASSERT_STYLE(style_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE(style_p), "Invalid style", style_p);
# endif
# ifndef LV_ASSERT_STYLE_LIST
# define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p);
# endif
#else
# define LV_ASSERT_STYLE(style_p) true
# define LV_ASSERT_STYLE_LIST(list_p) true
#endif
#else /* LV_USE_DEBUG == 0 */ #else /* LV_USE_DEBUG == 0 */
@@ -167,8 +122,6 @@ void lv_debug_log_error(const char * msg, uint64_t value);
#define LV_ASSERT_MEM_INTEGRITY() true #define LV_ASSERT_MEM_INTEGRITY() true
#define LV_ASSERT_STR(p) true #define LV_ASSERT_STR(p) true
#define LV_ASSERT_OBJ(obj, obj_type) true #define LV_ASSERT_OBJ(obj, obj_type) true
#define LV_ASSERT_STYLE(p) true
#define LV_ASSERT_STYLE_LIST(p) true
#endif /* LV_USE_DEBUG */ #endif /* LV_USE_DEBUG */
/*clang-format on*/ /*clang-format on*/

View File

@@ -9,7 +9,7 @@
#include "lv_fs.h" #include "lv_fs.h"
#if LV_USE_FILESYSTEM #if LV_USE_FILESYSTEM
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "lv_ll.h" #include "lv_ll.h"
#include <string.h> #include <string.h>
#include "lv_gc.h" #include "lv_gc.h"

View File

@@ -513,14 +513,13 @@ void * _lv_mem_buf_get(uint32_t size)
/*if this fails you probably need to increase your LV_MEM_SIZE/heap size*/ /*if this fails you probably need to increase your LV_MEM_SIZE/heap size*/
LV_GC_ROOT(_lv_mem_buf[i]).p = lv_mem_realloc(LV_GC_ROOT(_lv_mem_buf[i]).p, size); LV_GC_ROOT(_lv_mem_buf[i]).p = lv_mem_realloc(LV_GC_ROOT(_lv_mem_buf[i]).p, size);
if(LV_GC_ROOT(_lv_mem_buf[i]).p == NULL) { if(LV_GC_ROOT(_lv_mem_buf[i]).p == NULL) {
LV_LOG_ERROR("lv_mem_buf_get: Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size)") LV_DEBUG_ASSERT(false, "Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size", 0x00);
} }
return LV_GC_ROOT(_lv_mem_buf[i]).p; return LV_GC_ROOT(_lv_mem_buf[i]).p;
} }
} }
LV_LOG_ERROR("lv_mem_buf_get: no free buffer. Increase LV_DRAW_BUF_MAX_NUM."); LV_DEBUG_ASSERT(false, "No free buffer. Increase LV_DRAW_BUF_MAX_NUM.", 0x00);
return NULL; return NULL;
} }

View File

@@ -14,6 +14,7 @@ CSRCS += lv_utils.c
CSRCS += lv_async.c CSRCS += lv_async.c
CSRCS += lv_printf.c CSRCS += lv_printf.c
CSRCS += lv_bidi.c CSRCS += lv_bidi.c
CSRCS += lv_debug.c
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc

View File

@@ -9,7 +9,7 @@
*********************/ *********************/
#include <stddef.h> #include <stddef.h>
#include "lv_task.h" #include "lv_task.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_hal/lv_hal_tick.h" #include "../lv_hal/lv_hal_tick.h"
#include "lv_gc.h" #include "lv_gc.h"

View File

@@ -9,7 +9,7 @@
#include "lv_arc.h" #include "lv_arc.h"
#if LV_USE_ARC != 0 #if LV_USE_ARC != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_draw/lv_draw_arc.h" #include "../lv_draw/lv_draw_arc.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -11,7 +11,7 @@
#include "lv_bar.h" #include "lv_bar.h"
#if LV_USE_BAR != 0 #if LV_USE_BAR != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_anim.h"

View File

@@ -12,7 +12,7 @@
#include <string.h> #include <string.h>
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_area.h" #include "../lv_misc/lv_area.h"

View File

@@ -9,7 +9,7 @@
#include "lv_btnmatrix.h" #include "lv_btnmatrix.h"
#if LV_USE_BTNMATRIX != 0 #if LV_USE_BTNMATRIX != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_core/lv_refr.h" #include "../lv_core/lv_refr.h"

View File

@@ -9,7 +9,7 @@
#include "lv_calendar.h" #include "lv_calendar.h"
#if LV_USE_CALENDAR != 0 #if LV_USE_CALENDAR != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_hal/lv_hal_indev.h" #include "../lv_hal/lv_hal_indev.h"
#include "../lv_misc/lv_utils.h" #include "../lv_misc/lv_utils.h"

View File

@@ -8,7 +8,7 @@
*********************/ *********************/
#include <stdlib.h> #include <stdlib.h>
#include "lv_canvas.h" #include "lv_canvas.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_core/lv_refr.h" #include "../lv_core/lv_refr.h"

View File

@@ -9,7 +9,7 @@
#include "lv_chart.h" #include "lv_chart.h"
#if LV_USE_CHART != 0 #if LV_USE_CHART != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_refr.h" #include "../lv_core/lv_refr.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"

View File

@@ -9,7 +9,7 @@
#include "lv_checkbox.h" #include "lv_checkbox.h"
#if LV_USE_CHECKBOX != 0 #if LV_USE_CHECKBOX != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -14,7 +14,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_draw/lv_draw_mask.h" #include "../lv_draw/lv_draw_mask.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -10,7 +10,7 @@
#include "lv_cpicker.h" #include "lv_cpicker.h"
#if LV_USE_CPICKER != 0 #if LV_USE_CPICKER != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw_arc.h" #include "../lv_draw/lv_draw_arc.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_core/lv_indev.h" #include "../lv_core/lv_indev.h"

View File

@@ -9,7 +9,7 @@
#include "lv_dropdown.h" #include "lv_dropdown.h"
#if LV_USE_DROPDOWN != 0 #if LV_USE_DROPDOWN != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_core/lv_indev.h" #include "../lv_core/lv_indev.h"

View File

@@ -9,7 +9,7 @@
#include "lv_gauge.h" #include "lv_gauge.h"
#if LV_USE_GAUGE != 0 #if LV_USE_GAUGE != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_txt.h" #include "../lv_misc/lv_txt.h"

View File

@@ -14,7 +14,7 @@
#error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) " #error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif #endif
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_draw/lv_img_decoder.h" #include "../lv_draw/lv_img_decoder.h"
#include "../lv_misc/lv_fs.h" #include "../lv_misc/lv_fs.h"

View File

@@ -7,7 +7,7 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "lv_imgbtn.h" #include "lv_imgbtn.h"
#include "lv_label.h" #include "lv_label.h"
@@ -350,7 +350,7 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
clip_center_area.y2 = coords.y2; clip_center_area.y2 = coords.y2;
bool comm_res; bool comm_res;
comm_res = lv_area_intersect(&clip_center_area, &clip_center_area, clip_area); comm_res = _lv_area_intersect(&clip_center_area, &clip_center_area, clip_area);
if(comm_res) { if(comm_res) {
lv_coord_t obj_w = lv_obj_get_width(imgbtn); lv_coord_t obj_w = lv_obj_get_width(imgbtn);
lv_coord_t i; lv_coord_t i;

View File

@@ -10,7 +10,7 @@
#include "lv_keyboard.h" #include "lv_keyboard.h"
#if LV_USE_KEYBOARD != 0 #if LV_USE_KEYBOARD != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "lv_textarea.h" #include "lv_textarea.h"

View File

@@ -9,7 +9,7 @@
#include "lv_label.h" #include "lv_label.h"
#if LV_USE_LABEL != 0 #if LV_USE_LABEL != 0
#include "../lv_core/lv_obj.h" #include "../lv_core/lv_obj.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_color.h" #include "../lv_misc/lv_color.h"

View File

@@ -9,7 +9,7 @@
#include "lv_led.h" #include "lv_led.h"
#if LV_USE_LED != 0 #if LV_USE_LED != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"

View File

@@ -9,7 +9,7 @@
#include "lv_line.h" #include "lv_line.h"
#if LV_USE_LINE != 0 #if LV_USE_LINE != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -9,7 +9,7 @@
#include "lv_linemeter.h" #include "lv_linemeter.h"
#if LV_USE_LINEMETER != 0 #if LV_USE_LINEMETER != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"

View File

@@ -9,7 +9,7 @@
#include "lv_list.h" #include "lv_list.h"
#if LV_USE_LIST != 0 #if LV_USE_LIST != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_anim.h"

View File

@@ -9,7 +9,7 @@
#include "lv_msgbox.h" #include "lv_msgbox.h"
#if LV_USE_MSGBOX != 0 #if LV_USE_MSGBOX != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_core/lv_disp.h" #include "../lv_core/lv_disp.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -7,7 +7,7 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_objmask.h" #include "lv_objmask.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -15,7 +15,7 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
//#include "lv_templ.h" /*TODO uncomment this*/ //#include "lv_templ.h" /*TODO uncomment this*/
#if defined(LV_USE_TEMPL) && LV_USE_TEMPL != 0 #if defined(LV_USE_TEMPL) && LV_USE_TEMPL != 0

View File

@@ -9,7 +9,7 @@
#include "../lv_widgets/lv_page.h" #include "../lv_widgets/lv_page.h"
#if LV_USE_PAGE != 0 #if LV_USE_PAGE != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -10,7 +10,7 @@
#include "lv_roller.h" #include "lv_roller.h"
#if LV_USE_ROLLER != 0 #if LV_USE_ROLLER != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"

View File

@@ -10,7 +10,7 @@
#include "lv_slider.h" #include "lv_slider.h"
#if LV_USE_SLIDER != 0 #if LV_USE_SLIDER != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_core/lv_indev.h" #include "../lv_core/lv_indev.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"

View File

@@ -9,7 +9,7 @@
#include "lv_spinbox.h" #include "lv_spinbox.h"
#if LV_USE_SPINBOX != 0 #if LV_USE_SPINBOX != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_utils.h" #include "../lv_misc/lv_utils.h"

View File

@@ -9,7 +9,7 @@
#include "lv_spinner.h" #include "lv_spinner.h"
#if LV_USE_SPINNER != 0 #if LV_USE_SPINNER != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_draw/lv_draw_rect.h" #include "../lv_draw/lv_draw_rect.h"
#include "../lv_draw/lv_draw_arc.h" #include "../lv_draw/lv_draw_arc.h"

View File

@@ -15,7 +15,7 @@
#error "lv_sw: lv_slider is required. Enable it in lv_conf.h (LV_USE_SLIDER 1) " #error "lv_sw: lv_slider is required. Enable it in lv_conf.h (LV_USE_SLIDER 1) "
#endif #endif
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_core/lv_indev.h" #include "../lv_core/lv_indev.h"

View File

@@ -9,7 +9,7 @@
#include "lv_table.h" #include "lv_table.h"
#if LV_USE_TABLE != 0 #if LV_USE_TABLE != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_indev.h" #include "../lv_core/lv_indev.h"
#include "../lv_misc/lv_txt.h" #include "../lv_misc/lv_txt.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"

View File

@@ -10,7 +10,7 @@
#if LV_USE_TABVIEW != 0 #if LV_USE_TABVIEW != 0
#include "lv_btnmatrix.h" #include "lv_btnmatrix.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h" #include "../lv_misc/lv_anim.h"
#include "../lv_core/lv_disp.h" #include "../lv_core/lv_disp.h"

View File

@@ -10,7 +10,7 @@
#if LV_USE_TEXTAREA != 0 #if LV_USE_TEXTAREA != 0
#include <string.h> #include <string.h>
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h" #include "../lv_core/lv_group.h"
#include "../lv_core/lv_refr.h" #include "../lv_core/lv_refr.h"
#include "../lv_draw/lv_draw.h" #include "../lv_draw/lv_draw.h"

View File

@@ -12,7 +12,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "lv_cont.h" #include "lv_cont.h"
#include "../lv_misc/lv_math.h" #include "../lv_misc/lv_math.h"
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
/********************* /*********************

View File

@@ -9,7 +9,7 @@
#include "lv_win.h" #include "lv_win.h"
#if LV_USE_WIN != 0 #if LV_USE_WIN != 0
#include "../lv_core/lv_debug.h" #include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h" #include "../lv_themes/lv_theme.h"
#include "../lv_core/lv_disp.h" #include "../lv_core/lv_disp.h"