Attempt to fix #123.

This commit is contained in:
Rob Giseburt
2016-10-27 09:53:00 -05:00
parent 21a197f736
commit a3db4bb886
2 changed files with 10 additions and 0 deletions
+1
View File
@@ -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
+9
View File
@@ -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<AXES; a++) {
#if 1
float to_add = (mr.unit[a] * segment_length) - mr.gm.target_comp[a];
float target = mr.position[a] + to_add;
mr.gm.target_comp[a] = (target - mr.position[a]) - to_add;
mr.gm.target[a] = target;
#else
mr.gm.target[a] = mr.position[a] + (mr.unit[a] * segment_length);
#endif
}
}