From 998472a87f8504745c8ae5ca451f979d8a5e9d86 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 16 May 2012 22:28:17 +0200 Subject: digital/io-hub/src/guybrush: add demo mode control for unblocking --- digital/io-hub/src/guybrush/main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'digital') diff --git a/digital/io-hub/src/guybrush/main.c b/digital/io-hub/src/guybrush/main.c index bc953471..20548d16 100644 --- a/digital/io-hub/src/guybrush/main.c +++ b/digital/io-hub/src/guybrush/main.c @@ -160,6 +160,7 @@ static uint8_t main_demo_events (void) { static uint8_t color_switch_last = 0xff; + static uint8_t nb_robots_switch_last = 0xff; static uint8_t tree_step; static uint8_t sleep; /* Bounce detection. */ @@ -190,6 +191,15 @@ main_demo_events (void) tree_step = (tree_step + 1) % 3; return 1; } + /* Look at nb robots switch to control unblocking. */ + if (nb_robots_switch_last == 0xff) + nb_robots_switch_last = IO_GET (CONTACT_NB_ROBOTS); + if (nb_robots_switch_last != IO_GET (CONTACT_NB_ROBOTS)) + { + nb_robots_switch_last = IO_GET (CONTACT_NB_ROBOTS); + sleep = 125; + return FSM_HANDLE (AI, robot_is_back); + } return 0; } -- cgit v1.2.3