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
This commit is contained in:
parent
07e5867d21
commit
5deafc767d
@ -1,4 +1,6 @@
|
|||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
#include "watch_peripherals.h"
|
||||||
|
#include "watch_settings.h"
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* It is needed to have a reference on two header_titles because when
|
* 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;
|
if(!*header_title_p)return;
|
||||||
lv_label_set_text_static(*header_title_p, title);
|
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);
|
||||||
|
}
|
||||||
|
@ -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);
|
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
|
#endif //COMMON_SCREEN_COMPONENTS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user