add code injection at pause layers
This commit is contained in:
parent
3a4ef4ac61
commit
69711eb34d
2 changed files with 23 additions and 7 deletions
|
|
@ -381,6 +381,8 @@ var gs_kiri_fdm = exports;
|
||||||
trackProgress = device.gcodeTrack,
|
trackProgress = device.gcodeTrack,
|
||||||
time = 0,
|
time = 0,
|
||||||
layer = 0,
|
layer = 0,
|
||||||
|
pause = [],
|
||||||
|
pauseCmd = device.gcodePause,
|
||||||
output = [],
|
output = [],
|
||||||
outputLength = 0,
|
outputLength = 0,
|
||||||
lastProgress = 0,
|
lastProgress = 0,
|
||||||
|
|
@ -423,6 +425,11 @@ var gs_kiri_fdm = exports;
|
||||||
lines = 0,
|
lines = 0,
|
||||||
bytes = 0;
|
bytes = 0;
|
||||||
|
|
||||||
|
(process.gcodePauseLayers || "").split(",").forEach(function(lv) {
|
||||||
|
var v = parseInt(lv);
|
||||||
|
if (v >= 0) pause.push(v);
|
||||||
|
});
|
||||||
|
|
||||||
if (online) {
|
if (online) {
|
||||||
append = function(line) {
|
append = function(line) {
|
||||||
if (line) {
|
if (line) {
|
||||||
|
|
@ -533,15 +540,21 @@ var gs_kiri_fdm = exports;
|
||||||
device.filamentSize,
|
device.filamentSize,
|
||||||
path.layer === 0 ? process.firstSliceHeight : path.height);
|
path.layer === 0 ? process.firstSliceHeight : path.height);
|
||||||
|
|
||||||
|
consts.layer = layer;
|
||||||
|
consts.height = path.height.toFixed(3);
|
||||||
|
|
||||||
|
if (pauseCmd && pause.indexOf(layer) >= 0) {
|
||||||
|
for (var i=0; i<pauseCmd.length; i++) {
|
||||||
|
append(constReplace(pauseCmd[i], consts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (trackLayers && trackLayers.length) {
|
if (trackLayers && trackLayers.length) {
|
||||||
trackLayers.forEach(function(line) {
|
trackLayers.forEach(function(line) {
|
||||||
append(constReplace(line, {
|
append(constReplace(line, consts));
|
||||||
progress: progress,
|
|
||||||
layer: layer,
|
|
||||||
height: path.height.toFixed(3)}));
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
append("; --- layer " + layer + " (" + path.height.toFixed(3) + " @ " + zpos.toFixed(3) + ") ---");
|
append("; --- layer " + layer + " (" + consts.height + " @ " + zpos.toFixed(3) + ") ---");
|
||||||
}
|
}
|
||||||
|
|
||||||
// second layer fan on
|
// second layer fan on
|
||||||
|
|
@ -602,11 +615,11 @@ var gs_kiri_fdm = exports;
|
||||||
// update time and distance (should calc in moveTo() instead)
|
// update time and distance (should calc in moveTo() instead)
|
||||||
time += (dist / speedMMM) * 60 * 1.5;
|
time += (dist / speedMMM) * 60 * 1.5;
|
||||||
distance += dist;
|
distance += dist;
|
||||||
progress = Math.round((distance / totaldistance) * 100);
|
consts.progress = progress = Math.round((distance / totaldistance) * 100);
|
||||||
|
|
||||||
// emit tracked progress
|
// emit tracked progress
|
||||||
if (trackProgress && progress != lastProgress) {
|
if (trackProgress && progress != lastProgress) {
|
||||||
append(constReplace(trackProgress, {progress:progress}));
|
append(constReplace(trackProgress, consts));
|
||||||
lastProgress = progress;
|
lastProgress = progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
// detectThinWalls: 1,
|
// detectThinWalls: 1,
|
||||||
antiBacklash: 1,
|
antiBacklash: 1,
|
||||||
gcodeKFactor: 1,
|
gcodeKFactor: 1,
|
||||||
|
gcodePauseLayers: 1,
|
||||||
outputClockwise: 1,
|
outputClockwise: 1,
|
||||||
outputOriginCenter: 1,
|
outputOriginCenter: 1,
|
||||||
outputInvertX: 1,
|
outputInvertX: 1,
|
||||||
|
|
@ -311,6 +312,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
detectThinWalls: false,
|
detectThinWalls: false,
|
||||||
antiBacklash: 2,
|
antiBacklash: 2,
|
||||||
gcodeKFactor: 0,
|
gcodeKFactor: 0,
|
||||||
|
gcodePauseLayers: "",
|
||||||
outputCooling: true,
|
outputCooling: true,
|
||||||
|
|
||||||
// --- LASER ---
|
// --- LASER ---
|
||||||
|
|
@ -2510,6 +2512,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
|
|
||||||
gcodeVars: UC.newGroup("gcode", null, {modes:FDM}),
|
gcodeVars: UC.newGroup("gcode", null, {modes:FDM}),
|
||||||
gcodeKFactor: UC.newInput("k-factor", {title: "aka linear advance\nuse {kfactor} in gcode", convert:UC.toInt, modes:FDM}),
|
gcodeKFactor: UC.newInput("k-factor", {title: "aka linear advance\nuse {kfactor} in gcode", convert:UC.toInt, modes:FDM}),
|
||||||
|
gcodePauseLayers: UC.newInput("pause layers", {title: "comma-separated list of layers\nto inject pause commands between", modes:FDM}),
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue