From 612c618240516d267170c69cd975f4db678718a1 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Fri, 2 Nov 2018 14:21:10 +0100 Subject: [PATCH] minor fixes --- lv_objx/lv_spinbox.c | 22 +++++++--------------- lv_objx/lv_spinbox.h | 11 ++--------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/lv_objx/lv_spinbox.c b/lv_objx/lv_spinbox.c index a2ca5e882..780b27c5d 100644 --- a/lv_objx/lv_spinbox.c +++ b/lv_objx/lv_spinbox.c @@ -3,13 +3,6 @@ * */ -/* TODO Remove these instructions - * Search an replace: spinbox -> object normal name with lower case (e.g. button, label etc.) - * templ -> object short name with lower case(e.g. btn, label etc) - * TEMPL -> object short name with upper case (e.g. BTN, LABEL etc.) - * - */ - /********************* * INCLUDES *********************/ @@ -59,7 +52,6 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy) LV_LOG_TRACE("spinbox create started"); /*Create the ancestor of spinbox*/ - /*TODO modify it to the ancestor create function */ lv_obj_t * new_spinbox = lv_ta_create(par, copy); lv_mem_assert(new_spinbox); if(new_spinbox == NULL) return NULL; @@ -71,7 +63,7 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy) if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_spinbox); if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_func(new_spinbox); - /*Initialize the allocated 'ext' */ + /*Initialize the allocated 'ext'*/ ext->ta.one_line = 1; ext->ta.pwd_mode = 0; ext->ta.accapted_chars = "1234567890+-."; @@ -84,7 +76,7 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy) ext->rangeMax = 99999; ext->rangeMin = -99999; - lv_ta_set_cursor_type(new_spinbox, LV_CURSOR_BLOCK | LV_CURSOR_HIDDEN); //hidden by default + lv_ta_set_cursor_type(new_spinbox, LV_CURSOR_BLOCK | LV_CURSOR_HIDDEN); /*hidden by default*/ lv_ta_set_cursor_pos(new_spinbox, 4); @@ -358,11 +350,11 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p { if(ext->valueDigit - ext->step >= ext->rangeMin) { - //Special mode when zero crossing + /*Special mode when zero crossing*/ if((ext->valueDigit - ext->step) < 0 && ext->valueDigit > 0) { ext->valueDigit = -ext->valueDigit; - }//end special mode + }/*end special mode*/ ext->valueDigit -= ext->step; } @@ -374,11 +366,11 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p { if(ext->valueDigit + ext->step <= ext->rangeMax) { - //Special mode when zero crossing + /*Special mode when zero crossing*/ if((ext->valueDigit + ext->step) > 0 && ext->valueDigit < 0) { ext->valueDigit = -ext->valueDigit; - }//end special mode + }/*end special mode*/ ext->valueDigit += ext->step; } lv_spinbox_updatevalue(spinbox); @@ -394,7 +386,7 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p } else { - if(c == '\n') + if(c == LV_GROUP_KEY_ENTER) { int p = lv_ta_get_cursor_pos(spinbox); if(p == ext->digitCount + 1) diff --git a/lv_objx/lv_spinbox.h b/lv_objx/lv_spinbox.h index 0701bde69..d9df3eb15 100644 --- a/lv_objx/lv_spinbox.h +++ b/lv_objx/lv_spinbox.h @@ -4,13 +4,6 @@ */ -/* TODO Remove these instructions - * Search an replace: template -> object normal name with lower case (e.g. button, label etc.) - * templ -> object short name with lower case(e.g. btn, label etc) - * TEMPL -> object short name with upper case (e.g. BTN, LABEL etc.) - * - */ - #ifndef LV_SPINBOX_H #define LV_SPINBOX_H @@ -50,8 +43,8 @@ typedef struct { int32_t rangeMin; int32_t step; uint8_t digitCount:4; - uint8_t decPointPos:4; //if 0, there is no separator and the number is an integer - uint8_t digits[1+1+16]; //1 sign, 1 point, 16 num digits + uint8_t decPointPos:4; /*if 0, there is no separator and the number is an integer*/ + uint8_t digits[1+1+LV_SPINBOX_MAX_DIGIT_COUNT]; /*1 sign, 1 point, 16 num digits*/ } lv_spinbox_ext_t;