summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/motor
diff options
context:
space:
mode:
authordufourj2006-01-11 16:22:49 +0000
committerdufourj2006-01-11 16:22:49 +0000
commita8e25e107bfd486b945f656d5358b63259799909 (patch)
treeba3221ffb7ba784e0fb81ec67f5aa2dc37984d86 /2005/i/robert/src/motor
parentd4fa4d87eb2040a6da63d5570893218f3dd2dc5c (diff)
Correction des syncs
Diffstat (limited to '2005/i/robert/src/motor')
-rw-r--r--2005/i/robert/src/motor/motor.cc4
-rw-r--r--2005/i/robert/src/motor/motor.hh2
-rw-r--r--2005/i/robert/src/motor/test_motor.cc16
3 files changed, 6 insertions, 16 deletions
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;
}