traj_period_nsec is a long and nsec is an unsigned long. Thus the division
will be an integer division. Doing an integer division effectively disables the
ceil() operation. The code suggests that we want a
floating point division here. Fix this by casting traj_period_nsec to double
before dividing.
Signed-off-by: Michael Buesch <m...@bues.ch>
Index: emc2-git-2.5/src/emc/motion/motion.c
===================================================================
--- emc2-git-2.5.orig/src/emc/motion/motion.c 2011-09-12 13:46:46.000000000
+0200
+++ emc2-git-2.5/src/emc/motion/motion.c 2011-09-12 14:04:40.000000000
+0200
@@ -1115,7 +1115,7 @@
void emcmotSetCycleTime(unsigned long nsec ) {
int servo_mult;
- servo_mult = ceil(traj_period_nsec / nsec);
+ servo_mult = ceil((double)traj_period_nsec / nsec) + 0.1;
if(servo_mult < 0) servo_mult = 1;
setTrajCycleTime(nsec * 1e-9);
setServoCycleTime(nsec * servo_mult * 1e-9);
--
Greetings, Michael.
Index: emc2-git-2.5/src/emc/motion/motion.c
===================================================================
--- emc2-git-2.5.orig/src/emc/motion/motion.c 2011-09-12 13:46:46.000000000 +0200
+++ emc2-git-2.5/src/emc/motion/motion.c 2011-09-12 14:04:40.000000000 +0200
@@ -1115,7 +1115,7 @@
void emcmotSetCycleTime(unsigned long nsec ) {
int servo_mult;
- servo_mult = ceil(traj_period_nsec / nsec);
+ servo_mult = ceil((double)traj_period_nsec / nsec) + 0.1;
if(servo_mult < 0) servo_mult = 1;
setTrajCycleTime(nsec * 1e-9);
setServoCycleTime(nsec * servo_mult * 1e-9);
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers