summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJérémy Dufour2009-05-21 17:59:16 +0200
committerJérémy Dufour2009-05-21 17:59:16 +0200
commitd8d46ee757cf6ecb7df3029d1ae703665f45771e (patch)
tree2c81e54a78c1b38a56ca3707edd34b817adc6d35
parente68c8bd873fc2746d02ce53caf3422dff78cbb38 (diff)
* digital/io/src:
- support going to the last used position when asking for the next position to get pucks from the ground.
-rw-r--r--digital/io/src/top.c8
1 files 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;
}