From 6412dc5fd9ca0159fc8802fd28468d8879917fa1 Mon Sep 17 00:00:00 2001 From: Dan Newman Date: Sun, 19 Apr 2015 17:07:50 -0700 Subject: [PATCH] Correct/update some comments --- src/gpx/gpx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gpx/gpx.c b/src/gpx/gpx.c index 4b824fe..605d899 100644 --- a/src/gpx/gpx.c +++ b/src/gpx/gpx.c @@ -659,7 +659,7 @@ static Point5d mm_to_steps(Gpx *gpx, Ptr5d mm, Ptr2d excess) static Point5d delta_mm(Gpx *gpx) { Point5d deltaMM; - // compute the relative distance traveled along each axis and convert to steps + // compute the relative distance traveled along each axis if(gpx->command.flag & X_IS_SET) deltaMM.x = gpx->target.position.x - gpx->current.position.x; else deltaMM.x = 0; if(gpx->command.flag & Y_IS_SET) deltaMM.y = gpx->target.position.y - gpx->current.position.y; else deltaMM.y = 0; if(gpx->command.flag & Z_IS_SET) deltaMM.z = gpx->target.position.z - gpx->current.position.z; else deltaMM.z = 0; @@ -671,7 +671,7 @@ static Point5d delta_mm(Gpx *gpx) static Point5d delta_steps(Gpx *gpx,Point5d deltaMM) { Point5d deltaSteps; - // compute the relative distance traveled along each axis and convert to steps + // Convert the relative distance traveled along each axis from units of mm to steps if(gpx->command.flag & X_IS_SET) deltaSteps.x = round(fabs(deltaMM.x) * gpx->machine.x.steps_per_mm); else deltaSteps.x = 0; if(gpx->command.flag & Y_IS_SET) deltaSteps.y = round(fabs(deltaMM.y) * gpx->machine.y.steps_per_mm); else deltaSteps.y = 0; if(gpx->command.flag & Z_IS_SET) deltaSteps.z = round(fabs(deltaMM.z) * gpx->machine.z.steps_per_mm); else deltaSteps.z = 0; @@ -2072,11 +2072,16 @@ static int queue_ext_point(Gpx *gpx, double feedrate) Point5d steps = mm_to_steps(gpx, &target, &gpx->excess); + // Total time required for the motion in units of microseconds double usec = (60000000.0 * minutes); + // Time interval between steps along the axis with the highest step count + // total-time / highest-step-count + // Has units of microseconds per step double dda_interval = usec / largest_axis(gpx->command.flag, &deltaSteps); // Convert dda_interval into dda_rate (dda steps per second on the longest axis) + // steps-per-microsecond * 1000000 us/s = 1000000 * (1 / dda_interval) double dda_rate = 1000000.0 / dda_interval; gpx->accumulated.time += (minutes * 60) * ACCELERATION_TIME;