mirror of https://github.com/nealey/Twatch
Disable BT on Time Round
Got a report that it was triggering all the time, due to the Round's low-power bluetooth.
This commit is contained in:
parent
cb4021db98
commit
4c6a45e9d5
|
@ -15,14 +15,15 @@
|
||||||
"configurable"
|
"configurable"
|
||||||
],
|
],
|
||||||
"companyName": "dartcatcher@gmail.com",
|
"companyName": "dartcatcher@gmail.com",
|
||||||
"longName": "Twatch \u03b5",
|
"longName": "Twatch Epsilon",
|
||||||
"projectType": "native",
|
"projectType": "native",
|
||||||
"resources": {
|
"resources": {
|
||||||
"media": [
|
"media": [
|
||||||
{
|
{
|
||||||
"file": "images/menu.png",
|
"file": "images/menu.png",
|
||||||
|
"menuIcon": true,
|
||||||
"name": "MENU_IMAGE",
|
"name": "MENU_IMAGE",
|
||||||
"type": "png"
|
"type": "bitmap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"characterRegex": "[\uf10b]",
|
"characterRegex": "[\uf10b]",
|
||||||
|
@ -39,14 +40,14 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"sdkVersion": "3",
|
"sdkVersion": "3",
|
||||||
"shortName": "Twatch \u03b5",
|
"shortName": "Twatch E",
|
||||||
"targetPlatforms": [
|
"targetPlatforms": [
|
||||||
"aplite",
|
"aplite",
|
||||||
"basalt",
|
"basalt",
|
||||||
"chalk"
|
"chalk"
|
||||||
],
|
],
|
||||||
"uuid": "8287a53c-1b7e-4f4b-9104-608de13b9f77",
|
"uuid": "8287a53c-1b7e-4f4b-9104-608de13b9f77",
|
||||||
"versionLabel": "1.1",
|
"versionLabel": "1.4",
|
||||||
"watchapp": {
|
"watchapp": {
|
||||||
"watchface": true
|
"watchface": true
|
||||||
}
|
}
|
||||||
|
|
24
src/main.c
24
src/main.c
|
@ -99,11 +99,15 @@ static void date_update_proc(Layer *layer, GContext *ctx) {
|
||||||
struct tm *t = localtime(&now);
|
struct tm *t = localtime(&now);
|
||||||
char *b = s_day_buffer;
|
char *b = s_day_buffer;
|
||||||
|
|
||||||
if (bt_connected || (! bluetooth)) {
|
APP_LOG(APP_LOG_LEVEL_DEBUG, "blueteething: %d", bluetooth);
|
||||||
|
if (bluetooth) {
|
||||||
|
if (bt_connected) {
|
||||||
text_layer_set_text(s_bt_label, "");
|
text_layer_set_text(s_bt_label, "");
|
||||||
} else {
|
} else {
|
||||||
text_layer_set_text(s_bt_label, "");
|
text_layer_set_text(s_bt_label, "");
|
||||||
}
|
}
|
||||||
|
text_layer_set_text_color(s_bt_label, colors[KEY_COLOR_NUM]);
|
||||||
|
}
|
||||||
|
|
||||||
strftime(s_mon_buffer, sizeof(s_mon_buffer), "%b", t);
|
strftime(s_mon_buffer, sizeof(s_mon_buffer), "%b", t);
|
||||||
text_layer_set_text(s_mon_label, s_mon_buffer);
|
text_layer_set_text(s_mon_label, s_mon_buffer);
|
||||||
|
@ -181,7 +185,6 @@ static void window_load(Window *window) {
|
||||||
text_layer_set_text_alignment(s_bt_label, GTextAlignmentLeft);
|
text_layer_set_text_alignment(s_bt_label, GTextAlignmentLeft);
|
||||||
text_layer_set_text(s_bt_label, "");
|
text_layer_set_text(s_bt_label, "");
|
||||||
text_layer_set_background_color(s_bt_label, GColorClear);
|
text_layer_set_background_color(s_bt_label, GColorClear);
|
||||||
text_layer_set_text_color(s_bt_label, colors[KEY_COLOR_TIC]);
|
|
||||||
text_layer_set_font(s_bt_label, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_SYMBOLS_52)));
|
text_layer_set_font(s_bt_label, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_SYMBOLS_52)));
|
||||||
layer_add_child(s_date_layer, text_layer_get_layer(s_bt_label));
|
layer_add_child(s_date_layer, text_layer_get_layer(s_bt_label));
|
||||||
|
|
||||||
|
@ -196,7 +199,6 @@ static void window_load(Window *window) {
|
||||||
text_layer_set_text_alignment(s_mon_label, GTextAlignmentRight);
|
text_layer_set_text_alignment(s_mon_label, GTextAlignmentRight);
|
||||||
text_layer_set_text(s_mon_label, s_mon_buffer);
|
text_layer_set_text(s_mon_label, s_mon_buffer);
|
||||||
text_layer_set_background_color(s_mon_label, GColorClear);
|
text_layer_set_background_color(s_mon_label, GColorClear);
|
||||||
text_layer_set_text_color(s_mon_label, colors[KEY_COLOR_MON]);
|
|
||||||
layer_add_child(s_date_layer, text_layer_get_layer(s_mon_label));
|
layer_add_child(s_date_layer, text_layer_get_layer(s_mon_label));
|
||||||
|
|
||||||
// Day
|
// Day
|
||||||
|
@ -210,7 +212,6 @@ static void window_load(Window *window) {
|
||||||
text_layer_set_text_alignment(s_day_label, GTextAlignmentRight);
|
text_layer_set_text_alignment(s_day_label, GTextAlignmentRight);
|
||||||
text_layer_set_text(s_day_label, s_day_buffer);
|
text_layer_set_text(s_day_label, s_day_buffer);
|
||||||
text_layer_set_background_color(s_day_label, GColorClear);
|
text_layer_set_background_color(s_day_label, GColorClear);
|
||||||
text_layer_set_text_color(s_day_label, colors[KEY_COLOR_DAY]);
|
|
||||||
layer_add_child(s_date_layer, text_layer_get_layer(s_day_label));
|
layer_add_child(s_date_layer, text_layer_get_layer(s_day_label));
|
||||||
|
|
||||||
s_hands_layer = layer_create(bounds);
|
s_hands_layer = layer_create(bounds);
|
||||||
|
@ -309,10 +310,10 @@ static void in_received_handler(DictionaryIterator *rec, void *context) {
|
||||||
persist_write_int(i, cur->value->int32);
|
persist_write_int(i, cur->value->int32);
|
||||||
break;
|
break;
|
||||||
case KEY_SECONDS:
|
case KEY_SECONDS:
|
||||||
persist_write_bool(i, cur->value->int32);
|
persist_write_bool(i, !!cur->value->int32);
|
||||||
break;
|
break;
|
||||||
case KEY_BLUETOOTH:
|
case KEY_BLUETOOTH:
|
||||||
persist_write_bool(i, cur->value->int32);
|
persist_write_bool(i, !!cur->value->int32);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,7 +322,7 @@ static void in_received_handler(DictionaryIterator *rec, void *context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void in_dropped_handler(AppMessageResult reason, void *context) {
|
static void in_dropped_handler(AppMessageResult reason, void *context) {
|
||||||
// What could we possibly do here?
|
// XXX: I don't understand what we could possibly do here
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init() {
|
static void init() {
|
||||||
|
@ -333,6 +334,8 @@ static void init() {
|
||||||
colors[KEY_COLOR_FACE] = GColorBlack;
|
colors[KEY_COLOR_FACE] = GColorBlack;
|
||||||
colors[KEY_COLOR_SEC] = COLOR_FALLBACK(GColorWindsorTan, GColorWhite);
|
colors[KEY_COLOR_SEC] = COLOR_FALLBACK(GColorWindsorTan, GColorWhite);
|
||||||
|
|
||||||
|
restore();
|
||||||
|
|
||||||
window = window_create();
|
window = window_create();
|
||||||
window_set_window_handlers(window, (WindowHandlers) {
|
window_set_window_handlers(window, (WindowHandlers) {
|
||||||
.load = window_load,
|
.load = window_load,
|
||||||
|
@ -358,14 +361,17 @@ static void init() {
|
||||||
gpath_move_to(s_hour_arrow, center);
|
gpath_move_to(s_hour_arrow, center);
|
||||||
|
|
||||||
tick_subscribe();
|
tick_subscribe();
|
||||||
|
|
||||||
|
#ifdef PBL_ROUND
|
||||||
|
bt_connected = true;
|
||||||
|
#else
|
||||||
bluetooth_connection_service_subscribe(bt_handler);
|
bluetooth_connection_service_subscribe(bt_handler);
|
||||||
bt_connected = bluetooth_connection_service_peek();
|
bt_connected = bluetooth_connection_service_peek();
|
||||||
|
#endif
|
||||||
|
|
||||||
app_message_register_inbox_received(in_received_handler);
|
app_message_register_inbox_received(in_received_handler);
|
||||||
app_message_register_inbox_dropped(in_dropped_handler);
|
app_message_register_inbox_dropped(in_dropped_handler);
|
||||||
app_message_open(256, 64);
|
app_message_open(256, 64);
|
||||||
|
|
||||||
restore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinit() {
|
static void deinit() {
|
||||||
|
|
|
@ -23,6 +23,9 @@ Pebble.addEventListener("webviewclosed", function(e) {
|
||||||
console.log("configuration closed");
|
console.log("configuration closed");
|
||||||
// webview closed
|
// webview closed
|
||||||
var options = JSON.parse(decodeURIComponent(e.response));
|
var options = JSON.parse(decodeURIComponent(e.response));
|
||||||
console.log("Options = " + JSON.stringify(options));
|
options.seconds = options.seconds?1:0;
|
||||||
|
//options.bluetooth = options.bluetooth?1:0;
|
||||||
|
options.bluetooth = 1;
|
||||||
|
console.log("Options = " + options);
|
||||||
Pebble.sendAppMessage(options, appMessageAck, appMessageNak);
|
Pebble.sendAppMessage(options, appMessageAck, appMessageNak);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue