Added two new helper function to vibrate the watch on item click and vibrate the watch on received message notifications.

This commit is contained in:
Th3maz1ng 2023-11-04 12:10:42 +01:00
parent 54c35bcde8
commit 518c78f879
2 changed files with 52 additions and 1 deletions

View File

@ -10,6 +10,7 @@
#include "bma456w.h"
#include "CST816D.h"
#include "app_utils.h"
#include "watch_settings.h"
#define INTERRUPT_POLICY (0)
#define POLL_POLICY (1)
@ -374,6 +375,34 @@ void watch_peripherals_vibrate_with_pattern(uint8_t strength, const uint16_t pat
tls_timer_start(_vibration_motor_timer_id);
}
void watch_peripherals_vibrate_on_item_click(void)
{
if(!persistency_get_settings()->display.display_vibrate_on_touch_duration)
return;
uint16_t vibration_strength = (persistency_get_settings()->display.display_vibrate_on_touch_strength + 1)*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);
}
void watch_peripherals_vibrate_on_message_notifications(void)
{
if(!persistency_get_settings()->notification.notification_vibration_duration)
return;
uint16_t vibration_strength = (persistency_get_settings()->notification.notification_vibration_strength + 1) * 32;
uint32_t vibration_duration_ms = 0;
if(persistency_get_settings()->notification.notification_vibration_duration)
vibration_duration_ms = persistency_get_settings()->notification.notification_vibration_duration * 50 + 50;
uint16_t vibration_pattern[VIBRATION_PATTERN_SLOTS] = {vibration_duration_ms, vibration_duration_ms, vibration_duration_ms};
watch_peripherals_vibrate_with_pattern(vibration_strength > 255 ? 255 : vibration_strength, vibration_pattern);
}
void watch_peripherals_set_brightness(uint8_t brightness)
{
extern LCDConfig_t LCDConfig;
@ -749,7 +778,8 @@ void watch_peripherals_watch_sleep(void)
// First, we disable the display backlight and we set all the peripherals in their low power mode
lcd_set_backlight(&LCDConfig, 0);
lcd_sleep(&LCDConfig, true);
watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby);
// Set a restore function to apply the correct power mode when we leave sleep
//watch_peripherals_magnetometer_power_mode_set(QMC5883L_Mode_Control_Standby);
if(CST816D_sleep())
APP_LOG_DEBUG("CST816D Sleep cmd ok");
else

View File

@ -95,6 +95,27 @@ void watch_peripherals_vibrate(uint8_t strength, uint32_t durationMs);
*/
void watch_peripherals_vibrate_with_pattern(uint8_t strength, const uint16_t pattern[VIBRATION_PATTERN_SLOTS]);
/**
* @brief Helper function which vibrates the watch to indicate that an item was clicked using
* the current watch settings.
*
*/
void watch_peripherals_vibrate_on_item_click(void);
/**
* @brief Helper function which vibrates the watch to indicate the reception of a message notification using
* the current watch settings.
*
*/
void watch_peripherals_vibrate_on_message_notifications(void);
/**
* @brief Helper function which vibrates the watch to notify the user that a call is incoming using
* the current watch settings.
*
*/
void watch_peripherals_vibrate_on_call_notifications(void);
/**
* @brief Sets the brightness of the LCD display
*