summaryrefslogtreecommitdiffhomepage
path: root/digital/io/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'digital/io/src/main.c')
-rw-r--r--digital/io/src/main.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/digital/io/src/main.c b/digital/io/src/main.c
index 46b171c6..6a709d0c 100644
--- a/digital/io/src/main.c
+++ b/digital/io/src/main.c
@@ -243,6 +243,28 @@ main_loop (void)
/* Post the event */
FSM_HANDLE_EVENT (&top_fsm, save_event);
}
+ /* Sharps event for move FSM */
+ uint8_t moving_direction = asserv_get_moving_direction ();
+ if (moving_direction)
+ {
+ if (moving_direction == 1)
+ {
+ /* Front only */
+ if (sharp_get_interpreted (SHARP_FRONT_LEFT) ||
+ sharp_get_interpreted (SHARP_FRONT_RIGHT))
+ /* Generate an event for move FSM */
+ FSM_HANDLE_EVENT (&move_fsm,
+ MOVE_EVENT_bot_move_obstacle);
+ }
+ else
+ {
+ /* Back only */
+ if (sharp_get_interpreted (SHARP_BACK_LEFT) ||
+ sharp_get_interpreted (SHARP_BACK_RIGHT))
+ /* Generate an event for move FSM */
+ FSM_HANDLE_EVENT (&move_fsm, MOVE_EVENT_bot_move_obstacle);
+ }
+ }
/* TODO: Check other sensors */
}