Only setup vibes once
This commit is contained in:
+15
-8
@@ -2,6 +2,7 @@
|
|||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "triangles.h"
|
#include "triangles.h"
|
||||||
#include <pebble.h>
|
#include <pebble.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// layer-age
|
// layer-age
|
||||||
@@ -52,11 +53,12 @@ static GBitmap *s_check_bmp;
|
|||||||
// global vars
|
// global vars
|
||||||
static GColor s_setter_highlight_color;
|
static GColor s_setter_highlight_color;
|
||||||
static uint8_t s_highlight_pos = 0;
|
static uint8_t s_highlight_pos = 0;
|
||||||
//// setter
|
|
||||||
//// alarm
|
//// alarm
|
||||||
static uint8_t s_solution_indices[3] = {8, 8, 8};
|
static uint8_t s_solution_indices[3] = {8, 8, 8};
|
||||||
static uint8_t s_selected_indices[3] = {9, 9, 9};
|
static uint8_t s_selected_indices[3] = {9, 9, 9};
|
||||||
static uint8_t s_stopwatch_time[2] = {0, 0};
|
static uint8_t s_stopwatch_time[2] = {0, 0};
|
||||||
|
static uint32_t s_vibe_segments[5];
|
||||||
|
static VibePattern s_vibe_pattern;
|
||||||
|
|
||||||
// constants
|
// constants
|
||||||
static const uint8_t s_edge_bar_height = ((PBL_DISPLAY_HEIGHT / 7) * 2);
|
static const uint8_t s_edge_bar_height = ((PBL_DISPLAY_HEIGHT / 7) * 2);
|
||||||
@@ -232,13 +234,7 @@ static void alarm_seconds_handler(struct tm *tick_time, TimeUnits units_changed)
|
|||||||
static char s_stopwatch_buffer[9];
|
static char s_stopwatch_buffer[9];
|
||||||
snprintf(s_stopwatch_buffer, sizeof(s_stopwatch_buffer), "%02u:%02u", s_stopwatch_time[0], s_stopwatch_time[1]);
|
snprintf(s_stopwatch_buffer, sizeof(s_stopwatch_buffer), "%02u:%02u", s_stopwatch_time[0], s_stopwatch_time[1]);
|
||||||
text_layer_set_text(s_counter_txt_layer, s_stopwatch_buffer);
|
text_layer_set_text(s_counter_txt_layer, s_stopwatch_buffer);
|
||||||
|
vibes_enqueue_custom_pattern(s_vibe_pattern);
|
||||||
uint32_t vibe_segments[5] = {s_triangle_layer->angle_A * 2, 200, s_triangle_layer->angle_B * 2, 200, s_triangle_layer->angle_C * 2};
|
|
||||||
VibePattern pat = {
|
|
||||||
.durations = vibe_segments,
|
|
||||||
.num_segments = ARRAY_LENGTH(vibe_segments),
|
|
||||||
};
|
|
||||||
vibes_enqueue_custom_pattern(pat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void graph_layer_update_proc(Layer *layer, GContext *ctx) {
|
static void graph_layer_update_proc(Layer *layer, GContext *ctx) {
|
||||||
@@ -556,6 +552,17 @@ static void alarm_window_load() {
|
|||||||
text_layer_set_text(s_counter_txt_layer, "00:00");
|
text_layer_set_text(s_counter_txt_layer, "00:00");
|
||||||
layer_add_child(window_layer, text_layer_get_layer(s_counter_txt_layer));
|
layer_add_child(window_layer, text_layer_get_layer(s_counter_txt_layer));
|
||||||
|
|
||||||
|
// setup vibes
|
||||||
|
s_vibe_segments[0] = (uint32_t)(s_triangle_layer->angle_A * 2);
|
||||||
|
s_vibe_segments[1] = 200;
|
||||||
|
s_vibe_segments[2] = (uint32_t)(s_triangle_layer->angle_B * 2);
|
||||||
|
s_vibe_segments[3] = 200;
|
||||||
|
s_vibe_segments[4] = (uint32_t)(s_triangle_layer->angle_C * 2);
|
||||||
|
s_vibe_pattern = (VibePattern){
|
||||||
|
.durations = s_vibe_segments,
|
||||||
|
.num_segments = ARRAY_LENGTH(s_vibe_segments),
|
||||||
|
};
|
||||||
|
|
||||||
schedule_alarm(true); // output is not captured, as it is not actionable
|
schedule_alarm(true); // output is not captured, as it is not actionable
|
||||||
tick_timer_service_subscribe(SECOND_UNIT, alarm_seconds_handler);
|
tick_timer_service_subscribe(SECOND_UNIT, alarm_seconds_handler);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user