BigW Consortium Gitlab

Commit f8b4dc3a by Gabor Kiss-Vamosi

merge beta

parents 3a35da8f 9e20b3a1
...@@ -36,6 +36,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data); ...@@ -36,6 +36,7 @@ static void indev_keypad_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);
static void indev_proc_press(lv_indev_proc_t * proc); static void indev_proc_press(lv_indev_proc_t * proc);
static void indev_proc_release(lv_indev_proc_t * proc); static void indev_proc_release(lv_indev_proc_t * proc);
static void indev_proc_reset_query_handler(lv_indev_t * indev);
static lv_obj_t * indev_search_obj(const lv_indev_proc_t * indev, lv_obj_t * obj); static lv_obj_t * indev_search_obj(const lv_indev_proc_t * indev, lv_obj_t * obj);
static void indev_drag(lv_indev_proc_t * state); static void indev_drag(lv_indev_proc_t * state);
static void indev_drag_throw(lv_indev_proc_t * state); static void indev_drag_throw(lv_indev_proc_t * state);
...@@ -251,54 +252,32 @@ static void indev_proc_task(void * param) ...@@ -251,54 +252,32 @@ static void indev_proc_task(void * param)
indev_act = i; indev_act = i;
/*Handle reset query before processing the point*/ /*Handle reset query before processing the point*/
if(i->proc.reset_query) { indev_proc_reset_query_handler(i);
i->proc.act_obj = NULL;
i->proc.last_obj = NULL;
i->proc.drag_range_out = 0;
i->proc.drag_in_prog = 0;
i->proc.long_pr_sent = 0;
i->proc.pr_timestamp = 0;
i->proc.longpr_rep_timestamp = 0;
i->proc.drag_sum.x = 0;
i->proc.drag_sum.y = 0;
i->proc.reset_query = 0;
}
if(i->proc.disabled == 0) { if(i->proc.disabled == 0) {
/*Read the data*/ bool more_to_read;
lv_indev_read(i, &data); do {
i->proc.state = data.state; /*Read the data*/
more_to_read = lv_indev_read(i, &data);
if(i->proc.state == LV_INDEV_STATE_PR) { i->proc.state = data.state;
i->last_activity_time = lv_tick_get();
} 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_BUTTON) {
indev_button_proc(i, &data);
}
}
/*Handle reset query if it happened in during processing*/ if(i->driver.type == LV_INDEV_TYPE_POINTER) {
if(i->proc.reset_query) { indev_pointer_proc(i,&data);
i->proc.act_obj = NULL; }
i->proc.last_obj = NULL; else if(i->driver.type == LV_INDEV_TYPE_KEYPAD) {
i->proc.drag_range_out = 0; indev_keypad_proc(i, &data);
i->proc.drag_in_prog = 0; }
i->proc.long_pr_sent = 0; else if(i->driver.type == LV_INDEV_TYPE_BUTTON) {
i->proc.pr_timestamp = 0; indev_button_proc(i, &data);
i->proc.longpr_rep_timestamp = 0; }
i->proc.drag_sum.x = 0; /*Handle reset query if it happened in during processing*/
i->proc.drag_sum.y = 0; indev_proc_reset_query_handler(i);
i->proc.reset_query = 0; } while(more_to_read);
} }
i = lv_indev_next(i); /*Go to the next indev*/ i = lv_indev_next(i); /*Go to the next indev*/
} }
...@@ -395,10 +374,12 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data) ...@@ -395,10 +374,12 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
#endif #endif
} }
/** /**
* Process a new point from LV_INDEV_TYPE_BUTTON input device * Process new points from a input device. indev->state.pressed has to be set
* @param i pointer to an input device * @param indev pointer to an input device state
* @param data pointer to the data read from the input device * @param x x coordinate of the next point
* @param y y coordinate of the next point
*/ */
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)
{ {
...@@ -571,6 +552,28 @@ static void indev_proc_release(lv_indev_proc_t * proc) ...@@ -571,6 +552,28 @@ static void indev_proc_release(lv_indev_proc_t * proc)
} }
/** /**
* Process a new point from LV_INDEV_TYPE_BUTTON input device
* @param i pointer to an input device
* @param data pointer to the data read from the input device
* Reset input device if a reset query has been sent to it
* @param indev pointer to an input device
*/
static void indev_proc_reset_query_handler(lv_indev_t * indev)
{
if(indev->proc.reset_query) {
indev->proc.act_obj = NULL;
indev->proc.last_obj = NULL;
indev->proc.drag_range_out = 0;
indev->proc.drag_in_prog = 0;
indev->proc.long_pr_sent = 0;
indev->proc.pr_timestamp = 0;
indev->proc.longpr_rep_timestamp = 0;
indev->proc.drag_sum.x = 0;
indev->proc.drag_sum.y = 0;
indev->proc.reset_query = 0;
}
}
/**
* Search the most top, clickable object on the last point of an input device * Search the most top, clickable object on the last point of an input device
* @param indev pointer to an input device * @param indev pointer to an input device
* @param obj pointer to a start object, typically the screen * @param obj pointer to a start object, typically the screen
......
...@@ -36,7 +36,6 @@ static bool anim_ready_handler(lv_anim_t * a); ...@@ -36,7 +36,6 @@ static bool anim_ready_handler(lv_anim_t * a);
**********************/ **********************/
static lv_ll_t anim_ll; static lv_ll_t anim_ll;
static uint32_t last_task_run; static uint32_t last_task_run;
static bool anim_del_global_flag = false;
/********************** /**********************
* MACROS * MACROS
...@@ -51,9 +50,9 @@ static bool anim_del_global_flag = false; ...@@ -51,9 +50,9 @@ static bool anim_del_global_flag = false;
*/ */
void lv_anim_init(void) void lv_anim_init(void)
{ {
lv_ll_init(&anim_ll, sizeof(lv_anim_t)); lv_ll_init(&anim_ll, sizeof(lv_anim_t));
last_task_run = lv_tick_get(); 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_REFR_PERIOD, LV_TASK_PRIO_MID, NULL);
} }
/** /**
...@@ -65,16 +64,16 @@ void lv_anim_create(lv_anim_t * anim_p) ...@@ -65,16 +64,16 @@ void lv_anim_create(lv_anim_t * anim_p)
/* Do not let two animations for the same 'var' with the same 'fp'*/ /* Do not let two animations for the same 'var' with the same 'fp'*/
if(anim_p->fp != NULL) lv_anim_del(anim_p->var, anim_p->fp); /*fp == NULL would delete all animations of var*/ if(anim_p->fp != NULL) lv_anim_del(anim_p->var, anim_p->fp); /*fp == NULL would delete all animations of var*/
/*Add the new animation to the animation linked list*/ /*Add the new animation to the animation linked list*/
lv_anim_t * new_anim = lv_ll_ins_head(&anim_ll); lv_anim_t * new_anim = lv_ll_ins_head(&anim_ll);
lv_mem_assert(new_anim); lv_mem_assert(new_anim);
/*Initialize the animation descriptor*/ /*Initialize the animation descriptor*/
anim_p->playback_now = 0; anim_p->playback_now = 0;
memcpy(new_anim, anim_p, sizeof(lv_anim_t)); memcpy(new_anim, anim_p, sizeof(lv_anim_t));
/*Set the start value*/ /*Set the start value*/
if(new_anim->fp != NULL) new_anim->fp(new_anim->var, new_anim->start); if(new_anim->fp != NULL) new_anim->fp(new_anim->var, new_anim->start);
} }
/** /**
...@@ -86,25 +85,24 @@ void lv_anim_create(lv_anim_t * anim_p) ...@@ -86,25 +85,24 @@ void lv_anim_create(lv_anim_t * anim_p)
*/ */
bool lv_anim_del(void * var, lv_anim_fp_t fp) bool lv_anim_del(void * var, lv_anim_fp_t fp)
{ {
bool del = false; bool del = false;
lv_anim_t * a; lv_anim_t * a;
lv_anim_t * a_next; lv_anim_t * a_next;
a = lv_ll_get_head(&anim_ll); a = lv_ll_get_head(&anim_ll);
while(a != NULL) { while(a != NULL) {
/*'a' might be deleted, so get the next object while 'a' is valid*/ /*'a' might be deleted, so get the next object while 'a' is valid*/
a_next = lv_ll_get_next(&anim_ll, a); a_next = lv_ll_get_next(&anim_ll, a);
if(a->var == var && (a->fp == fp || fp == NULL)) { if(a->var == var && (a->fp == fp || fp == NULL)) {
lv_ll_rem(&anim_ll, a); lv_ll_rem(&anim_ll, a);
lv_mem_free(a); lv_mem_free(a);
del = true; del = true;
anim_del_global_flag = true; }
}
a = a_next;
a = a_next; }
}
return del;
return del;
} }
/** /**
...@@ -116,14 +114,14 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp) ...@@ -116,14 +114,14 @@ bool lv_anim_del(void * var, lv_anim_fp_t fp)
*/ */
uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end) uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
{ {
int32_t d = LV_MATH_ABS((int32_t) start - end); int32_t d = LV_MATH_ABS((int32_t) start - end);
uint16_t time = (int32_t)((int32_t)(d * 1000) / speed); uint16_t time = (int32_t)((int32_t)(d * 1000) / speed);
if(time == 0) { if(time == 0) {
time++; time++;
} }
return time; return time;
} }
/** /**
...@@ -174,39 +172,39 @@ static void anim_task (void * param) ...@@ -174,39 +172,39 @@ static void anim_task (void * param)
{ {
(void)param; (void)param;
volatile uint32_t elaps; volatile uint32_t elaps;
elaps = lv_tick_elaps(last_task_run); elaps = lv_tick_elaps(last_task_run);
lv_anim_t * a; lv_anim_t * a;
lv_anim_t * a_next; lv_anim_t * a_next;
a = lv_ll_get_head(&anim_ll); a = lv_ll_get_head(&anim_ll);
while(a != NULL) { while(a != NULL) {
/*'a' might be deleted, so get the next object while 'a' is valid*/ /*'a' might be deleted, so get the next object while 'a' is valid*/
a_next = lv_ll_get_next(&anim_ll, a); a_next = lv_ll_get_next(&anim_ll, a);
a->act_time += elaps; a->act_time += elaps;
if(a->act_time >= 0) { if(a->act_time >= 0) {
if(a->act_time > a->time) a->act_time = a->time; if(a->act_time > a->time) a->act_time = a->time;
int32_t new_value; int32_t new_value;
new_value = a->path(a); new_value = a->path(a);
if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/ if(a->fp != NULL) a->fp(a->var, new_value); /*Apply the calculated value*/
/*If the time is elapsed the animation is ready*/ /*If the time is elapsed the animation is ready*/
if(a->act_time >= a->time) { if(a->act_time >= a->time) {
bool invalid; bool invalid;
invalid = anim_ready_handler(a); invalid = anim_ready_handler(a);
if(invalid != false) { if(invalid != false) {
a_next = lv_ll_get_head(&anim_ll); /*a_next might be invalid if animation delete occurred*/ a_next = lv_ll_get_head(&anim_ll); /*a_next might be invalid if animation delete occurred*/
} }
} }
} }
a = a_next; a = a_next;
} }
last_task_run = lv_tick_get(); last_task_run = lv_tick_get();
} }
/** /**
...@@ -217,43 +215,42 @@ static void anim_task (void * param) ...@@ -217,43 +215,42 @@ static void anim_task (void * param)
* */ * */
static bool anim_ready_handler(lv_anim_t * a) static bool anim_ready_handler(lv_anim_t * a)
{ {
bool invalid = false; bool invalid = false;
/*Delete the animation if /*Delete the animation if
* - no repeat and no play back (simple one shot animation) * - no repeat and no play back (simple one shot animation)
* - no repeat, play back is enabled and play back is ready */ * - no repeat, play back is enabled and play back is ready */
if((a->repeat == 0 && a->playback == 0) || if((a->repeat == 0 && a->playback == 0) ||
(a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) { (a->repeat == 0 && a->playback == 1 && a->playback_now == 1)) {
void (*cb) (void *) = a->end_cb; void (*cb) (void *) = a->end_cb;
void * p = a->var; void * p = a->var;
lv_ll_rem(&anim_ll, a); lv_ll_rem(&anim_ll, a);
lv_mem_free(a); lv_mem_free(a);
/*Call the callback function at the end*/ /*Call the callback function at the end*/
/* Check if an animation is deleted in the cb function /* Check if an animation is deleted in the cb function
* if yes then the caller function has to know this*/ * if yes then the caller function has to know this*/
anim_del_global_flag = false; if(cb != NULL) cb(p);
if(cb != NULL) cb(p); invalid = true;
invalid = anim_del_global_flag; }
} /*If the animation is not deleted then restart it*/
/*If the animation is not deleted then restart it*/ else {
else { a->act_time = - a->repeat_pause; /*Restart the animation*/
a->act_time = - a->repeat_pause; /*Restart the animation*/ /*Swap the start and end values in play back mode*/
/*Swap the start and end values in play back mode*/ if(a->playback != 0) {
if(a->playback != 0) { /*If now turning back use the 'playback_pause*/
/*If now turning back use the 'playback_pause*/ if(a->playback_now == 0) a->act_time = - a->playback_pause;
if(a->playback_now == 0) a->act_time = - a->playback_pause;
/*Toggle the play back state*/
/*Toggle the play back state*/ a->playback_now = a->playback_now == 0 ? 1: 0;
a->playback_now = a->playback_now == 0 ? 1: 0; /*Swap the start and end values*/
/*Swap the start and end values*/ int32_t tmp;
int32_t tmp; tmp = a->start;
tmp = a->start; a->start = a->end;
a->start = a->end; a->end = tmp;
a->end = tmp; }
} }
}
return invalid;
return invalid;
} }
#endif #endif
...@@ -89,6 +89,36 @@ void * lv_ll_ins_head(lv_ll_t * ll_p) ...@@ -89,6 +89,36 @@ void * lv_ll_ins_head(lv_ll_t * ll_p)
} }
/** /**
* Insert a new node in front of the n_act node
* @param ll_p pointer to linked list
* @param n_act pointer a node
* @return pointer to the new head
*/
void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act)
{
lv_ll_node_t* n_new;
lv_ll_node_t* n_prev;
if(NULL == ll_p || NULL == n_act) return NULL;
if(lv_ll_get_head(ll_p) == n_act) {
n_new = lv_ll_ins_head(ll_p);
}
else {
n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE);
lv_mem_assert(n_new);
n_prev = lv_ll_get_prev(ll_p, n_act);
node_set_next(ll_p, n_prev, n_new);
node_set_prev(ll_p, n_new, n_prev);
node_set_prev(ll_p, n_act, n_new);
node_set_next(ll_p, n_new, n_act);
}
return n_new;
}
/**
* Add a new tail to a linked list * Add a new tail to a linked list
* @param ll_p pointer to linked list * @param ll_p pointer to linked list
* @return pointer to the new tail * @return pointer to the new tail
......
...@@ -56,6 +56,14 @@ void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size); ...@@ -56,6 +56,14 @@ void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size);
void * lv_ll_ins_head(lv_ll_t * ll_p); void * lv_ll_ins_head(lv_ll_t * ll_p);
/** /**
* Insert a new node in front of the n_act node
* @param ll_p pointer to linked list
* @param n_act pointer a node
* @return pointer to the new head
*/
void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act);
/**
* Add a new tail to a linked list * Add a new tail to a linked list
* @param ll_p pointer to linked list * @param ll_p pointer to linked list
* @return pointer to the new tail * @return pointer to the new tail
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static bool lv_task_exec(lv_task_t* lv_task_p, lv_task_prio_t prio_act); static bool lv_task_exec (lv_task_t* lv_task_p);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
...@@ -65,50 +65,47 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void) ...@@ -65,50 +65,47 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
handler_start = lv_tick_get(); handler_start = lv_tick_get();
lv_task_t* lv_task_prio_a[LV_TASK_PRIO_NUM]; /*Lists for all prio.*/ /* Run all task from the highest to the lowest priority
lv_task_prio_t prio_act; * If a lower priority task is executed check task again from the highest priority
bool prio_reset = false; /*Used to go back to the highest priority*/ * but on the priority of executed tasks don't run tasks before the executed*/
lv_task_t* lv_task_next; lv_task_t * task_interruper = NULL;
lv_task_t * tmp;
/*Init. the lists*/ bool end_flag;
for(prio_act = LV_TASK_PRIO_LOWEST; prio_act <= LV_TASK_PRIO_HIGHEST; prio_act++) { do {
lv_task_prio_a[prio_act] = lv_ll_get_head(&lv_task_ll); end_flag = true;
} LL_READ(lv_task_ll,tmp){
/*Handle the lv_tasks on all priority*/ /*Here is the interrupter task. Don't execute it again.*/
for(prio_act = LV_TASK_PRIO_HIGHEST; prio_act > LV_TASK_PRIO_OFF; prio_act --) { if(tmp == task_interruper) {
/*Reset the prio. if necessary*/ task_interruper = NULL; /*From this point only task after the interrupter comes, so the interrupter is not interesting anymore*/
if(prio_reset != false) { continue;
prio_reset = false; }
prio_act = LV_TASK_PRIO_HIGHEST; /*Go again with highest prio */
} /*Just try to run the tasks with highest priority.*/
if(tmp->prio == LV_TASK_PRIO_HIGHEST) {
/* Read all lv_task on 'prio_act' but stop on 'prio_reset' */ lv_task_exec(tmp);
while(lv_task_prio_a[prio_act] != NULL && prio_reset == false) { }
/* Get the next task. (Invalid pointer if a lv_task deletes itself)*/ /*Tasks with higher priority then the interrupted shall be run in every case*/
lv_task_next = lv_ll_get_next(&lv_task_ll, lv_task_prio_a[prio_act]); else if(task_interruper) {
if(tmp->prio > task_interruper->prio) {
/*Execute the current lv_task*/ if(lv_task_exec(tmp)) {
bool executed = lv_task_exec(lv_task_prio_a[prio_act], prio_act); task_interruper = tmp; /*Check all tasks again from the highest priority */
if(executed != false) { /*If the task is executed*/ end_flag = false;
/* During the execution higher priority lv_tasks break;
* can be ready, so reset the priority if it is not highest*/ }
if(prio_act != LV_TASK_PRIO_HIGHEST) { }
prio_reset = true; }
} /* It is no interrupter task or we already reached it earlier.
} * Just run the remaining tasks*/
else {
lv_task_prio_a[prio_act] = lv_task_next; /*Load the next task*/ if(lv_task_exec(tmp)) {
} task_interruper = tmp; /*Check all tasks again from the highest priority */
end_flag = false;
/*Reset higher priority lists on 'prio_reset' query*/ break;
if(prio_reset != false) { }
for(prio_act = prio_act + 1; prio_act <= LV_TASK_PRIO_HIGHEST; prio_act++) { }
lv_task_prio_a[prio_act] = lv_ll_get_head(&lv_task_ll); }
} } while(!end_flag);
}
}
busy_time += lv_tick_elaps(handler_start); busy_time += lv_tick_elaps(handler_start);
uint32_t idle_period_time = lv_tick_elaps(idle_period_start); uint32_t idle_period_time = lv_tick_elaps(idle_period_start);
...@@ -134,10 +131,29 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void) ...@@ -134,10 +131,29 @@ LV_ATTRIBUTE_TASK_HANDLER void lv_task_handler(void)
lv_task_t* lv_task_create(void (*task) (void *), uint32_t period, lv_task_prio_t prio, void * param) lv_task_t* lv_task_create(void (*task) (void *), uint32_t period, lv_task_prio_t prio, void * param)
{ {
lv_task_t* new_lv_task; lv_task_t* new_lv_task;
lv_task_t* tmp;
new_lv_task = lv_ll_ins_head(&lv_task_ll);
/*Create task lists in order of priority from high to low*/
tmp = lv_ll_get_head(&lv_task_ll);
if(NULL == tmp) { /*First task*/
new_lv_task = lv_ll_ins_head(&lv_task_ll);
}
else{
do{
if(tmp->prio <= prio){
new_lv_task = lv_ll_ins_prev(&lv_task_ll, tmp);
break;
}
tmp = lv_ll_get_next(&lv_task_ll,tmp);
}while(tmp != NULL);
if(tmp == NULL) { /*Only too high priority tasks were found*/
new_lv_task = lv_ll_ins_tail(&lv_task_ll);
}
}
lv_mem_assert(new_lv_task); lv_mem_assert(new_lv_task);
new_lv_task->period = period; new_lv_task->period = period;
new_lv_task->task = task; new_lv_task->task = task;
new_lv_task->prio = prio; new_lv_task->prio = prio;
...@@ -146,6 +162,7 @@ lv_task_t* lv_task_create(void (*task) (void *), uint32_t period, lv_task_prio_t ...@@ -146,6 +162,7 @@ lv_task_t* lv_task_create(void (*task) (void *), uint32_t period, lv_task_prio_t
new_lv_task->last_run = lv_tick_get(); new_lv_task->last_run = lv_tick_get();
return new_lv_task; return new_lv_task;
} }
/** /**
...@@ -166,7 +183,15 @@ void lv_task_del(lv_task_t* lv_task_p) ...@@ -166,7 +183,15 @@ void lv_task_del(lv_task_t* lv_task_p)
*/ */
void lv_task_set_prio(lv_task_t* lv_task_p, lv_task_prio_t prio) void lv_task_set_prio(lv_task_t* lv_task_p, lv_task_prio_t prio)
{ {
lv_task_p->prio = prio; /*It's easier to create a new task with the new priority rather then modify the linked list*/
lv_task_t * new_task = lv_task_create(lv_task_p->task, lv_task_p->period, prio, lv_task_p->param);
lv_mem_assert(new_task);
new_task->once = lv_task_p->once;
new_task->last_run = lv_task_p->last_run;
/*Delete the old task*/
lv_ll_rem(&lv_task_ll, lv_task_p);
lv_mem_free(lv_task_p);
} }
/** /**
...@@ -233,26 +258,22 @@ uint8_t lv_task_get_idle(void) ...@@ -233,26 +258,22 @@ uint8_t lv_task_get_idle(void)
/** /**
* Execute task if its the priority is appropriate * Execute task if its the priority is appropriate
* @param lv_task_p pointer to lv_task * @param lv_task_p pointer to lv_task
* @param prio_act the current priority
* @return true: execute, false: not executed * @return true: execute, false: not executed
*/ */
static bool lv_task_exec (lv_task_t* lv_task_p, lv_task_prio_t prio_act) static bool lv_task_exec (lv_task_t* lv_task_p)
{ {
bool exec = false; bool exec = false;
/*Execute lv_task if its prio is 'prio_act'*/ /*Execute if at least 'period' time elapsed*/
if(lv_task_p->prio == prio_act) { uint32_t elp = lv_tick_elaps(lv_task_p->last_run);
/*Execute if at least 'period' time elapsed*/ if(elp >= lv_task_p->period) {
uint32_t elp = lv_tick_elaps(lv_task_p->last_run); lv_task_p->last_run = lv_tick_get();
if(elp >= lv_task_p->period) { lv_task_p->task(lv_task_p->param);
lv_task_p->last_run = lv_tick_get();
lv_task_p->task(lv_task_p->param); /*Delete if it was a one shot lv_task*/
if(lv_task_p->once != 0) lv_task_del(lv_task_p);
/*Delete if it was a one shot lv_task*/
if(lv_task_p->once != 0) lv_task_del(lv_task_p); exec = true;
exec = true;
}
} }
return exec; return exec;
......
/** /**
* @file lv_gauge.c * @file lv_gauge.c
* *
*/ */
...@@ -65,7 +65,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -65,7 +65,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
/*Create the ancestor gauge*/ /*Create the ancestor gauge*/
lv_obj_t * new_gauge = lv_lmeter_create(par, copy); lv_obj_t * new_gauge = lv_lmeter_create(par, copy);
lv_mem_assert(new_gauge); lv_mem_assert(new_gauge);
/*Allocate the gauge type specific extended data*/ /*Allocate the gauge type specific extended data*/
lv_gauge_ext_t * ext = lv_obj_allocate_ext_attr(new_gauge, sizeof(lv_gauge_ext_t)); lv_gauge_ext_t * ext = lv_obj_allocate_ext_attr(new_gauge, sizeof(lv_gauge_ext_t));
lv_mem_assert(ext); lv_mem_assert(ext);
...@@ -106,11 +106,11 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -106,11 +106,11 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
for(i = 0; i < ext->needle_count; i++) { for(i = 0; i < ext->needle_count; i++) {
ext->values[i] = copy_ext->values[i]; ext->values[i] = copy_ext->values[i];
} }
ext->label_count = copy_ext->label_count;
/*Refresh the style with new signal function*/ /*Refresh the style with new signal function*/
lv_obj_refresh_style(new_gauge); lv_obj_refresh_style(new_gauge);
} }
return new_gauge; return new_gauge;
} }
......
/** /**
* @file lv_kb.c * @file lv_kb.c
* *
*/ */
/********************* /*********************
...@@ -80,7 +80,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -80,7 +80,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * new_kb = lv_btnm_create(par, copy); lv_obj_t * new_kb = lv_btnm_create(par, copy);
lv_mem_assert(new_kb); lv_mem_assert(new_kb);
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_kb); if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_kb);
/*Allocate the keyboard type specific extended data*/ /*Allocate the keyboard type specific extended data*/
lv_kb_ext_t * ext = lv_obj_allocate_ext_attr(new_kb, sizeof(lv_kb_ext_t)); lv_kb_ext_t * ext = lv_obj_allocate_ext_attr(new_kb, sizeof(lv_kb_ext_t));
lv_mem_assert(ext); lv_mem_assert(ext);
...@@ -128,7 +128,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -128,7 +128,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
/*Refresh the style with new signal function*/ /*Refresh the style with new signal function*/
lv_obj_refresh_style(new_kb); lv_obj_refresh_style(new_kb);
} }
return new_kb; return new_kb;
} }
...@@ -186,7 +186,12 @@ void lv_kb_set_cursor_manage(lv_obj_t * kb, bool en) ...@@ -186,7 +186,12 @@ void lv_kb_set_cursor_manage(lv_obj_t * kb, bool en)
if(ext->ta) { if(ext->ta) {
lv_cursor_type_t cur_type; lv_cursor_type_t cur_type;
cur_type = lv_ta_get_cursor_type(ext->ta); cur_type = lv_ta_get_cursor_type(ext->ta);
lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN));
if(ext->cursor_mng){
lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN));
}else{
lv_ta_set_cursor_type(ext->ta, cur_type | LV_CURSOR_HIDDEN);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment