Use new recolor helper in bt_callback

This commit is contained in:
2026-06-28 17:35:07 -04:00
parent 0bb8457f2b
commit b36fd4c8bf
+10 -13
View File
@@ -96,6 +96,15 @@ static void toggle_temp_warning_state(bool enable_warning, bool force) {
s_temp_is_warning = enable_warning; s_temp_is_warning = enable_warning;
} }
static void recolor_digit_bitmaps(GBitmap **bitmaps, GColor *applied, GColor new_color) {
if (applied->argb == new_color.argb)
return;
for (int i = 0; i < 10; ++i) {
replace_gbitmap_color(*applied, new_color, bitmaps[i], NULL);
}
*applied = new_color;
}
static void bt_callback(bool connected) { static void bt_callback(bool connected) {
GColor dst = connected ? settings.ColorHours : settings.ColorWarning; GColor dst = connected ? settings.ColorHours : settings.ColorWarning;
if (s_first_settings_application && connected && dst.argb == s_applied_hour.argb) { if (s_first_settings_application && connected && dst.argb == s_applied_hour.argb) {
@@ -103,13 +112,10 @@ static void bt_callback(bool connected) {
// for those using white fg, do not pointlessly replace white at startup if that is the destination anyway // for those using white fg, do not pointlessly replace white at startup if that is the destination anyway
return; return;
} }
for (int i = 0; i < 10; ++i) { recolor_digit_bitmaps(s_hour_bitmaps, &s_applied_hour, dst);
replace_gbitmap_color(s_applied_hour, dst, s_hour_bitmaps[i], NULL);
}
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
layer_mark_dirty(bitmap_layer_get_layer(s_digit_fg_layers[i])); layer_mark_dirty(bitmap_layer_get_layer(s_digit_fg_layers[i]));
} }
s_applied_hour = dst;
} }
static void batt_callback(BatteryChargeState state) { static void batt_callback(BatteryChargeState state) {
@@ -310,15 +316,6 @@ static void peek_did_change(void *context) {
} }
} }
static void recolor_digit_bitmaps(GBitmap **bitmaps, GColor *applied, GColor new_color) {
if (applied->argb == new_color.argb)
return;
for (int i = 0; i < 10; ++i) {
replace_gbitmap_color(*applied, new_color, bitmaps[i], NULL);
}
*applied = new_color;
}
static void apply_settings() { static void apply_settings() {
bool force_update_minutes = false; bool force_update_minutes = false;