summaryrefslogtreecommitdiff
path: root/digital
diff options
context:
space:
mode:
authorNicolas Schodet2012-05-18 05:24:36 +0200
committerNicolas Schodet2012-05-18 05:24:36 +0200
commitfe4d86fe11819be9db1993964dcb3f05fcc2fec4 (patch)
treef68772d299dbbdf6ee1f5b2a4d8e5dd43a2062d2 /digital
parent34d7c2dc382624345fc27eefb837a031125b0f79 (diff)
digital/io-hub/src/guybrush: close door later when comming out of captain room
Diffstat (limited to 'digital')
-rw-r--r--digital/io-hub/src/guybrush/top.c6
1 files changed, 4 insertions, 2 deletions
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);