Add continous vibration for first triangle

This commit is contained in:
RandyTheSilly committed 2026-10-30 21:04:37 -04:00
1 parent 272adbebcc
commit 7a955d0f3a
2 files changed
+9 -18

No files matched your search

+9 -17
View File
@@ -67,10 +67,9 @@ static uint8_t s_selected_indices[3] = {9, 9, 9};
static uint8_t s_countdown_int = 0;
static char s_countdown_buf[4];
static char s_progress_buf[9];
static uint32_t s_vibe_segments[5];
static VibePattern s_vibe_pattern;
// constants
//// shared (setter+alarm)
static const uint8_t s_edge_bar_height = ((PBL_DISPLAY_HEIGHT / 7) * 2);
static const GRect s_top_bar_grect = GRect(0, 0, PBL_DISPLAY_WIDTH, s_edge_bar_height);
static const GRect s_bottom_bar_grect = GRect(0, PBL_DISPLAY_HEIGHT - s_edge_bar_height, PBL_DISPLAY_WIDTH, s_edge_bar_height);
@@ -86,6 +85,11 @@ static const char *s_tan_arr[2] = {"tan¯¹", "cot¯¹"};
static const char *s_sin;
static const char *s_cos;
static const char *s_tan;
static const uint32_t s_first_triangle_vibe_segments[] = {900};
static const VibePattern s_first_triangle_vibe_pattern = {
.durations = s_first_triangle_vibe_segments,
.num_segments = ARRAY_LENGTH(s_first_triangle_vibe_segments),
};
// alarm drop menu options
static const char *s_options_function[3];
@@ -424,20 +428,6 @@ static void update_for_new_triangle() {
s_options_function[1] = s_cos;
s_options_function[2] = s_tan;
// setup vibes
static const uint32_t VIBE_ON_FLOOR = 120; // ensure motor is on long enough to be felt
static const uint32_t VIBE_ON_SCALE = 4;
static const uint32_t VIBE_GAP = 40;
s_vibe_segments[0] = VIBE_ON_FLOOR + (uint32_t)s_triangle_layer->angle_A * VIBE_ON_SCALE;
s_vibe_segments[1] = VIBE_GAP;
s_vibe_segments[2] = VIBE_ON_FLOOR + (uint32_t)s_triangle_layer->angle_B * VIBE_ON_SCALE;
s_vibe_segments[3] = VIBE_GAP;
s_vibe_segments[4] = VIBE_ON_FLOOR + (uint32_t)s_triangle_layer->angle_C * VIBE_ON_SCALE;
s_vibe_pattern = (VibePattern){
.durations = s_vibe_segments,
.num_segments = ARRAY_LENGTH(s_vibe_segments),
};
// setup countdown
s_countdown_int = settings.TriangleSecsMin + ((settings.TriangleCount - s_current_triangle_num) * settings.TriangleSecsStep);
snprintf(s_countdown_buf, sizeof(s_countdown_buf), "%03u", s_countdown_int);
@@ -450,6 +440,9 @@ static void update_for_new_triangle() {
static void alarm_seconds_handler(struct tm *tick_time, TimeUnits units_changed) {
s_countdown_int--;
if (s_current_triangle_num == 1) {
vibes_enqueue_custom_pattern(s_first_triangle_vibe_pattern);
}
snprintf(s_countdown_buf, sizeof(s_countdown_buf), "%03u", s_countdown_int);
text_layer_set_text(s_countdown_txt_layer, s_countdown_buf);
if (s_countdown_int == 0) {
@@ -742,7 +735,6 @@ static void alarm_window_load() {
}
static void alarm_window_unload() {
vibes_cancel();
tick_timer_service_unsubscribe();
text_layer_destroy(s_countdown_txt_layer);
window_destroy(s_drop_window);