move INDEV settings from lv_conf.h to the indev driver

This commit is contained in:
Gabor Kiss-Vamosi
2019-04-02 12:15:35 +02:00
parent 38c55377c6
commit 84ace67720
14 changed files with 187 additions and 118 deletions

View File

@@ -40,7 +40,7 @@
/*Default screen refresh period in milliseconds. LittlevGL will redraw the screen with this period*/
#ifndef LV_REFR_PERIOD
#define LV_REFR_PERIOD 30 /*[ms]*/
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
#endif
/* Dot Per Inch: used to initialize default sizes. E.g. a button with width = LV_DPI / 2 -> half inch wide
@@ -106,22 +106,22 @@
/*Input device settings*/
#ifndef LV_INDEV_READ_PERIOD
#define LV_INDEV_READ_PERIOD 30 /*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 30 /*Input device read period in milliseconds*/
#endif
#ifndef LV_INDEV_POINT_MARKER
#define LV_INDEV_POINT_MARKER 0 /*Mark the pressed points (required: LV_USE_REAL_DRAW = 1)*/
#endif
#ifndef LV_INDEV_DRAG_LIMIT
#define LV_INDEV_DRAG_LIMIT 10 /*Drag threshold in pixels */
#define LV_INDEV_DEF_DRAG_LIMIT 10 /*Drag threshold in pixels */
#endif
#ifndef LV_INDEV_DRAG_THROW
#define LV_INDEV_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
#define LV_INDEV_DEF_DRAG_THROW 20 /*Drag throw slow-down in [%]. Greater value means faster slow-down */
#endif
#ifndef LV_INDEV_LONG_PRESS_TIME
#define LV_INDEV_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/
#define LV_INDEV_DEF_LONG_PRESS_TIME 400 /*Long press time in milliseconds*/
#endif
#ifndef LV_INDEV_LONG_PRESS_REP_TIME
#define LV_INDEV_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 /*Repeated trigger period in long press [ms] */
#endif
/*Text settings*/

View File

@@ -113,17 +113,16 @@ void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr)
}
/**
* Get the a pointer to the screen refresher task.
* It's parameters can be modified with `lv_task_...` functions,
* Get a pointer to the screen refresher task to
* modify its parameters with `lv_task_...` functions.
* @param disp pointer to a display
* @return pointer to the display refresher task. (NULL on error)
*/
lv_task_t * lv_disp_get_refr_task(lv_disp_t * disp)
{
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("lv_disp_get_refr_task: no display registered to get its top layer");
LV_LOG_WARN("lv_disp_get_refr_task: no display registered");
return NULL;
}

View File

@@ -63,8 +63,8 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp);
void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr);
/**
* Get the a pointer to the screen refresher task.
* It's parameters can be modified with `lv_task_...` functions,
* Get a pointer to the screen refresher task to
* modify its parameters with `lv_task_...` functions.
* @param disp pointer to a display
* @return pointer to the display refresher task. (NULL on error)
*/

View File

