From 5deafc767de04740e718260cf20bec5ec16bf0c1 Mon Sep 17 00:00:00 2001 From: Th3maz1ng Date: Sun, 1 Oct 2023 19:35:26 +0200 Subject: [PATCH] Added a new function which should be called on every item click. It will vibrate the watch to give some user feedback if the watch is configured to do so --- .../app/gfx/common_screen_components.c | 12 ++++++++++++ .../app/gfx/common_screen_components.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/src/W800_SDK_v1.00.10/app/gfx/common_screen_components.c b/src/W800_SDK_v1.00.10/app/gfx/common_screen_components.c index f31e531..8d9c62c 100644 --- a/src/W800_SDK_v1.00.10/app/gfx/common_screen_components.c +++ b/src/W800_SDK_v1.00.10/app/gfx/common_screen_components.c @@ -1,4 +1,6 @@ #include "lvgl.h" +#include "watch_peripherals.h" +#include "watch_settings.h" /*** * It is needed to have a reference on two header_titles because when @@ -56,3 +58,13 @@ void common_screen_header_update_title(const char * title) if(!*header_title_p)return; lv_label_set_text_static(*header_title_p, title); } + +void common_screen_onclick_vibration(void) +{ + uint16_t vibration_strength = persistency_get_settings()->display.display_vibrate_on_touch_strength*32; + uint32_t vibration_duration_ms = 0; + if(persistency_get_settings()->display.display_vibrate_on_touch_duration) + vibration_duration_ms = persistency_get_settings()->display.display_vibrate_on_touch_duration*50 + 50; + + watch_peripherals_vibrate(vibration_strength > 255 ? 255 : vibration_strength, vibration_duration_ms); +} diff --git a/src/W800_SDK_v1.00.10/app/gfx/common_screen_components.h b/src/W800_SDK_v1.00.10/app/gfx/common_screen_components.h index 06e945a..6980d85 100644 --- a/src/W800_SDK_v1.00.10/app/gfx/common_screen_components.h +++ b/src/W800_SDK_v1.00.10/app/gfx/common_screen_components.h @@ -19,4 +19,10 @@ void common_screen_header_component(lv_obj_t *parent, const char * title, lv_coo */ void common_screen_header_update_title(const char * title); +/** + * @brief Vibrate to give a feedback to the user when an item was clicked + * + */ +void common_screen_onclick_vibration(void); + #endif //COMMON_SCREEN_COMPONENTS_H