From 846f73eb9aac840c86b9f79874244002c9e47e0e Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 22 Apr 2008 21:56:47 +0200 Subject: * digital/io/src: - fixed asserv status event generation. - also require that the last command be acknowledged or status can be out of date if a transition sent a new command. --- digital/io/src/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'digital') diff --git a/digital/io/src/main.c b/digital/io/src/main.c index 6ca9327b..73b41196 100644 --- a/digital/io/src/main.c +++ b/digital/io/src/main.c @@ -118,21 +118,25 @@ main_loop (void) asserv_retransmit (); else { + asserv_status_e move_status = asserv_last_cmd_ack () + ? asserv_move_cmd_status () : none; /* Check commands move status */ - if (asserv_move_cmd_status () == success) + if (move_status == success) { /* Pass it to all the FSM that need it */ fsm_handle_event (&getsamples_fsm, GETSAMPLES_EVENT_bot_move_succeed); } - else + else if (move_status == failure) { /* Move failed */ fsm_handle_event (&getsamples_fsm, GETSAMPLES_EVENT_bot_move_failed); } + asserv_status_e arm_status = asserv_last_cmd_ack () + ? asserv_arm_cmd_status () : none; /* Check commands arm status */ - if (asserv_arm_cmd_status () == success) + if (arm_status == success) { /* Pass it to all the FSM that need it */ fsm_handle_event (&getsamples_fsm, -- cgit v1.2.3