parent
626d922c57
commit
eebb13b2de
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"appKeys": {
|
"appKeys": {
|
||||||
|
"btvibe": 8,
|
||||||
"colorbg": 0,
|
"colorbg": 0,
|
||||||
"colorh": 2,
|
"colorh": 2,
|
||||||
"colorm": 1,
|
"colorm": 1,
|
||||||
|
@ -25,7 +26,7 @@
|
||||||
"chalk"
|
"chalk"
|
||||||
],
|
],
|
||||||
"uuid": "ceeae81b-6b50-43b6-8bbb-6d6f6eb62b69",
|
"uuid": "ceeae81b-6b50-43b6-8bbb-6d6f6eb62b69",
|
||||||
"versionLabel": "1.6",
|
"versionLabel": "1.7",
|
||||||
"watchapp": {
|
"watchapp": {
|
||||||
"watchface": true
|
"watchface": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ Pebble.addEventListener('showConfiguration', function() {
|
||||||
if(Pebble.getActiveWatchInfo) {
|
if(Pebble.getActiveWatchInfo) {
|
||||||
watch = Pebble.getActiveWatchInfo();
|
watch = Pebble.getActiveWatchInfo();
|
||||||
}
|
}
|
||||||
var url='http://pebble.lastfuture.de/config/supersimple15/';
|
var url='http://pebble.lastfuture.de/config/supersimple17/';
|
||||||
if (watch.platform != "chalk") {
|
if (watch.platform != "chalk") {
|
||||||
url += "?rect=true";
|
url += "?rect=true";
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ Pebble.addEventListener('webviewclosed', function(e) {
|
||||||
shadows: 0+(configData.shadows === 'true'),
|
shadows: 0+(configData.shadows === 'true'),
|
||||||
ticks: configData.ticks,
|
ticks: configData.ticks,
|
||||||
colort: parseInt(configData.colort, 16),
|
colort: parseInt(configData.colort, 16),
|
||||||
rectticks: 0+(configData.rectticks === 'true')
|
rectticks: 0+(configData.rectticks === 'true'),
|
||||||
|
btvibe: 0+(configData.btvibe === 'true')
|
||||||
}, function() {
|
}, function() {
|
||||||
console.log('Send successful!');
|
console.log('Send successful!');
|
||||||
}, function() {
|
}, function() {
|
||||||
|
|
34
src/main.c
34
src/main.c
|
@ -8,6 +8,7 @@
|
||||||
#define KEY_TICKS 5
|
#define KEY_TICKS 5
|
||||||
#define KEY_TICK_COLOR 6
|
#define KEY_TICK_COLOR 6
|
||||||
#define KEY_RECT_TICKS 7
|
#define KEY_RECT_TICKS 7
|
||||||
|
#define KEY_BT_VIBE 8
|
||||||
|
|
||||||
#define ANTIALIASING true
|
#define ANTIALIASING true
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ static Layer *bg_canvas_layer, *s_canvas_layer;
|
||||||
static GPoint s_center;
|
static GPoint s_center;
|
||||||
static Time s_last_time;
|
static Time s_last_time;
|
||||||
static int animpercent = 0, ticks;
|
static int animpercent = 0, ticks;
|
||||||
static bool s_animating = false, shadows = true, debug = false, rectticks = true;
|
static bool s_animating = false, shadows = true, debug = false, rectticks = true, btvibe = false;
|
||||||
|
|
||||||
static GColor gcolorbg, gcolorm, gcolorh, gcolorp, gcolorshadow, gcolort;
|
static GColor gcolorbg, gcolorm, gcolorh, gcolorp, gcolorshadow, gcolort;
|
||||||
|
|
||||||
|
@ -65,6 +66,7 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||||
Tuple *ticknum_t = dict_find(iter, KEY_TICKS);
|
Tuple *ticknum_t = dict_find(iter, KEY_TICKS);
|
||||||
Tuple *colort_t = dict_find(iter, KEY_TICK_COLOR);
|
Tuple *colort_t = dict_find(iter, KEY_TICK_COLOR);
|
||||||
Tuple *rectticks_t = dict_find(iter, KEY_RECT_TICKS);
|
Tuple *rectticks_t = dict_find(iter, KEY_RECT_TICKS);
|
||||||
|
Tuple *btvibe_t = dict_find(iter, KEY_BT_VIBE);
|
||||||
|
|
||||||
if(colorbg_t) {
|
if(colorbg_t) {
|
||||||
int colorbg = colorbg_t->value->int32;
|
int colorbg = colorbg_t->value->int32;
|
||||||
|
@ -110,12 +112,20 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||||
persist_write_bool(KEY_RECT_TICKS, false);
|
persist_write_bool(KEY_RECT_TICKS, false);
|
||||||
rectticks = false;
|
rectticks = false;
|
||||||
}
|
}
|
||||||
|
if(btvibe_t && btvibe_t->value->int8 > 0) {
|
||||||
|
persist_write_bool(KEY_BT_VIBE, true);
|
||||||
|
btvibe = true;
|
||||||
|
} else {
|
||||||
|
persist_write_bool(KEY_BT_VIBE, false);
|
||||||
|
btvibe = false;
|
||||||
|
}
|
||||||
if(bg_canvas_layer) {
|
if(bg_canvas_layer) {
|
||||||
layer_mark_dirty(bg_canvas_layer);
|
layer_mark_dirty(bg_canvas_layer);
|
||||||
}
|
}
|
||||||
if(s_canvas_layer) {
|
if(s_canvas_layer) {
|
||||||
layer_mark_dirty(s_canvas_layer);
|
layer_mark_dirty(s_canvas_layer);
|
||||||
}
|
}
|
||||||
|
vibes_short_pulse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************** AnimationImplementation **************************/
|
/*************************** AnimationImplementation **************************/
|
||||||
|
@ -163,6 +173,17 @@ static void tick_handler(struct tm *tick_time, TimeUnits changed) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_bluetooth(bool connected) {
|
||||||
|
if (btvibe && !connected) {
|
||||||
|
static uint32_t const segments[] = { 200, 200, 50, 150, 200 };
|
||||||
|
VibePattern pat = {
|
||||||
|
.durations = segments,
|
||||||
|
.num_segments = ARRAY_LENGTH(segments),
|
||||||
|
};
|
||||||
|
vibes_enqueue_custom_pattern(pat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t get_angle_for_minute(int minute) {
|
static int32_t get_angle_for_minute(int minute) {
|
||||||
// Progress through 60 minutes, out of 360 degrees
|
// Progress through 60 minutes, out of 360 degrees
|
||||||
return ((minute * 360) / 60);
|
return ((minute * 360) / 60);
|
||||||
|
@ -346,6 +367,11 @@ static void window_load(Window *window) {
|
||||||
} else {
|
} else {
|
||||||
rectticks = false;
|
rectticks = false;
|
||||||
}
|
}
|
||||||
|
if (persist_exists(KEY_BT_VIBE)) {
|
||||||
|
btvibe = persist_read_bool(KEY_BT_VIBE);
|
||||||
|
} else {
|
||||||
|
btvibe = false;
|
||||||
|
}
|
||||||
|
|
||||||
bg_canvas_layer = layer_create(window_bounds);
|
bg_canvas_layer = layer_create(window_bounds);
|
||||||
s_canvas_layer = layer_create(window_bounds);
|
s_canvas_layer = layer_create(window_bounds);
|
||||||
|
@ -404,6 +430,12 @@ static void init() {
|
||||||
light_enable(true);
|
light_enable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_bluetooth(connection_service_peek_pebble_app_connection());
|
||||||
|
|
||||||
|
connection_service_subscribe((ConnectionHandlers) {
|
||||||
|
.pebble_app_connection_handler = handle_bluetooth
|
||||||
|
});
|
||||||
|
|
||||||
app_message_register_inbox_received(inbox_received_handler);
|
app_message_register_inbox_received(inbox_received_handler);
|
||||||
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
|
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue