From 143327bb7e9472691718572243c0f59bb0c02086 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Fri, 5 Apr 2013 23:06:50 +0200 Subject: digital/io-hub/src/apbirthday: add jack filtering --- digital/io-hub/src/apbirthday/robot.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'digital/io-hub/src/apbirthday/robot.cc') diff --git a/digital/io-hub/src/apbirthday/robot.cc b/digital/io-hub/src/apbirthday/robot.cc index ced1b0c8..bc0c3552 100644 --- a/digital/io-hub/src/apbirthday/robot.cc +++ b/digital/io-hub/src/apbirthday/robot.cc @@ -40,6 +40,7 @@ Robot::Robot () usb_proto (*this, hardware.usb), chrono (90000 - 1000), pressure (hardware.adc_pressure, hardware.pneum_open, mimot.motor0), + jack (hardware.raw_jack, 50), usdist_control_ (2), usdist0_ (usdist_control_, hardware.adc_dist0, hardware.dist0_sync, 100, 700, 650), usdist1_ (usdist_control_, hardware.adc_dist1, hardware.dist1_sync, 100, 700, 650), @@ -125,6 +126,7 @@ Robot::main_loop () } obstacles.update (); pressure.update (); + jack.update (); outputs_set_.update (); // Handle communications. bool sync = main_i2c_queue_.sync (); @@ -163,8 +165,8 @@ Robot::fsm_gen_event () fsm_handle_and_return (robot_move_success); else if (robot_move_status == Motor::FAILURE) fsm_handle_and_return (robot_move_failure); - // Jack. TODO: bounce filter. - if (!hardware.raw_jack.get ()) + // Jack. + if (!jack.get ()) fsm_handle_and_return (jack_inserted); else fsm_handle_and_return (jack_removed); -- cgit v1.2.3