mirror of
https://github.com/synthetos/g2.git
synced 2026-09-22 19:43:53 +08:00
Attempt to fix #123.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user