From d8d46ee757cf6ecb7df3029d1ae703665f45771e Mon Sep 17 00:00:00 2001 From: Jérémy Dufour Date: Thu, 21 May 2009 17:59:16 +0200 Subject: * digital/io/src: - support going to the last used position when asking for the next position to get pucks from the ground. --- digital/io/src/top.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/digital/io/src/top.c b/digital/io/src/top.c index 7098db82..04633bf8 100644 --- a/digital/io/src/top.c +++ b/digital/io/src/top.c @@ -53,8 +53,10 @@ top_get_next_position_to_get_puck_on_the_ground (asserv_position_t *position, }; static uint8_t current_position = 0; + if (restart && current_position != 0) + current_position--; if (current_position >= (sizeof (ground_puck) - / sizeof (asserv_position_t))) + / sizeof (asserv_position_t))) /* No more position. */ return 0; /* Sanity check. */ @@ -65,10 +67,8 @@ top_get_next_position_to_get_puck_on_the_ground (asserv_position_t *position, position->y = ground_puck[current_position].y; position->a = PG_A_VALUE_COMPUTING (ground_puck[current_position].a * BOT_ANGLE_DEGREE); - /* Go to next position only if we are restarting the procedure. */ - if (!restart) - current_position++; } + current_position++; return 1; } -- cgit v1.2.3