fix conflicts

This commit is contained in:
Gabor Kiss-Vamosi
2020-05-07 16:01:48 +02:00
7 changed files with 45 additions and 4 deletions

View File

@@ -140,14 +140,14 @@ void lv_port_indev_init(void)
/*Register a encoder input device*/ /*Register a encoder input device*/
lv_indev_drv_init(&indev_drv); lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_KEYPAD; indev_drv.type = LV_INDEV_TYPE_ENCODER;
indev_drv.read_cb = encoder_read; indev_drv.read_cb = encoder_read;
indev_encoder = lv_indev_drv_register(&indev_drv); indev_encoder = lv_indev_drv_register(&indev_drv);
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`, /* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
* add objects to the group with `lv_group_add_obj(group, obj)` * add objects to the group with `lv_group_add_obj(group, obj)`
* and assign this input device to group to navigate in it: * and assign this input device to group to navigate in it:
* `lv_indev_set_group(indev_keypad, group);` */ * `lv_indev_set_group(indev_encoder, group);` */
/*------------------ /*------------------
* Button * Button

View File

@@ -735,6 +735,12 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
*/ */
static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data) static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
{ {
/* Die gracefully if i->btn_points is NULL */
if (i->btn_points == NULL) {
LV_LOG_WARN("indev_button_proc: btn_points was NULL");
return;
}
i->proc.types.pointer.act_point.x = i->btn_points[data->btn_id].x; i->proc.types.pointer.act_point.x = i->btn_points[data->btn_id].x;
i->proc.types.pointer.act_point.y = i->btn_points[data->btn_id].y; i->proc.types.pointer.act_point.y = i->btn_points[data->btn_id].y;

View File

@@ -385,7 +385,7 @@ static void lv_refr_area(const lv_area_t * area_p)
lv_coord_t w = lv_area_get_width(area_p); lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p); lv_coord_t h = lv_area_get_height(area_p);
lv_coord_t y2 = lv_coord_t y2 =
area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? y2 = lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2; area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
int32_t max_row = (uint32_t)vdb->size / w; int32_t max_row = (uint32_t)vdb->size / w;

View File

@@ -213,6 +213,26 @@ uint16_t lv_atan2(int x, int y)
return degree; return degree;
} }
/**
* Calculate the integer exponents.
* @param base
* @param power
* @return base raised to the power exponent
*/
int64_t lv_pow(int64_t base, int8_t exp)
{
int64_t result = 1;
while (exp)
{
if (exp & 1)
result *= base;
exp >>= 1;
base *= base;
}
return result;
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/

View File

@@ -96,6 +96,14 @@ uint16_t lv_atan2(int x, int y);
*/ */
LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask); LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask);
/**
* Calculate the integer exponents.
* @param base
* @param power
* @return base raised to the power exponent
*/
int64_t lv_pow(int64_t base, int8_t exp);
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/

View File

@@ -173,6 +173,13 @@ void lv_spinbox_set_digit_format(lv_obj_t * spinbox, uint8_t digit_count, uint8_
if(separator_position >= digit_count) separator_position = 0; if(separator_position >= digit_count) separator_position = 0;
if(separator_position > LV_SPINBOX_MAX_DIGIT_COUNT) separator_position = LV_SPINBOX_MAX_DIGIT_COUNT; if(separator_position > LV_SPINBOX_MAX_DIGIT_COUNT) separator_position = LV_SPINBOX_MAX_DIGIT_COUNT;
if(digit_count < LV_SPINBOX_MAX_DIGIT_COUNT)
{
uint64_t max_val = lv_pow(10, digit_count);
if(ext->range_max > max_val - 1) ext->range_max = max_val - 1;
if(ext->range_min < - max_val + 1) ext->range_min = - max_val + 1;
}
ext->digit_count = digit_count; ext->digit_count = digit_count;
ext->dec_point_pos = separator_position; ext->dec_point_pos = separator_position;

View File

@@ -28,7 +28,7 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define LV_SPINBOX_MAX_DIGIT_COUNT 16 #define LV_SPINBOX_MAX_DIGIT_COUNT 10
/********************** /**********************
* TYPEDEFS * TYPEDEFS