From 0c8f1f4ba219c8f92ed5b1e7c7ad0f967d4150a2 Mon Sep 17 00:00:00 2001 From: Jerome Jutteau Date: Wed, 1 May 2013 17:59:47 +0200 Subject: digital/io-hub/src/apbirthday: add plate state --- digital/io-hub/src/apbirthday/plate.cc | 3 +++ digital/io-hub/src/apbirthday/plate.hh | 2 ++ 2 files changed, 5 insertions(+) (limited to 'digital/io-hub') diff --git a/digital/io-hub/src/apbirthday/plate.cc b/digital/io-hub/src/apbirthday/plate.cc index 8fda068b..9b38b771 100644 --- a/digital/io-hub/src/apbirthday/plate.cc +++ b/digital/io-hub/src/apbirthday/plate.cc @@ -28,6 +28,7 @@ Plate::Plate () { reset_plate_nb (); + is_up = 0; } inline int Plate::get_plate_nb () @@ -141,6 +142,7 @@ FSM_TRANS_TIMEOUT (PLATE_TAKE_UPING, 100, PLATE_I_HAZ_PLATE) { robot->fsm_queue.post (FSM_EVENT (plate_taken)); robot->plate.ppp (); + robot->plate.is_up = 1; } FSM_TRANS (PLATE_I_HAZ_PLATE, plate_take, PLATE_I_HAZ_PLATE) @@ -151,6 +153,7 @@ FSM_TRANS (PLATE_I_HAZ_PLATE, plate_take, PLATE_I_HAZ_PLATE) FSM_TRANS (PLATE_I_HAZ_PLATE, plate_drop, PLATE_DROP_DOWNING) { Plate::arm_down (); + robot->plate.is_up = 0; } FSM_TRANS_TIMEOUT (PLATE_DROP_DOWNING, 100, PLATE_DROP_OPENING) diff --git a/digital/io-hub/src/apbirthday/plate.hh b/digital/io-hub/src/apbirthday/plate.hh index 614c1790..b4538253 100644 --- a/digital/io-hub/src/apbirthday/plate.hh +++ b/digital/io-hub/src/apbirthday/plate.hh @@ -33,6 +33,8 @@ class Plate void reset_plate_nb (); // Increment plate_nb, internal use for FSM void ppp (); + // Read only: 1 if plate is up, 0 otherwhise + int is_up; // GPIO manipulation. static void arm_down (); static void arm_up (); -- cgit v1.2.3