From a8e25e107bfd486b945f656d5358b63259799909 Mon Sep 17 00:00:00 2001 From: dufourj Date: Wed, 11 Jan 2006 16:22:49 +0000 Subject: Correction des syncs --- 2005/i/robert/src/motor/motor.cc | 4 +++- 2005/i/robert/src/motor/motor.hh | 2 +- 2005/i/robert/src/motor/test_motor.cc | 16 ++-------------- 3 files changed, 6 insertions(+), 16 deletions(-) (limited to '2005/i/robert/src/motor') diff --git a/2005/i/robert/src/motor/motor.cc b/2005/i/robert/src/motor/motor.cc index c292e9c..7e78aff 100644 --- a/2005/i/robert/src/motor/motor.cc +++ b/2005/i/robert/src/motor/motor.cc @@ -206,9 +206,11 @@ bool Motor::sync(void) return false; } -void Motor::wait(int timeout) +bool +Motor::wait(int timeout) { asserv_.wait(timeout); + return sync (); } /// Récupère le File Descriptor diff --git a/2005/i/robert/src/motor/motor.hh b/2005/i/robert/src/motor/motor.hh index b527525..ad67f84 100644 --- a/2005/i/robert/src/motor/motor.hh +++ b/2005/i/robert/src/motor/motor.hh @@ -100,7 +100,7 @@ class Motor : public Asserv::Receiver /// Syncronisation bool sync(void); /// On attend... - void wait(int timeout); + bool wait(int timeout = -1); /// Récupère le File Descriptor int getFd(void); /// Retoure l'état du jack (false entrée et true sortie) diff --git a/2005/i/robert/src/motor/test_motor.cc b/2005/i/robert/src/motor/test_motor.cc index 137e355..f01e299 100644 --- a/2005/i/robert/src/motor/test_motor.cc +++ b/2005/i/robert/src/motor/test_motor.cc @@ -112,20 +112,9 @@ main (int argc, char **argv) throw std::runtime_error("syntax error"); motor.setAccel(strtol(argv[0], 0, 10)); break; - case 'L': - while(!motor.idle()) - { - motor.wait(-1); - motor.sync(); - } - break; - } - motor.sync(); - while(!motor.idle()) - { - motor.wait(-1); - motor.sync(); } + while(!motor.wait () || !motor.idle ()) + ; break; } @@ -140,7 +129,6 @@ main (int argc, char **argv) { motor.wait (stop - t); t = Timer::getProgramTime (); - motor.sync(); } break; } -- cgit v1.2.3