Set time to warning color on BT disconnect
This commit is contained in:
@@ -65,6 +65,19 @@ static void batt_callback(BatteryChargeState state) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void bt_callback(bool connected) {
|
||||||
|
GColor src = connected ? settings.ColorWarning : s_applied_fg;
|
||||||
|
GColor dst = connected ? s_applied_fg : settings.ColorWarning;
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; ++i) {
|
||||||
|
replace_gbitmap_color(src, dst, s_font_bitmaps[i], NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
layer_mark_dirty(bitmap_layer_get_layer(s_time_fg_layers[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void temp_update_proc(Layer *layer, GContext *ctx) {
|
static void temp_update_proc(Layer *layer, GContext *ctx) {
|
||||||
graphics_context_set_fill_color(ctx, GColorWhite);
|
graphics_context_set_fill_color(ctx, GColorWhite);
|
||||||
const uint8_t bar_count = s_temp_level;
|
const uint8_t bar_count = s_temp_level;
|
||||||
@@ -444,6 +457,7 @@ static void init() {
|
|||||||
|
|
||||||
update_minute_1();
|
update_minute_1();
|
||||||
batt_callback(battery_state_service_peek());
|
batt_callback(battery_state_service_peek());
|
||||||
|
bt_callback(connection_service_peek_pebble_app_connection());
|
||||||
|
|
||||||
app_message_register_inbox_received(inbox_received_handler);
|
app_message_register_inbox_received(inbox_received_handler);
|
||||||
app_message_open(255, 64);
|
app_message_open(255, 64);
|
||||||
@@ -456,9 +470,11 @@ static void init() {
|
|||||||
|
|
||||||
tick_timer_service_subscribe(MINUTE_UNIT, minute_handler);
|
tick_timer_service_subscribe(MINUTE_UNIT, minute_handler);
|
||||||
battery_state_service_subscribe(batt_callback);
|
battery_state_service_subscribe(batt_callback);
|
||||||
|
connection_service_subscribe((ConnectionHandlers){.pebble_app_connection_handler = bt_callback});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinit() {
|
static void deinit() {
|
||||||
|
connection_service_unsubscribe();
|
||||||
battery_state_service_unsubscribe();
|
battery_state_service_unsubscribe();
|
||||||
tick_timer_service_unsubscribe();
|
tick_timer_service_unsubscribe();
|
||||||
layer_destroy(s_fuel_layer);
|
layer_destroy(s_fuel_layer);
|
||||||
|
|||||||
Reference in New Issue
Block a user