From a38e0bf3009d9f3b1ad8c81e46ae62f088e62c89 Mon Sep 17 00:00:00 2001 From: kugel Date: Thu, 8 Oct 2009 19:04:53 +0000 Subject: [PATCH] Use TIME_BEFORE() and redo a macro slightly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23010 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/chopper.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index 4dfef9d8a..05ef7fcaf 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c @@ -171,18 +171,21 @@ CONFIG_KEYPAD == MROBE500_PAD #define LEVEL_MODE_STEEP 1 #if LCD_HEIGHT <= 64 -#define CYCLETIME 100 +#define CYCLES 100 static inline int SCALE(int x) { return x == 1 ? x : x >> 1; } #define SIZE 2 #else -#define CYCLETIME 60 +#define CYCLES 60 #define SCALE(x) (x) #define SIZE 1 #endif +/* in 10 milisecond (ticks) */ +#define CYCLETIME ((CYCLES*HZ)/1000) + /*Chopper's local variables to track the terrain position etc*/ static int chopCounter; static int iRotorOffset; @@ -792,7 +795,7 @@ static int chopGameLoop(void) while (!exit) { - end = *rb->current_tick + (CYCLETIME * HZ) / 1000; + end = *rb->current_tick + CYCLETIME; if(chopUpdateTerrainRecycling(&mGround) == 1) /* mirror the sky if we've changed the ground */ @@ -907,8 +910,8 @@ static int chopGameLoop(void) return ret; } - if (end > *rb->current_tick) - rb->sleep(end-*rb->current_tick); + if (TIME_BEFORE(*rb->current_tick, end)) + rb->sleep(end - *rb->current_tick); /* wait until time is over */ else rb->yield(); -- 2.11.4.GIT