From a3db4bb886cb1573ef65cde6608158a37320dff1 Mon Sep 17 00:00:00 2001 From: Rob Giseburt Date: Mon, 10 Oct 2016 14:27:08 -0500 Subject: [PATCH] Attempt to fix #123. --- g2core/canonical_machine.h | 1 + g2core/plan_exec.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/g2core/canonical_machine.h b/g2core/canonical_machine.h index 1a7c1991..61c2b8f5 100755 --- a/g2core/canonical_machine.h +++ b/g2core/canonical_machine.h @@ -324,6 +324,7 @@ typedef struct GCodeState { // Gcode model state - used by model, pl // G82, G83 G84, G85, G86, G87, G88, G89 float target[AXES]; // XYZABC where the move should go + float target_comp[AXES]; // summation compensation (Kahan) overflow value float work_offset[AXES]; // offset from the work coordinate system (for reporting only) float feed_rate; // F - normalized to millimeters/minute or in inverse time mode diff --git a/g2core/plan_exec.cpp b/g2core/plan_exec.cpp index 5627476f..84c57d5b 100755 --- a/g2core/plan_exec.cpp +++ b/g2core/plan_exec.cpp @@ -896,8 +896,17 @@ static stat_t _exec_aline_segment() copy_vector(mr.gm.target, mr.waypoint[mr.section]); } else { float segment_length = mr.segment_velocity * mr.segment_time; + // see https://en.wikipedia.org/wiki/Kahan_summation_algorithm + // for the summation compensation description for (uint8_t a=0; a