diff --git a/src/hasp/hasp_object.cpp b/src/hasp/hasp_object.cpp index bd1654fe..55495fac 100644 --- a/src/hasp/hasp_object.cpp +++ b/src/hasp/hasp_object.cpp @@ -26,6 +26,8 @@ #include "hasp_attribute.h" const char ** btnmatrix_default_map; // memory pointer to lvgl default btnmatrix map +//static unsigned long last_change_event = 0; +static bool last_press_was_short = false; // Avoid SHORT + UP double events // ##################### Object Finders ######################################################## @@ -264,8 +266,6 @@ static inline void hasp_send_obj_attribute_txt(lv_obj_t * obj, const char * txt) // ##################### Event Handlers ######################################################## -static bool last_press_was_short = false; // Avoid SHORT + UP double events - /** * Called when a button-style object is clicked * @param obj pointer to a button object @@ -425,13 +425,28 @@ static void ddlist_event_handler(lv_obj_t * obj, lv_event_t event) } /** - * Called when a slider is clicked + * Called when a slider or adjustable arc is clicked * @param obj pointer to a slider * @param event type of event that occured */ void slider_event_handler(lv_obj_t * obj, lv_event_t event) { - if(event == LV_EVENT_VALUE_CHANGED) hasp_send_obj_attribute_val(obj, lv_slider_get_value(obj)); + if(event == LV_EVENT_VALUE_CHANGED) { +/* bool is_dragged; + + if(obj->user_data.objid == LV_HASP_SLIDER) { + is_dragged = lv_slider_is_dragged(obj); + } else if(obj->user_data.objid == LV_HASP_ARC) { + is_dragged = lv_arc_is_dragged(obj); + } + + if(is_dragged && (millis() - last_change_event < LV_INDEV_DEF_LONG_PRESS_TIME)) { + return; + } +*/ + hasp_send_obj_attribute_val(obj, lv_slider_get_value(obj)); +// last_change_event = millis(); + } } /** diff --git a/src/hasp/hasp_object.h b/src/hasp/hasp_object.h index 899024eb..e498cf7b 100644 --- a/src/hasp/hasp_object.h +++ b/src/hasp/hasp_object.h @@ -8,42 +8,49 @@ #include "lvgl.h" enum lv_hasp_obj_type_t { - LV_HASP_CONTAINER = 90, - LV_HASP_OBJECT = 91, - LV_HASP_PAGE = 92, - - LV_HASP_LABEL = 12, - LV_HASP_DDLIST = 50, - LV_HASP_ROLLER = 51, - - LV_HASP_BUTTON = 10, - LV_HASP_CHECKBOX = 11, - LV_HASP_SWITCH = 40, - LV_HASP_LED = 41, - - LV_HASP_SLIDER = 30, - LV_HASP_GAUGE = 31, - LV_HASP_BAR = 32, - LV_HASP_LMETER = 33, - - LV_HASP_ARC = 22, - LV_HASP_PRELOADER = 21, + /* Controls */ + LV_HASP_OBJECT = 91, // 10 + LV_HASP_BUTTON = 10, // 12 + LV_HASP_BTNMATRIX = 13, + LV_HASP_IMGBTN = 14, // placeholder + LV_HASP_CHECKBOX = 11, // 15 + LV_HASP_SWITCH = 40, // 16 + LV_HASP_SLIDER = 30, // 17 + LV_HASP_TEXTAREA = 18, // placeholder + LV_HASP_SPINBOX = 19, // placeholder LV_HASP_CPICKER = 20, - LV_HASP_IMAGE = 60, - LV_HASP_IMGBTN = 61, - LV_HASP_CANVAS = 62, + /* Selectors */ + LV_HASP_DDLIST = 50, + LV_HASP_ROLLER = 51, + LV_HASP_LIST = 52, // placeholder + LV_HASP_TABLE = 53, + LV_HASP_CALENDER = 54, - LV_HASP_BTNMATRIX = 1, - LV_HASP_LINE = 3, - LV_HASP_TABLE = 2, - LV_HASP_CALENDER = 81, - LV_HASP_CHART = 80, - LV_HASP_TILEVIEW = 70, - LV_HASP_TABVIEW = 71, - LV_HASP_TAB = 72, - LV_HASP_WINDOW = 94, - LV_HASP_MSGBOX = 93, + /* Containers */ + LV_HASP_CONTAINER = 70, + LV_HASP_WINDOW = 71, // placeholder + LV_HASP_MSGBOX = 72, // placeholder + LV_HASP_TILEVIEW = 73, // placeholder + LV_HASP_TABVIEW = 74, // placeholder + LV_HASP_TAB = 75, // placeholder + LV_HASP_PAGE = 79, // Obsolete in v8 + + /* Visualizers */ + LV_HASP_LABEL = 12, // 30 + LV_HASP_GAUGE = 31, + LV_HASP_BAR = 32, + LV_HASP_LMETER = 33, + LV_HASP_LED = 41, // 34 + LV_HASP_ARC = 22, // 35 + LV_HASP_PRELOADER = 21, // 36 + LV_HASP_CHART = 37, + + /* Graphics */ + LV_HASP_LINE = 60, + LV_HASP_IMAGE = 61, // placeholder + LV_HASP_CANVAS = 62, // placeholder + LV_HASP_MASK = 63, // placeholder }; void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id);