1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix warnings

This commit is contained in:
Gabor Kiss-Vamosi 2019-12-26 03:37:28 +01:00
parent de12286304
commit 0a53c05011
8 changed files with 30 additions and 20 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
**/*.o
**/*bin
**/*.swp
**/*.swo
tags

View File

@ -22,6 +22,7 @@
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_gc.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_log.h"
#include "../lv_hal/lv_hal.h"
#include <stdint.h>
#include <string.h>
@ -127,10 +128,12 @@ void lv_init(void)
void lv_deinit(void)
{
lv_gc_clear_roots();
lv_log_register_print_cb(NULL);
lv_disp_set_default(NULL);
lv_mem_deinit();
lv_initialized = false;
#if LV_USE_LOG
lv_log_register_print_cb(NULL);
#endif
LV_LOG_INFO("lv_deinit done");
}
#endif

View File

@ -23,7 +23,6 @@ extern "C" {
#include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_ll.h"
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_log.h"
#include "../lv_misc/lv_bidi.h"
#include "../lv_hal/lv_hal.h"

View File

@ -707,6 +707,10 @@ static inline lv_color_t color_blend_true_color_additive(lv_color_t fg, lv_color
if(opa <= LV_OPA_MIN) return bg;
uint16_t tmp;
#if LV_COLOR_DEPTH == 1
tmp = bg.full + fg.full;
fg.full = LV_MATH_MIN(tmp, 1);
#else
tmp = bg.ch.red + fg.ch.red;
#if LV_COLOR_DEPTH == 8
fg.ch.red = LV_MATH_MIN(tmp, 7);
@ -740,6 +744,7 @@ static inline lv_color_t color_blend_true_color_additive(lv_color_t fg, lv_color
fg.ch.blue = LV_MATH_MIN(tmp, 31);
#elif LV_COLOR_DEPTH == 32
fg.ch.blue = LV_MATH_MIN(tmp, 255);
#endif
#endif
if(opa == LV_OPA_COVER) return fg;

View File

@ -34,13 +34,15 @@
**********************/
static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
static void lv_bar_set_value_with_anim(lv_obj_t * bar, int16_t new_value, int16_t *value_ptr, lv_bar_anim_t *anim_info, lv_anim_enable_t en);
static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim);
static void draw_bg(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode, lv_opa_t opa);
static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode, lv_opa_t opa);
#if LV_USE_ANIMATION
static void lv_bar_set_value_with_anim(lv_obj_t * bar, int16_t new_value, int16_t *value_ptr, lv_bar_anim_t *anim_info, lv_anim_enable_t en);
static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim);
static void lv_bar_anim(lv_bar_anim_t * bar, lv_anim_value_t value);
static void lv_bar_anim_ready(lv_anim_t * a);
#endif
@ -146,9 +148,6 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = false;
#endif
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
if(ext->cur_value == value) return;
@ -157,9 +156,12 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
new_value = new_value < ext->min_value ? ext->min_value : new_value;
if(ext->cur_value == new_value) return;
#if LV_USE_ANIMATION == 0
ext->cur_value = new_value;
lv_obj_invalidate(bar);
#else
lv_bar_set_value_with_anim(bar, new_value, &ext->cur_value, &ext->cur_value_anim, anim);
#endif
}
/**
@ -172,9 +174,6 @@ void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = false;
#endif
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
if(ext->start_value == start_value) return;
@ -183,8 +182,11 @@ void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_
new_value = new_value < ext->min_value ? ext->min_value : start_value;
if(ext->start_value == new_value) return;
lv_bar_set_value_with_anim(bar, start_value, &ext->start_value, &ext->start_value_anim, anim);
#if LV_USE_ANIMATION == 0
ext->start_value = new_value;
#else
lv_bar_set_value_with_anim(bar, new_value, &ext->start_value, &ext->start_value_anim, anim);
#endif
}
/**
@ -647,9 +649,11 @@ static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
}
if(sign == LV_SIGNAL_CLEANUP) {
#if LV_USE_ANIMATION
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
lv_anim_del(&ext->cur_value_anim, NULL);
lv_anim_del(&ext->start_value_anim, NULL);
#endif
}
return res;
@ -673,14 +677,12 @@ static void lv_bar_anim_ready(lv_anim_t * a)
ext->start_value = var->anim_end;
lv_obj_invalidate(var->bar);
}
#endif
static void lv_bar_set_value_with_anim(lv_obj_t * bar, int16_t new_value, int16_t *value_ptr, lv_bar_anim_t *anim_info, lv_anim_enable_t en) {
if(en == LV_ANIM_OFF) {
*value_ptr = new_value;
lv_obj_invalidate(bar);
} else {
#if LV_USE_ANIMATION
lv_bar_ext_t *ext = lv_obj_get_ext_attr(bar);
/*No animation in progress -> simply set the values*/
if(!anim_info->is_animating) {
@ -711,7 +713,6 @@ static void lv_bar_set_value_with_anim(lv_obj_t * bar, int16_t new_value, int16_
lv_anim_create(&a);
anim_info->is_animating = true;
#endif
}
}
@ -722,5 +723,6 @@ static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim)
bar_anim->anim_end = 0;
bar_anim->is_animating = false;
}
#endif
#endif

View File

@ -106,7 +106,7 @@ lv_obj_t * lv_objmask_create(lv_obj_t * par, const lv_obj_t * copy)
lv_objmask_mask_t * lv_objmask_add_mask(lv_obj_t * objmask, void * param)
{
LV_ASSERT_OBJ(objmask, LV_OBJX_NAME);
LV_ASSERT_NULL(param)
LV_ASSERT_NULL(param);
lv_objmask_ext_t * ext = lv_obj_get_ext_attr(objmask);

View File

@ -344,7 +344,6 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
} else if(sign == LV_SIGNAL_GET_TYPE) {
@ -357,6 +356,7 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
} else if(sign == LV_SIGNAL_RELEASED) {
/*If released with an ENCODER then move to the next digit*/
#if LV_USE_GROUP
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(spinbox);
lv_indev_t * indev = lv_indev_get_act();
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
if(lv_group_get_editing(lv_obj_get_group(spinbox))) {

View File

@ -1,6 +1,6 @@
import os
warnings = '"-Wall"'
warnings = '"-Wall -Werror"'
base_defines = '"-DLV_CONF_PATH=tests/lv_test_conf.h -DLV_BUILD_TEST"'
optimization = '"-O3 -g0"'