From fe4d86fe11819be9db1993964dcb3f05fcc2fec4 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Fri, 18 May 2012 05:24:36 +0200 Subject: digital/io-hub/src/guybrush: close door later when comming out of captain room --- digital/io-hub/src/guybrush/top.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'digital/io-hub/src/guybrush') diff --git a/digital/io-hub/src/guybrush/top.c b/digital/io-hub/src/guybrush/top.c index 10834ac4..8b2f408f 100644 --- a/digital/io-hub/src/guybrush/top.c +++ b/digital/io-hub/src/guybrush/top.c @@ -138,8 +138,10 @@ top_update (void) { position_t robot_pos; asserv_get_position (&robot_pos); - if (robot_pos.v.x > PG_HOLD_NORTH_X + BOT_SIZE_BACK - && robot_pos.v.x < PG_MIRROR_X (PG_HOLD_NORTH_X + BOT_SIZE_BACK)) + int16_t limit = robot_pos.v.y < PG_LENGTH - PG_CAPTAIN_ROOM_LENGTH_MM + ? PG_HOLD_NORTH_X + BOT_SIZE_BACK + : PG_CAPTAIN_ROOM_LENGTH_MM + BOT_SIZE_BACK; + if (robot_pos.v.x > limit && robot_pos.v.x < PG_MIRROR_X (limit)) { IO_CLR (OUTPUT_DOOR_OPEN); IO_SET (OUTPUT_DOOR_CLOSE); -- cgit v1.2.3