From 1b51ee1af43e1ab8a0825b7d6c9e9c390716802a Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Mon, 11 Jan 2016 22:18:39 +0100 Subject: [PATCH] fixed excessive app_logs in animations --- appinfo.json | 2 +- src/squared.c | 38 ++++++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/appinfo.json b/appinfo.json index 0f34eae..42279cd 100644 --- a/appinfo.json +++ b/appinfo.json @@ -30,7 +30,7 @@ "chalk" ], "uuid": "793bab03-9464-48a2-b63f-3f779c473db8", - "versionLabel": "4.3", + "versionLabel": "4.4", "watchapp": { "watchface": true } diff --git a/src/squared.c b/src/squared.c index d974782..a582a3c 100644 --- a/src/squared.c +++ b/src/squared.c @@ -386,17 +386,23 @@ static unsigned short get_display_hour(unsigned short hour) { } static void setupAnimation() { - APP_LOG(APP_LOG_LEVEL_INFO, "Setting up anim"); + if (debug) { + APP_LOG(APP_LOG_LEVEL_INFO, "Setting up anim"); + } anim = animation_create(); animation_set_delay(anim, 0); animation_set_duration(anim, DIGIT_CHANGE_ANIM_DURATION); animation_set_implementation(anim, &animImpl); animation_set_curve(anim, AnimationCurveEaseInOut); - APP_LOG(APP_LOG_LEVEL_INFO, "Done setting up anim %i", (int)anim); + if (debug) { + APP_LOG(APP_LOG_LEVEL_INFO, "Done setting up anim %i", (int)anim); + } } static void destroyAnimation() { - APP_LOG(APP_LOG_LEVEL_INFO, "Destroying anim %i", (int)anim); + if (debug) { + APP_LOG(APP_LOG_LEVEL_INFO, "Destroying anim %i", (int)anim); + } animation_destroy(anim); anim = NULL; } @@ -410,10 +416,10 @@ void handle_tick(struct tm *t, TimeUnits units_changed) { animation_destroy(anim); } if (debug) { - ho = get_display_hour(t->tm_hour); - mi = t->tm_min; - da = 10; - mo = 1; + ho = 5; + mi = 15; + da = 12; + mo = 3; } else { ho = get_display_hour(t->tm_hour); mi = t->tm_min; @@ -508,7 +514,7 @@ void initSlot(int i, Layer *parent) { s->slotIndex = i; s->normTime = ANIMATION_NORMALIZED_MAX; - s->prevDigit = 0; + s->prevDigit = startDigit[i]; s->curDigit = startDigit[i]; if ((i<4 || i>=8) && i<14) { s->divider = 1; @@ -527,7 +533,9 @@ static void deinitSlot(int i) { } static void animateDigits(struct Animation *anim, const AnimationProgress normTime) { - APP_LOG(APP_LOG_LEVEL_INFO, "Tick! %i", (int)anim); + if (debug) { + APP_LOG(APP_LOG_LEVEL_INFO, "Tick! %i", (int)anim); + } int i; for (i=0; i