@@ -20,7 +20,7 @@
* DEFINES
*********************/
#if LV_INDEV_DRAG_THROW <= 0
#if LV_INDEV_DEF_DRAG_THROW <= 0
#warning "LV_INDEV_DRAG_THROW must be greater than 0"
#endif
@@ -32,8 +32,6 @@
* STATIC PROTOTYPES
**********************/
#if LV_INDEV_READ_PERIOD != 0
static void indev_proc_task(void * param);
static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data);
static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data);
static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data);
@@ -44,7 +42,6 @@ static void indev_proc_reset_query_handler(lv_indev_t * indev);
static lv_obj_t * indev_search_obj(const lv_indev_proc_t * proc, lv_obj_t * obj);
static void indev_drag(lv_indev_proc_t * state);
static void indev_drag_throw(lv_indev_proc_t * proc);
#endif
/**********************
* STATIC VARIABLES
@@ -64,13 +61,61 @@ static lv_indev_t * indev_act;
*/
void lv_indev_init(void)
{
#if LV_INDEV_READ_PERIOD != 0
lv_task_create(indev_proc_task, LV_INDEV_READ_PERIOD, LV_TASK_PRIO_MID, NULL);
#endif
lv_indev_reset(NULL); /*Reset all input devices*/
}
/**
* Called periodically to read the input devices
* @param param pointer to and input device to read
*/
void lv_indev_read_task(void * param)
{
LV_LOG_TRACE("indev read task started");
lv_indev_data_t data;
indev_act = param;
/*Read and process all indevs*/
if(indev_act->driver.disp == NULL) return; /*Not assigned to any displays*/
/*Handle reset query before processing the point*/
indev_proc_reset_query_handler(indev_act);
if(indev_act->proc.disabled) return;
bool more_to_read;
do {
/*Read the data*/
more_to_read = lv_indev_read(indev_act, &data);
/*The active object might deleted even in the read function*/
indev_proc_reset_query_handler(indev_act);
indev_act->proc.state = data.state;
if(indev_act->proc.state == LV_INDEV_STATE_PR) {
indev_act->last_activity_time = lv_tick_get();
}
if(indev_act->driver.type == LV_INDEV_TYPE_POINTER) {
indev_pointer_proc(indev_act, &data);
} else if(indev_act->driver.type == LV_INDEV_TYPE_KEYPAD) {
indev_keypad_proc(indev_act, &data);
} else if(indev_act->driver.type == LV_INDEV_TYPE_ENCODER) {
indev_encoder_proc(indev_act, &data);
} else if(indev_act->driver.type == LV_INDEV_TYPE_BUTTON) {
indev_button_proc(indev_act, &data);
}
/*Handle reset query if it happened in during processing*/
indev_proc_reset_query_handler(indev_act);
} while(more_to_read);
/*End of indev processing, so no act indev*/
indev_act = NULL;
LV_LOG_TRACE("indev read task finished");
}
/**
* Get the currently processed input device. Can be used in action functions too.
* @return pointer to the currently processed input device or NULL if no input device processing right now
@@ -178,7 +223,7 @@ void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t * points)
*/
void lv_indev_set_feedback(lv_indev_t *indev, lv_indev_feedback_t feedback)
{
indev->feedback = feedback;
indev->feedback = feedback;
}
/**
@@ -272,7 +317,7 @@ uint32_t lv_indev_get_inactive_time(const lv_indev_t * indev)
*/
lv_indev_feedback_t lv_indev_get_feedback(const lv_indev_t *indev)
{
return indev->feedback;
return indev->feedback;
}
/**
@@ -284,67 +329,26 @@ void lv_indev_wait_release(lv_indev_t * indev)
indev->proc.wait_until_release = 1;
}
/**
* Get a pointer to the indev read task to
* modify its parameters with `lv_task_...` functions.
* @param indev pointer to an input device
* @return pointer to the indev read refresher task. (NULL on error)
*/
lv_task_t * lv_indev_get_read_task(lv_disp_t * indev)
{
if(!indev) {
LV_LOG_WARN("lv_indev_get_read_task: indev was NULL");
return NULL;
}
return indev->refr_task;
}
/**********************
* STATIC FUNCTIONS
**********************/
#if LV_INDEV_READ_PERIOD != 0
/**
* Called periodically to handle the input devices
* @param param unused
*/
static void indev_proc_task(void * param)
{
(void)param;
LV_LOG_TRACE("indev task started");
lv_indev_data_t data;
lv_indev_t * i;
i = lv_indev_next(NULL);
/*Read and process all indevs*/
while(i) {
if(i->driver.disp == NULL) continue; /*Not assigned to any displays*/
indev_act = i;
/*Handle reset query before processing the point*/
indev_proc_reset_query_handler(i);
if(i->proc.disabled == 0) {
bool more_to_read;
do {
/*Read the data*/
more_to_read = lv_indev_read(i, &data);
indev_proc_reset_query_handler(i); /*The active object might deleted even in the read function*/
i->proc.state = data.state;
if(i->proc.state == LV_INDEV_STATE_PR) {
i->last_activity_time = lv_tick_get();
}
if(i->driver.type == LV_INDEV_TYPE_POINTER) {
indev_pointer_proc(i, &data);
} else if(i->driver.type == LV_INDEV_TYPE_KEYPAD) {
indev_keypad_proc(i, &data);
} else if(i->driver.type == LV_INDEV_TYPE_ENCODER) {
indev_encoder_proc(i, &data);
} else if(i->driver.type == LV_INDEV_TYPE_BUTTON) {
indev_button_proc(i, &data);
}
/*Handle reset query if it happened in during processing*/
indev_proc_reset_query_handler(i);
} while(more_to_read);
}
i = lv_indev_next(i); /*Go to the next indev*/
}
indev_act = NULL; /*End of indev processing, so no act indev*/
LV_LOG_TRACE("indev task finished");
}
/**
* Process a new point from LV_INDEV_TYPE_POINTER input device
* @param i pointer to an input device
@@ -355,7 +359,7 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Move the cursor if set and moved*/
if(i->cursor != NULL &&
(i->proc.types.pointer.last_point.x != data->point.x ||
i->proc.types.pointer.last_point.y != data->point.y)) {
i->proc.types.pointer.last_point.y != data->point.y)) {
lv_obj_set_pos(i->cursor, data->point.x, data->point.y);
}
@@ -444,7 +448,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
else if(data->state == LV_INDEV_STATE_PR && prev_state == LV_INDEV_STATE_PR)
{
/*Long press time has elapsed?*/
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) {
if(i->proc.long_pr_sent == 0 && lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time) {
i->proc.long_pr_sent = 1;
if(data->key == LV_GROUP_KEY_ENTER) {
i->proc.longpr_rep_timestamp = lv_tick_get();
@@ -455,7 +459,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
}
}
/*Long press repeated time has elapsed?*/
else if(i->proc.long_pr_sent != 0 && lv_tick_elaps(i->proc.longpr_rep_timestamp) > LV_INDEV_LONG_PRESS_REP_TIME) {
else if(i->proc.long_pr_sent != 0 && lv_tick_elaps(i->proc.longpr_rep_timestamp) > i->driver.long_press_rep_time) {
i->proc.longpr_rep_timestamp = lv_tick_get();
@@ -583,7 +587,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
/*Pressing*/
else if(data->state == LV_INDEV_STATE_PR && i->proc.types.keypad.last_state == LV_INDEV_STATE_PR) {
if(i->proc.long_pr_sent == 0 &&
lv_tick_elaps(i->proc.pr_timestamp) > LV_INDEV_LONG_PRESS_TIME)
lv_tick_elaps(i->proc.pr_timestamp) > i->driver.long_press_time)
{
bool editable = false;
focused->signal_cb(focused, LV_SIGNAL_GET_EDITABLE, &editable);
@@ -800,7 +804,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
/*If there is no drag then check for long press time*/
if(proc->types.pointer.drag_in_prog == 0 && proc->long_pr_sent == 0) {
/*Send a signal about the long press if enough time elapsed*/
if(lv_tick_elaps(proc->pr_timestamp) > LV_INDEV_LONG_PRESS_TIME) {
if(lv_tick_elaps(proc->pr_timestamp) > indev_act->driver.long_press_time) {
pr_obj->signal_cb(pr_obj, LV_SIGNAL_LONG_PRESS, indev_act);
if(proc->reset_query) return; /*The object might be deleted*/
lv_event_send(pr_obj, LV_EVENT_LONG_PRESSED, NULL);
@@ -816,7 +820,7 @@ static void indev_proc_press(lv_indev_proc_t * proc)
/*Send long press repeated signal*/
if(proc->types.pointer.drag_in_prog == 0 && proc->long_pr_sent == 1) {
/*Send a signal about the long press repeate if enough time elapsed*/
if(lv_tick_elaps(proc->longpr_rep_timestamp) > LV_INDEV_LONG_PRESS_REP_TIME) {
if(lv_tick_elaps(proc->longpr_rep_timestamp) > indev_act->driver.long_press_rep_time) {
pr_obj->signal_cb(pr_obj, LV_SIGNAL_LONG_PRESS_REP, indev_act);
if(proc->reset_query) return; /*The object might be deleted*/
lv_event_send(pr_obj, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
@@ -1030,8 +1034,8 @@ static void indev_drag(lv_indev_proc_t * state)
/*Enough move?*/
if(state->types.pointer.drag_limit_out == 0) {
/*If a move is greater then LV_DRAG_LIMIT then begin the drag*/
if(LV_MATH_ABS(state->types.pointer.drag_sum.x) >= LV_INDEV_DRAG_LIMIT ||
LV_MATH_ABS(state->types.pointer.drag_sum.y) >= LV_INDEV_DRAG_LIMIT) {
if(LV_MATH_ABS(state->types.pointer.drag_sum.x) >= indev_act->driver.drag_limit ||
LV_MATH_ABS(state->types.pointer.drag_sum.y) >= indev_act->driver.drag_limit) {
state->types.pointer.drag_limit_out = 1;
}
}
@@ -1108,8 +1112,8 @@ static void indev_drag_throw(lv_indev_proc_t * proc)
}
/*Reduce the vectors*/
proc->types.pointer.drag_throw_vect.x = proc->types.pointer.drag_throw_vect.x * (100 - LV_INDEV_DRAG_THROW) / 100;
proc->types.pointer.drag_throw_vect.y = proc->types.pointer.drag_throw_vect.y * (100 - LV_INDEV_DRAG_THROW) / 100;
proc->types.pointer.drag_throw_vect.x = proc->types.pointer.drag_throw_vect.x * (100 - indev_act->driver.drag_throw) / 100;
proc->types.pointer.drag_throw_vect.y = proc->types.pointer.drag_throw_vect.y * (100 - indev_act->driver.drag_throw) / 100;
if(proc->types.pointer.drag_throw_vect.x != 0 ||
proc->types.pointer.drag_throw_vect.y != 0) {
@@ -1144,4 +1148,3 @@ static void indev_drag_throw(lv_indev_proc_t * proc)
}
}
#endif

View File

@@ -34,6 +34,12 @@ extern "C" {
*/
void lv_indev_init(void);
/**
* Called periodically to read the input devices
* @param param pointer to and input device to read
*/
void lv_indev_read_task(void * param);
/**
* Get the currently processed input device. Can be used in action functions too.
* @return pointer to the currently processed input device or NULL if no input device processing right now
@@ -145,6 +151,14 @@ lv_indev_feedback_t lv_indev_get_feedback(const lv_indev_t *indev);
*/
void lv_indev_wait_release(lv_indev_t * indev);
/**
* Get a pointer to the indev read task to
* modify its parameters with `lv_task_...` functions.
* @param indev pointer to an inout device
* @return pointer to the indev read refresher task. (NULL on error)
*/
lv_task_t * lv_indev_get_read_task(lv_disp_t * indev);
/**********************
* MACROS
**********************/

View File

@@ -292,7 +292,7 @@ static void lv_refr_area(const lv_area_t * area_p)
lv_coord_t y_tmp = max_row - 1;
do {
tmp.y2 = y_tmp;
disp_refr->driver.rounder_cb(&tmp);
disp_refr->driver.rounder_cb(&disp_refr->driver, &tmp);
/*If this height fits into `max_row` then fine*/
if(lv_area_get_height(&tmp) <= max_row) break;

View File

@@ -138,7 +138,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
disp_def = disp_def_tmp; /*Revert the default display*/
/*Create a refresh task*/
disp->refr_task = lv_task_create(lv_disp_refr_task, LV_REFR_PERIOD, LV_TASK_PRIO_MID, disp);
disp->refr_task = lv_task_create(lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, disp);
lv_mem_assert(disp->refr_task);
if(disp->refr_task == NULL) return NULL;
@@ -248,6 +248,20 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp)
#endif
}
/**
* Get the elapsed time since the last activity on a display.
* @param disp pointer to a display.
* @return the elapsed time since the last activity
*/
uint32_t lv_disp_get_inactive_time(lv_disp_t * disp)
{
if(disp == NULL) disp = lv_disp_get_default();
if(disp == NULL) return 0;
return disp->last_activity;
}
/**
* Call in the display driver's `flush_cb` function when the flushing is finished
* @param disp_drv pointer to display driver in `flush_cb` where this function is called

View File

@@ -129,6 +129,9 @@ typedef struct _disp_t {
lv_area_t inv_areas[LV_INV_BUF_SIZE];
uint8_t inv_area_joined[LV_INV_BUF_SIZE];
uint32_t inv_p :10;
/*Miscellaneous data*/
uint32_t last_activity;
} lv_disp_t;
/**********************
@@ -208,6 +211,13 @@ lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp);
*/
bool lv_disp_get_antialiasing(lv_disp_t * disp);
/**
* Get the elapsed time since the last activity on a display.
* @param disp pointer to a display.
* @return the elapsed time since the last activity
*/
uint32_t lv_disp_get_inactive_time(lv_disp_t * disp);
/**
* Call in the display driver's `flush_cb` function when the flushing is finished
* @param disp_drv pointer to display driver in `flush_cb` where this function is called

View File

@@ -9,6 +9,7 @@
* INCLUDES
*********************/
#include "../lv_hal/lv_hal_indev.h"
#include "../lv_core/lv_indev.h"
#include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_gc.h"
#include "lv_hal_disp.h"
@@ -53,6 +54,10 @@ void lv_indev_drv_init(lv_indev_drv_t * driver)
memset(driver, 0, sizeof(lv_indev_drv_t));
driver->type = LV_INDEV_TYPE_NONE;
driver->drag_limit = LV_INDEV_DEF_DRAG_LIMIT;
driver->drag_throw = LV_INDEV_DEF_DRAG_THROW;
driver->long_press_time = LV_INDEV_DEF_LONG_PRESS_TIME;
driver->long_press_rep_time = LV_INDEV_DEF_LONG_PRESS_REP_TIME;
}
/**
@@ -70,21 +75,23 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
return NULL;
}
lv_indev_t * node = lv_ll_ins_head(&LV_GC_ROOT(_lv_indev_ll));
if(!node) {
lv_mem_assert(node);
lv_indev_t * indev = lv_ll_ins_head(&LV_GC_ROOT(_lv_indev_ll));
if(!indev) {
lv_mem_assert(indev);
return NULL;
}
memset(node, 0, sizeof(lv_indev_t));
memcpy(&node->driver, driver, sizeof(lv_indev_drv_t));
memset(indev, 0, sizeof(lv_indev_t));
memcpy(&indev->driver, driver, sizeof(lv_indev_drv_t));
node->proc.reset_query = 1;
node->cursor = NULL;
node->group = NULL;
node->btn_points = NULL;
indev->proc.reset_query = 1;
indev->cursor = NULL;
indev->group = NULL;
indev->btn_points = NULL;
return node;
indev->driver.read_task = lv_task_create(lv_indev_read_task, LV_INDEV_DEF_READ_PERIOD, LV_TASK_PRIO_MID, indev);
return indev;
}
/**

View File

@@ -24,6 +24,7 @@ extern "C" {
#include <stdbool.h>
#include <stdint.h>
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_task.h"
/*********************
* DEFINES
@@ -68,17 +69,38 @@ typedef struct {
/*Initialized by the user and registered by 'lv_indev_add()'*/
typedef struct _lv_indev_drv_t {
lv_indev_type_t type; /*Input device type*/
bool (*read_cb)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t *data); /*Function pointer to read_cb data. Return 'true' if there is still data to be read_cb (buffered)*/
/*Input device type*/
lv_indev_type_t type;
/*Function pointer to read_cb data. Return 'true' if there is still data to be read_cb (buffered)*/
bool (*read_cb)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t *data);
#if LV_USE_USER_DATA_MULTI
lv_indev_drv_user_data_t read_user_data; /*Pointer to user defined data, passed in 'lv_indev_data_t' on read*/
lv_indev_drv_user_data_t read_user_data;
#endif
#if LV_USE_USER_DATA_SINGLE
lv_indev_drv_user_data_t user_data;
#endif
struct _disp_t * disp; /*Pointer to the assigned display*/
/*Pointer to the assigned display*/
struct _disp_t * disp;
/*Task to read the periodically read the input device*/
lv_task_t * read_task;
/*Number of pixels to slide before actually drag the object*/
uint8_t drag_limit;
/*Drag throw slow-down in [%]. Greater value means faster slow-down */
uint8_t drag_throw;
/*Long press time in milliseconds*/
uint16_t long_press_time;
/*Repeated trigger period in long press [ms] */
uint16_t long_press_rep_time;
} lv_indev_drv_t;
@@ -90,7 +112,7 @@ typedef struct _lv_indev_proc_t {
lv_point_t act_point;
lv_point_t last_point;
lv_point_t vect;
lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DRAG_LIMIT*/
lv_point_t drag_sum; /*Count the dragged pixels to check LV_INDEV_DEF_DRAG_LIMIT*/
lv_point_t drag_throw_vect;
struct _lv_obj_t * act_obj; /*The object being pressed*/
struct _lv_obj_t * last_obj; /*The last obejct which was pressed (used by dragthrow and other post-release event)*/

View File

@@ -58,7 +58,7 @@ void lv_anim_init(void)
{
lv_ll_init(&LV_GC_ROOT(_lv_anim_ll), sizeof(lv_anim_t));
last_task_run = lv_tick_get();
lv_task_create(anim_task, LV_REFR_PERIOD, LV_TASK_PRIO_MID, NULL);
lv_task_create(anim_task, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, NULL);
}
/**

View File

@@ -307,7 +307,7 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
if(indev) {
lv_point_t p = {0,0};
lv_indev_get_point(indev, &p);
if(LV_MATH_ABS(p.x - ext->start_x) > LV_INDEV_DRAG_LIMIT) ext->slided = 1;
if(LV_MATH_ABS(p.x - ext->start_x) > LV_INDEV_DEF_DRAG_LIMIT) ext->slided = 1;
}
/*If didn't slide then revert the min/max value. So click without slide won't move the switch as a slider*/

View File

@@ -735,7 +735,7 @@ static void tabpage_pressing_handler(lv_obj_t * tabview, lv_obj_t * tabpage)
lv_coord_t y_diff = point_act.y - ext->point_last.y;
if(!ext->scroll_ver && (x_diff >= LV_INDEV_DRAG_LIMIT || x_diff <= -LV_INDEV_DRAG_LIMIT)) {
if(!ext->scroll_ver && (x_diff >= LV_INDEV_DEF_DRAG_LIMIT || x_diff <= -LV_INDEV_DEF_DRAG_LIMIT)) {
ext->draging = 1;
/*Check if the page is on the edge */
if((lv_page_on_edge(tabpage, LV_PAGE_EDGE_LEFT) && x_diff > 0) ||
@@ -750,7 +750,7 @@ static void tabpage_pressing_handler(lv_obj_t * tabview, lv_obj_t * tabpage)
} else if(ext->drag_hor == 0) {
ext->drag_hor = 0;
}
} else if(y_diff >= LV_INDEV_DRAG_LIMIT || y_diff <= -LV_INDEV_DRAG_LIMIT) {
} else if(y_diff >= LV_INDEV_DEF_DRAG_LIMIT || y_diff <= -LV_INDEV_DEF_DRAG_LIMIT) {
ext->drag_hor = 0;
ext->draging = 1;
ext->scroll_ver = 1;
@@ -795,7 +795,7 @@ static void tabpage_press_lost_handler(lv_obj_t * tabview, lv_obj_t * tabpage)
while(vect.x != 0) {
x_predict += vect.x;
vect.x = vect.x * (100 - LV_INDEV_DRAG_THROW) / 100;
vect.x = vect.x * (100 - LV_INDEV_DEF_DRAG_THROW) / 100;
}
lv_coord_t page_x1 = tabpage->coords.x1 - tabview->coords.x1 + x_predict;

View File

@@ -361,14 +361,14 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
/*Set horizontal drag constraint if no vertical constraint an dragged to valid x direction */
if(ext->drag_ver == 0 &&
((ext->drag_right_en && indev->proc.types.pointer.drag_sum.x <= -LV_INDEV_DRAG_LIMIT) ||
(ext->drag_left_en && indev->proc.types.pointer.drag_sum.x >= LV_INDEV_DRAG_LIMIT))) {
((ext->drag_right_en && indev->proc.types.pointer.drag_sum.x <= -LV_INDEV_DEF_DRAG_LIMIT) ||
(ext->drag_left_en && indev->proc.types.pointer.drag_sum.x >= LV_INDEV_DEF_DRAG_LIMIT))) {
ext->drag_hor = 1;
}
/*Set vertical drag constraint if no horizontal constraint an dragged to valid y direction */
if(ext->drag_hor == 0 &&
((ext->drag_bottom_en && indev->proc.types.pointer.drag_sum.y <= -LV_INDEV_DRAG_LIMIT) ||
(ext->drag_top_en && indev->proc.types.pointer.drag_sum.y >= LV_INDEV_DRAG_LIMIT))) {
((ext->drag_bottom_en && indev->proc.types.pointer.drag_sum.y <= -LV_INDEV_DEF_DRAG_LIMIT) ||
(ext->drag_top_en && indev->proc.types.pointer.drag_sum.y >= LV_INDEV_DEF_DRAG_LIMIT))) {
ext->drag_ver = 1;
}
@@ -493,7 +493,7 @@ static void drag_end_handler(lv_obj_t * tileview)
while(vect.x != 0) {
predict += vect.x;
vect.x = vect.x * (100 - LV_INDEV_DRAG_THROW) / 100;
vect.x = vect.x * (100 - LV_INDEV_DEF_DRAG_THROW) / 100;
}
p.x -= predict;
@@ -505,7 +505,7 @@ static void drag_end_handler(lv_obj_t * tileview)
while(vect.y != 0) {
predict += vect.y;
vect.y = vect.y * (100 - LV_INDEV_DRAG_THROW) / 100;
vect.y = vect.y * (100 - LV_INDEV_DEF_DRAG_THROW) / 100;
}
p.y -= predict;