Make BT indicator optional (and off by default)
This commit is contained in:
+2
-1
@@ -30,8 +30,9 @@
|
||||
"messageKeys": [
|
||||
"PKJS_READY",
|
||||
"PKJS_TEMP_BAR_COUNT",
|
||||
"CLAY_DATE_TIMEOUT",
|
||||
"CLAY_BT_INDICATOR",
|
||||
"CLAY_SHOW_TIME_MG",
|
||||
"CLAY_DATE_TIMEOUT",
|
||||
"CLAY_LOW_FUEL_BARS",
|
||||
"CLAY_LED_COLOR",
|
||||
"CLAY_BG_COLOR",
|
||||
|
||||
+19
-6
@@ -294,6 +294,15 @@ static void apply_settings(bool first_run) {
|
||||
if (settings.DateTimeoutSecs != 0) {
|
||||
accel_tap_service_subscribe(accel_tap_handler);
|
||||
}
|
||||
|
||||
// re-sub bt tracking
|
||||
connection_service_unsubscribe();
|
||||
if (settings.TrackBTStatus) {
|
||||
connection_service_subscribe((ConnectionHandlers){.pebble_app_connection_handler = bt_callback});
|
||||
bt_callback(connection_service_peek_pebble_app_connection());
|
||||
} else {
|
||||
bt_callback(true);
|
||||
}
|
||||
}
|
||||
|
||||
static void main_window_load() {
|
||||
@@ -333,6 +342,7 @@ static void main_window_load() {
|
||||
}
|
||||
|
||||
static void main_window_unload() {
|
||||
connection_service_unsubscribe();
|
||||
accel_tap_service_unsubscribe();
|
||||
layer_destroy(s_fuel_mg_layer);
|
||||
layer_destroy(s_temp_mg_layer);
|
||||
@@ -364,8 +374,9 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
}
|
||||
|
||||
// CLAY SETTINGS
|
||||
Tuple *date_timeout_tuple = dict_find(iter, MESSAGE_KEY_CLAY_DATE_TIMEOUT);
|
||||
Tuple *track_bt_tuple = dict_find(iter, MESSAGE_KEY_CLAY_BT_INDICATOR);
|
||||
Tuple *show_time_mg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_SHOW_TIME_MG);
|
||||
Tuple *date_timeout_tuple = dict_find(iter, MESSAGE_KEY_CLAY_DATE_TIMEOUT);
|
||||
Tuple *low_fuel_bars_tuple = dict_find(iter, MESSAGE_KEY_CLAY_LOW_FUEL_BARS);
|
||||
Tuple *color_led_tuple = dict_find(iter, MESSAGE_KEY_CLAY_LED_COLOR);
|
||||
Tuple *color_bg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_BG_COLOR);
|
||||
@@ -375,12 +386,15 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) {
|
||||
Tuple *color_mg_time_tuple = dict_find(iter, MESSAGE_KEY_CLAY_TIME_MG_COLOR);
|
||||
Tuple *color_fg_tuple = dict_find(iter, MESSAGE_KEY_CLAY_FG_COLOR);
|
||||
Tuple *color_warning_tuple = dict_find(iter, MESSAGE_KEY_CLAY_WARNING_COLOR);
|
||||
if (date_timeout_tuple) {
|
||||
settings.DateTimeoutSecs = date_timeout_tuple->value->uint8;
|
||||
if (track_bt_tuple) {
|
||||
settings.TrackBTStatus = track_bt_tuple->value->uint8;
|
||||
}
|
||||
if (show_time_mg_tuple) {
|
||||
settings.ShowTimeMG = show_time_mg_tuple->value->uint8;
|
||||
}
|
||||
if (date_timeout_tuple) {
|
||||
settings.DateTimeoutSecs = date_timeout_tuple->value->uint8;
|
||||
}
|
||||
if (low_fuel_bars_tuple) {
|
||||
settings.LowFuelBars = low_fuel_bars_tuple->value->uint8;
|
||||
}
|
||||
@@ -417,8 +431,9 @@ static void init() {
|
||||
if (persist_exists(STORAGE_KEY_SETTINGS)) {
|
||||
persist_read_data(STORAGE_KEY_SETTINGS, &settings, sizeof(settings));
|
||||
} else {
|
||||
settings.DateTimeoutSecs = 3;
|
||||
settings.TrackBTStatus = false;
|
||||
settings.ShowTimeMG = false;
|
||||
settings.DateTimeoutSecs = 3;
|
||||
settings.LowFuelBars = 2;
|
||||
settings.ColorLED = GColorWhite;
|
||||
settings.ColorBG = GColorBlue;
|
||||
@@ -457,7 +472,6 @@ static void init() {
|
||||
|
||||
update_minute_1();
|
||||
batt_callback(battery_state_service_peek());
|
||||
bt_callback(connection_service_peek_pebble_app_connection());
|
||||
|
||||
app_message_register_inbox_received(inbox_received_handler);
|
||||
app_message_open(255, 64);
|
||||
@@ -470,7 +484,6 @@ static void init() {
|
||||
|
||||
tick_timer_service_subscribe(MINUTE_UNIT, minute_handler);
|
||||
battery_state_service_subscribe(batt_callback);
|
||||
connection_service_subscribe((ConnectionHandlers){.pebble_app_connection_handler = bt_callback});
|
||||
}
|
||||
|
||||
static void deinit() {
|
||||
|
||||
+2
-1
@@ -4,8 +4,9 @@
|
||||
#define STORAGE_KEY_SETTINGS 69
|
||||
|
||||
typedef struct ClaySettings {
|
||||
uint8_t DateTimeoutSecs;
|
||||
bool TrackBTStatus;
|
||||
bool ShowTimeMG;
|
||||
uint8_t DateTimeoutSecs;
|
||||
uint8_t LowFuelBars;
|
||||
GColor ColorLED;
|
||||
GColor ColorBG;
|
||||
|
||||
@@ -19,6 +19,14 @@ module.exports = [
|
||||
"label": "Show time segments midground",
|
||||
"description": "Show or hide the unlit segments behind the time."
|
||||
},
|
||||
{
|
||||
"id": "bt_indicator_toggle",
|
||||
"type": "toggle",
|
||||
"messageKey": "CLAY_BT_INDICATOR",
|
||||
"defaultValue": false,
|
||||
"label": "BT disconnect indicator",
|
||||
"description": "Change the color of the digits to the configured warning color when the connection to the phone is lost."
|
||||
},
|
||||
{
|
||||
"type": "slider",
|
||||
"messageKey": "CLAY_DATE_TIMEOUT",
|
||||
|
||||
Reference in New Issue
Block a user