void show_watchface(void) { initialise_ui(); s_res_charging = gbitmap_create_with_resource(RESOURCE_ID_CHARGING); s_res_battery_20 = gbitmap_create_with_resource(RESOURCE_ID_BATTERY_20); s_res_battery_40 = gbitmap_create_with_resource(RESOURCE_ID_BATTERY_40); s_res_battery_60 = gbitmap_create_with_resource(RESOURCE_ID_BATTERY_60); s_res_battery_80 = gbitmap_create_with_resource(RESOURCE_ID_BATTERY_80); s_res_battery_100 = gbitmap_create_with_resource(RESOURCE_ID_BATTERY_100); layer_set_update_proc(sCalendarLayer, calendar_layer_update_callback); tick_timer_service_subscribe(MINUTE_UNIT, handle_minute_tick); battery_state_service_subscribe(handle_battery); bluetooth_connection_service_subscribe(handle_bluetooth); sTimer = NULL; btStatus = bluetooth_connection_service_peek(); handle_battery(battery_state_service_peek()); currentTime = get_time(); update_time_text(); update_date_text(); layer_mark_dirty(sCalendarLayer); window_set_window_handlers(s_window, (WindowHandlers) { .unload = handle_window_unload, });
void handle_minute_tick(struct tm *tick_time, TimeUnits units_changed) { *currentTime = *tick_time; update_time_text(); if (units_changed & DAY_UNIT) { update_date_text(); layer_mark_dirty(sCalendarLayer); } }
void handle_second_tick(AppContextRef ctx, PebbleTickEvent *t) { (void)t; (void)ctx; PblTm current_time; if(t) current_time = *t->tick_time; else get_time(¤t_time); update_seconds_text(¤t_time); if(current_time.tm_min != display_time.tm_min) update_time_text(¤t_time); if(current_time.tm_mday != display_time.tm_mday) update_date_text(¤t_time); }
static void handle_second_tick(struct tm *tick_time, TimeUnits units_changed) { update_time_text(); update_date_text(); }