From 69b9814a11c85699a8dac1939d5091ef44f263be Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Thu, 4 Jun 2026 21:59:56 -0400 Subject: [PATCH] Set time to warning color on BT disconnect --- src/c/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/c/main.c b/src/c/main.c index c07686c..87fb3d1 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -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) { graphics_context_set_fill_color(ctx, GColorWhite); const uint8_t bar_count = s_temp_level; @@ -444,6 +457,7 @@ 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); @@ -456,9 +470,11 @@ 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() { + connection_service_unsubscribe(); battery_state_service_unsubscribe(); tick_timer_service_unsubscribe(); layer_destroy(s_fuel_layer);