Cleaned up some code, calling vibrate functions where needed.
This commit is contained in:
parent
518c78f879
commit
b5efc4f3a2
@ -162,6 +162,7 @@ static void setDisplayVibrationDurationCb(uint8_t *duration, SettingMode_e mode)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
watch_settings_display_set_vibrate_on_touch_duration(*duration);
|
watch_settings_display_set_vibrate_on_touch_duration(*duration);
|
||||||
|
watch_peripherals_vibrate_on_item_click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,6 +175,7 @@ static void setDisplayVibrationStrengthCb(uint8_t *strength, SettingMode_e mode)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
watch_settings_display_set_vibrate_on_touch_strength(*strength);
|
watch_settings_display_set_vibrate_on_touch_strength(*strength);
|
||||||
|
watch_peripherals_vibrate_on_item_click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +200,7 @@ static void setNotificationVibrationDurationCb(uint8_t *duration, SettingMode_e
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
watch_settings_notification_set_notification_vibration_duration(*duration);
|
watch_settings_notification_set_notification_vibration_duration(*duration);
|
||||||
|
watch_peripherals_vibrate_on_message_notifications();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +213,7 @@ static void setNotificationVibrationStrengthCb(uint8_t *strength, SettingMode_e
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
watch_settings_notification_set_notification_vibration_strength(*strength);
|
watch_settings_notification_set_notification_vibration_strength(*strength);
|
||||||
|
watch_peripherals_vibrate_on_message_notifications();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,13 +511,15 @@ static void parser_event_cb(gadget_bridge_event_data_t *gadget_bridge_event_data
|
|||||||
|
|
||||||
static void ble_service_nus_data_rx_cb(const uint8_t *data, uint16_t length)
|
static void ble_service_nus_data_rx_cb(const uint8_t *data, uint16_t length)
|
||||||
{
|
{
|
||||||
/*for (uint16_t i = 0; i < length; i++)
|
#if HARDWARE_PLATFORM != SMART_WATCH_PCB_RELEASE
|
||||||
|
for (uint16_t i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
if (data[i] < 32)
|
if (data[i] < 32 || data[i] > 126)
|
||||||
printf("[%u]", data[i]);
|
printf("[%u]", data[i]);
|
||||||
else
|
else
|
||||||
printf("%c", data[i]);
|
printf("%c", data[i]);
|
||||||
}*/
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
gadget_bridge_parser_feed((const char *)data, length);
|
gadget_bridge_parser_feed((const char *)data, length);
|
||||||
while(gadget_bridge_parser_run() == GADGET_BRIDGE_PARSER_CODE_PARSING);
|
while(gadget_bridge_parser_run() == GADGET_BRIDGE_PARSER_CODE_PARSING);
|
||||||
@ -644,20 +650,14 @@ static void notification_on_state_change_cb(NotificationState_e notificationStat
|
|||||||
switch (notificationState)
|
switch (notificationState)
|
||||||
{
|
{
|
||||||
case NOTIFICATION_STATE_DISPLAYED:
|
case NOTIFICATION_STATE_DISPLAYED:
|
||||||
|
// Let's change the MCU clocks to its max speed, this is done to get the best responsiveness when having large texts
|
||||||
|
watch_power_management_overwrite_default_cpu_clocks(CPU_CLK_240M, CPU_CLK_240M);
|
||||||
// Let's give a user feedback by vibrating the watch if it is configured to do so
|
// Let's give a user feedback by vibrating the watch if it is configured to do so
|
||||||
if(persistency_get_settings()->notification.notification_vibration_duration)
|
watch_peripherals_vibrate_on_message_notifications();
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case NOTIFICATION_STATE_CLEARED:
|
case NOTIFICATION_STATE_CLEARED:
|
||||||
|
// Let's restore MCU clocks to it's default
|
||||||
|
watch_power_management_restore_default_cpu_clocks(true, true);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -724,6 +724,8 @@ void gfx_task(void *param)
|
|||||||
/* Initialize lvgl screens */
|
/* Initialize lvgl screens */
|
||||||
watch_face_init(&watchFace);
|
watch_face_init(&watchFace);
|
||||||
menu_screen_init(&menuScreen);
|
menu_screen_init(&menuScreen);
|
||||||
|
menu_screen_register_on_menu_item_click_cb(&menuScreen, &(watch_peripherals_vibrate_on_item_click));
|
||||||
|
|
||||||
compass_screen_init(&compassScreen);
|
compass_screen_init(&compassScreen);
|
||||||
compass_screen_register_on_state_change_cb(&compassScreen, &(compass_screen_on_state_change_cb));
|
compass_screen_register_on_state_change_cb(&compassScreen, &(compass_screen_on_state_change_cb));
|
||||||
compass_screen_register_azimuth_and_temperature_cb(&compassScreen, &(compass_screen_azimuth_and_temperature_cb));
|
compass_screen_register_azimuth_and_temperature_cb(&compassScreen, &(compass_screen_azimuth_and_temperature_cb));
|
||||||
|
Loading…
Reference in New Issue
Block a user