From 690bde47d716476fde982087dadfe794f7fdb14e Mon Sep 17 00:00:00 2001 From: Nicolas Haller Date: Tue, 19 May 2009 01:32:32 +0200 Subject: * digital/io/src: - elevator fsm fixes --- digital/io/src/elevator.fsm | 11 +++++------ digital/io/src/elevator_cb.c | 12 +++++++----- digital/io/src/main.c | 3 --- 3 files changed, 12 insertions(+), 14 deletions(-) (limited to 'digital') diff --git a/digital/io/src/elevator.fsm b/digital/io/src/elevator.fsm index c57bedb8..0e4b3ab5 100644 --- a/digital/io/src/elevator.fsm +++ b/digital/io/src/elevator.fsm @@ -8,7 +8,7 @@ States: WAIT_JACK_IN waiting for the jack INIT - init the elevator + init the elevator position and open door GO_TO_POS_X go to a position to be ready to get a new puck WAIT_A_PUCK @@ -30,13 +30,12 @@ States: CLOSE_DOORS closing the elevator's doors + Events: start io power on! jack_inserted_into_bot jack into the bot - init_done - init done in_position elevator is in position new_puck @@ -57,11 +56,11 @@ IDLE: WAIT_JACK_IN: jack_inserted_into_bot -> INIT - make initializations + make initializations (elevator zero and open doors) INIT: - init_done -> GO_TO_POS_X - match begin, we're going to be ready to get a new puck + doors_opened -> GO_TO_POS_X + make initializations (close doors) GO_TO_POS_X: in_position -> WAIT_A_PUCK diff --git a/digital/io/src/elevator_cb.c b/digital/io/src/elevator_cb.c index c1d7b926..5ef5be28 100644 --- a/digital/io/src/elevator_cb.c +++ b/digital/io/src/elevator_cb.c @@ -61,27 +61,29 @@ elevator__IDLE__start (void) /* * WAIT_JACK_IN =jack_inserted_into_bot=> * => INIT - * make initializations + * make initializations (elevator zero and open doors) */ fsm_branch_t elevator__WAIT_JACK_IN__jack_inserted_into_bot (void) { + pwm_set(OPEN_DOOR_PWM, TIME_DOORS_PWM); asserv_elevator_zero_position(); return elevator_next (WAIT_JACK_IN, jack_inserted_into_bot); } /* - * INIT =init_done=> + * INIT =doors_opened=> * => GO_TO_POS_X - * match begin, we're going to be ready to get a new puck + * make initializations (close doors) */ fsm_branch_t -elevator__INIT__init_done (void) +elevator__INIT__doors_opened (void) { elevator_is_ready = 0; + pwm_set(CLOSE_DOOR_PWM, TIME_DOORS_PWM); asserv_move_elevator_absolute(posx[nb_puck_in_elvt], ASSERV_ELVT_SPEED_DEFAULT); - return elevator_next (INIT, init_done); + return elevator_next (INIT, doors_opened); } /* diff --git a/digital/io/src/main.c b/digital/io/src/main.c index 9219c633..2e2c4f60 100644 --- a/digital/io/src/main.c +++ b/digital/io/src/main.c @@ -204,9 +204,6 @@ main_event_to_fsm (void) /* Check elevator status. */ if (elevator_status == success) { - /* FIXME: only have one event here. */ - FSM_HANDLE_EVENT (&elevator_fsm, - ELEVATOR_EVENT_init_done); FSM_HANDLE_EVENT (&elevator_fsm, ELEVATOR_EVENT_in_position); } -- cgit v1.2.3