Eliminate unneeded variable

This commit is contained in:
RandyTheSilly committed 2026-10-31 13:58:16 -04:00
1 parent bf879d5d4c
commit 20b64afe4c
1 file changed
+4 -7
+4 -7
View File
@@ -67,7 +67,6 @@ static GRect s_bt_grect_b;
// declare animation templates // declare animation templates
static const uint8_t s_animation_duration = 255; static const uint8_t s_animation_duration = 255;
static bool s_first_tick_occurred = false;
static Animation *s_head_raise_template; static Animation *s_head_raise_template;
static Animation *s_head_out_template; static Animation *s_head_out_template;
static Animation *s_head_in_template; static Animation *s_head_in_template;
@@ -198,7 +197,7 @@ static void minute_handler(struct tm *tick_time, TimeUnits units_changed) {
//// calculate new positions //// calculate new positions
s_date_grect_b = GRect(s_ones_offset[ones], s_date_pos_y, s_date_bt_width, s_date_height); s_date_grect_b = GRect(s_ones_offset[ones], s_date_pos_y, s_date_bt_width, s_date_height);
s_bt_grect_b = GRect(s_bt_pos_x - s_ones_offset[ones], s_bt_pos_y, s_date_bt_width, s_bt_height); s_bt_grect_b = GRect(s_bt_pos_x - s_ones_offset[ones], s_bt_pos_y, s_date_bt_width, s_bt_height);
if (s_first_tick_occurred) { // no need to animate before first tick, as positions are set in init() without animating if (units_changed) {
//// configure animations //// configure animations
////// date ////// date
PropertyAnimation *date_center_prop = property_animation_create_layer_frame(text_layer_get_layer(s_date_layer), &s_date_grect_a, &s_date_grect_b); PropertyAnimation *date_center_prop = property_animation_create_layer_frame(text_layer_get_layer(s_date_layer), &s_date_grect_a, &s_date_grect_b);
@@ -222,17 +221,15 @@ static void minute_handler(struct tm *tick_time, TimeUnits units_changed) {
s_bt_grect_a = s_bt_grect_b; s_bt_grect_a = s_bt_grect_b;
} }
// animate swaps on half-hour boundaries // animate swaps on half-hour boundaries (but not on first tick)
if (!s_first_tick_occurred) { if (units_changed) {
s_first_tick_occurred = true;
return; // do not animate part swaps on first tick
}
if (tick_time->tm_min % 60 == 0) { if (tick_time->tm_min % 60 == 0) {
schedule_guy_animation(s_head_raise_template, s_head_out_template, s_head_in_template, update_minute_60_out_handler); schedule_guy_animation(s_head_raise_template, s_head_out_template, s_head_in_template, update_minute_60_out_handler);
} else if (tick_time->tm_min % 30 == 0) { } else if (tick_time->tm_min % 30 == 0) {
schedule_guy_animation(s_butt_raise_template, s_butt_out_template, s_butt_in_template, update_minute_30_out_handler); schedule_guy_animation(s_butt_raise_template, s_butt_out_template, s_butt_in_template, update_minute_30_out_handler);
} }
} }
}
static void time_bar_update_proc(Layer *layer, GContext *ctx) { static void time_bar_update_proc(Layer *layer, GContext *ctx) {
graphics_context_set_fill_color(ctx, GColorWhite); graphics_context_set_fill_color(ctx, GColorWhite);