summaryrefslogtreecommitdiff
path: root/digital/io-hub/src/guybrush
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io-hub/src/guybrush')
-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);