diff --git a/package.json b/package.json index 6b1d694..0aac413 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "resources": { "media": [ { - "characterRegex": "[0-9\\.]", + "characterRegex": "[0-9. ]", "file": "fonts/LCARSGTJ3_58.ttf", "name": "LCARS_58", "targetPlatforms": [ diff --git a/src/c/main.c b/src/c/main.c index ff11ba5..fee4280 100644 --- a/src/c/main.c +++ b/src/c/main.c @@ -18,7 +18,7 @@ static int loweracrossline = 90, upperacrossline = 50, textleft = 25, watchwidth static PropertyAnimation *image_property_animation; //1800000 static bool WeatherSetupStatusKey = S_FALSE, WeatherSetupStatusProvider = S_FALSE, WeatherReadyRecieved = S_FALSE, HibernateEnable = S_TRUE, SleepEnable = S_TRUE; GColor text_color; -static EventHandle s_health_event_handle, s_tick_timer_event_handle;//, s_idle_timer_event_handle; +static EventHandle s_health_event_handle=NULL, s_tick_timer_event_handle=NULL;//, s_idle_timer_event_handle; static void read_persist() { @@ -678,7 +678,7 @@ static void update_time() { // Write the current hours and minutes into a buffer static char s_buffer[8]; strftime(s_buffer, sizeof(s_buffer), clock_is_24h_style() ? - "%H%M" : "%I%M", tick_time); + "%H%M" : "%l%M", tick_time); Current_Min=tick_time->tm_min; Current_Hour=tick_time->tm_hour; // Display this time on the TextLayer @@ -1023,7 +1023,9 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context) HibernateEnable = data->value->int32 == 1; //register to recieve significant updates of which we are looking for sleep updates - events_health_service_events_unsubscribe(s_health_event_handle); + if (s_health_event_handle != NULL) { + events_health_service_events_unsubscribe(s_health_event_handle); + } if (SleepEnable||HibernateEnable) { s_health_event_handle = events_health_service_events_subscribe(prv_health_event_handler, NULL); } @@ -1159,8 +1161,12 @@ static void window_unload(Window *window) { //unsubscribe from services events_battery_state_service_unsubscribe(battery_callback); events_connection_service_unsubscribe(bluetooth_callback); - events_tick_timer_service_unsubscribe(tick_handler); - events_health_service_events_unsubscribe(s_health_event_handle); + if (s_tick_timer_event_handle!=NULL) { + events_tick_timer_service_unsubscribe(s_tick_timer_event_handle); + } + if (s_health_event_handle != NULL) { + events_health_service_events_unsubscribe(s_health_event_handle); + } events_app_message_unsubscribe(inbox_received_callback); events_app_message_unsubscribe(inbox_dropped_callback); events_app_message_unsubscribe(outbox_failed_callback); @@ -1238,4 +1244,4 @@ int main() { init(); app_event_loop(); deinit(); -} \ No newline at end of file +}