add experimental acceleration compensation

This commit is contained in:
Stewart Allen 2017-12-15 12:16:41 -05:00
commit 7550e8dc81
3 changed files with 17 additions and 9 deletions

View file

@ -409,7 +409,9 @@ var gs_kiri_print = exports;
var options = options || {},
process = this.settings.process,
accelComp = process.outputAccelComp,
shortDist = process.outputShortDistance,
shortDist2 = process.outputShortDistance * 2,
shortFact = process.outputShortFactor,
shellMult = options.extrude || process.outputShellMult,
printSpeed = options.rate || process.outputFeedrate,
@ -430,13 +432,16 @@ var gs_kiri_print = exports;
if (options.shorten && dist > options.shorten && count === points.length) {
point = last.offsetPointFrom(point, options.shorten);
}
// if (options.accel && dist >= options.accel) {
// var p2 = last.offsetPointTo(point, shortDist),
// p3 = last.offsetPointFrom(point, shortDist);
// segmentOutput(output, last, p2, shortSpeed, printSpeed, 5, shellMult);
// addOutput(output, p3, shellMult, printSpeed);
// segmentOutput(output, p3, point, printSpeed, shortSpeed, 5, shellMult);
// } else
if (accelComp && options.accel && dist >= shortDist) {
var sl = dist > shortDist2 ? shortDist : dist / 2,
ml = dist > shortDist2 ? dist - sl - sl : 0,
ps = dist > shortDist2 ? printSpeed : (sl / shortDist) * printSpeed,
p2 = last.offsetPointTo(point, sl),
p3 = last.offsetPointFrom(point, sl);
segmentOutput(output, last, p2, shortSpeed, ps, 5, shellMult);
if (ml) addOutput(output, p3, shellMult, printSpeed);
segmentOutput(output, p3, point, ps, shortSpeed, 5, shellMult);
} else
if (shortDist && dist < shortDist) {
var shortRate = shortSpeed + (printSpeed - shortSpeed) * (dist / shortDist);
addOutput(output, point, shellMult, shortRate);
@ -522,7 +527,7 @@ var gs_kiri_print = exports;
var finishShell = poly.depth === 0 && !firstLayer;
startPoint = scope.polyPrintPath(poly, startPoint, preout, {
rate: finishShell ? process.outputFinishrate : printSpeed,
accel: finishShell ? process.outputShortDistance * 2 : 0,
accel: finishShell,
shorten: finishShell && !firstLayer ? nozzle / 2 : 0,
extrude: shellMult,
onfirst: function(firstPoint) {