improve ping accuracy, define pause point
This commit is contained in:
parent
7f576d61ce
commit
8f3c82476f
2 changed files with 47 additions and 22 deletions
|
|
@ -76,10 +76,12 @@
|
||||||
originCenter = process.outputOriginCenter || device.bedRound,
|
originCenter = process.outputOriginCenter || device.bedRound,
|
||||||
offset = originCenter ? {
|
offset = originCenter ? {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0,
|
||||||
|
z: 0
|
||||||
} : {
|
} : {
|
||||||
x: device.bedWidth/2,
|
x: device.bedWidth/2,
|
||||||
y: isBelt ? 0 : device.bedDepth/2
|
y: isBelt ? 0 : device.bedDepth/2,
|
||||||
|
z: 0
|
||||||
},
|
},
|
||||||
nozzleTemp = process.firstLayerNozzleTemp || process.outputTemp,
|
nozzleTemp = process.firstLayerNozzleTemp || process.outputTemp,
|
||||||
bedTemp = process.firstLayerBedTemp || process.outputBedTemp,
|
bedTemp = process.firstLayerBedTemp || process.outputBedTemp,
|
||||||
|
|
@ -127,8 +129,9 @@
|
||||||
palettePingSpace = paletteInfo.ping || 0,
|
palettePingSpace = paletteInfo.ping || 0,
|
||||||
segments = [],
|
segments = [],
|
||||||
// track purges for palette3 pings
|
// track purges for palette3 pings
|
||||||
purgeOff = 0,
|
purgePos,
|
||||||
purgeOn;
|
purgeOn = 0,
|
||||||
|
purgeOff = 0;
|
||||||
|
|
||||||
// smallish band-aid. refactor above to remove redundancy
|
// smallish band-aid. refactor above to remove redundancy
|
||||||
function updateParams(layer) {
|
function updateParams(layer) {
|
||||||
|
|
@ -183,11 +186,6 @@
|
||||||
}
|
}
|
||||||
let loops = isBelt && rloops.length ? rloops : undefined;
|
let loops = isBelt && rloops.length ? rloops : undefined;
|
||||||
|
|
||||||
// (process.gcodePauseLayers || "").split(",").forEach(function(lv) {
|
|
||||||
// let v = parseInt(lv);
|
|
||||||
// if (v >= 0) pause.push(v);
|
|
||||||
// });
|
|
||||||
|
|
||||||
append = function(line) {
|
append = function(line) {
|
||||||
if (line) {
|
if (line) {
|
||||||
lines++;
|
lines++;
|
||||||
|
|
@ -346,7 +344,11 @@
|
||||||
|
|
||||||
function pushPos(newpos, rate, comment) {
|
function pushPos(newpos, rate, comment) {
|
||||||
savePos = Object.clone(pos);
|
savePos = Object.clone(pos);
|
||||||
moveTo(newpos, rate, comment);
|
moveTo({
|
||||||
|
x: newpos.x + offset.x,
|
||||||
|
y: newpos.y + offset.y,
|
||||||
|
z: newpos.z + offset.z
|
||||||
|
}, rate, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
function popPos(rate, comment) {
|
function popPos(rate, comment) {
|
||||||
|
|
@ -354,6 +356,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveTo(newpos, rate, comment) {
|
function moveTo(newpos, rate, comment) {
|
||||||
|
if (pingRemain) {
|
||||||
|
if (newpos.e) {
|
||||||
|
if (pingRemain - newpos.e < -0.4) {
|
||||||
|
// split move if ping over-extrudes? complicates emitted calc.
|
||||||
|
// console.log({over_ping: pingRemain - newpos.e});
|
||||||
|
}
|
||||||
|
pingRemain -= newpos.e;
|
||||||
|
}
|
||||||
|
}
|
||||||
let o = [!rate && !newpos.e ? 'G0' : 'G1'];
|
let o = [!rate && !newpos.e ? 'G0' : 'G1'];
|
||||||
let emit = { x: false, y: false, z: false };
|
let emit = { x: false, y: false, z: false };
|
||||||
if (typeof newpos.x === 'number' && newpos.x !== pos.x) {
|
if (typeof newpos.x === 'number' && newpos.x !== pos.x) {
|
||||||
|
|
@ -419,7 +430,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// calc total distance traveled by head as proxy for progress
|
// calc total distance traveled by head as proxy for progress
|
||||||
let allout = [], totaldistance = 0;
|
let allout = [];
|
||||||
|
let totaldistance = 0;
|
||||||
layers.forEach(function(outs) {
|
layers.forEach(function(outs) {
|
||||||
allout.appendAll(outs);
|
allout.appendAll(outs);
|
||||||
});
|
});
|
||||||
|
|
@ -427,6 +439,9 @@
|
||||||
totaldistance += o1.point.distTo2D(o2.point);
|
totaldistance += o1.point.distTo2D(o2.point);
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
// for palette pings, amount of extrusion left
|
||||||
|
let pingRemain = 0;
|
||||||
|
|
||||||
// retract before first move
|
// retract before first move
|
||||||
retract();
|
retract();
|
||||||
|
|
||||||
|
|
@ -517,23 +532,25 @@
|
||||||
// do not generate pings before total tube length exhausted
|
// do not generate pings before total tube length exhausted
|
||||||
// because the palette cannot respond to differences before then
|
// because the palette cannot respond to differences before then
|
||||||
if (isPalette && palettePingSpace && emitted >= palettePingStart) {
|
if (isPalette && palettePingSpace && emitted >= palettePingStart) {
|
||||||
if (out.point.purgeOn && (purgeOff === 0 || emitted - purgeOff >= palettePingSpace)) {
|
if (purgeOn === 0 && out.point.purgeOn && emitted - purgeOff >= palettePingSpace) {
|
||||||
retract();
|
retract();
|
||||||
if (isBelt) pushPos({x:195});
|
pushPos(out.point.purgeOn);
|
||||||
append(`G4 P4000`); append('G1');
|
append(`G4 P4000`); append('G1');
|
||||||
append(`G4 P4000`); append('G1');
|
append(`G4 P4000`); append('G1');
|
||||||
append(`G4 P4000`); append('G1');
|
append(`G4 P4000`); append('G1');
|
||||||
append(`G4 P1000`);
|
append(`G4 P1000`);
|
||||||
if (isBelt) popPos();
|
popPos();
|
||||||
unretract();
|
unretract();
|
||||||
purgeOn = emitted;
|
purgeOn = emitted;
|
||||||
|
purgePos = out.point.purgeOn;
|
||||||
|
pingRemain = 20;
|
||||||
}
|
}
|
||||||
if (purgeOn && out.point.purgeOff) {
|
if (purgeOn && pingRemain <= 0) {
|
||||||
retract();
|
retract();
|
||||||
if (isBelt) pushPos({x:195});
|
pushPos(purgePos);
|
||||||
append(`G4 P4000`); append('G1');
|
append(`G4 P4000`); append('G1');
|
||||||
append(`G4 P3000`);
|
append(`G4 P3000`);
|
||||||
if (isBelt) popPos();
|
popPos();
|
||||||
unretract();
|
unretract();
|
||||||
if (!print.purges) {
|
if (!print.purges) {
|
||||||
print.purges = [];
|
print.purges = [];
|
||||||
|
|
@ -544,6 +561,7 @@
|
||||||
});
|
});
|
||||||
purgeOff = emitted;
|
purgeOff = emitted;
|
||||||
purgeOn = 0;
|
purgeOn = 0;
|
||||||
|
pingRemain = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,8 @@
|
||||||
diameter: exi.extNozzle,
|
diameter: exi.extNozzle,
|
||||||
rect,
|
rect,
|
||||||
full,
|
full,
|
||||||
sparse
|
sparse,
|
||||||
|
pause: newPoint(pos.x + walkpos.y, pos.y + walkpos.x, pos.z)
|
||||||
};
|
};
|
||||||
return rec;
|
return rec;
|
||||||
}
|
}
|
||||||
|
|
@ -357,13 +358,19 @@
|
||||||
wipe = false;
|
wipe = false;
|
||||||
}
|
}
|
||||||
let box = rec.rect.clone().setZ(z);
|
let box = rec.rect.clone().setZ(z);
|
||||||
|
let pause = rec.pause.clone().setZ(z);
|
||||||
let fill = (z >= 0 && purgeOn ? rec.full : rec.sparse).clone().setZ(z);
|
let fill = (z >= 0 && purgeOn ? rec.full : rec.sparse).clone().setZ(z);
|
||||||
if (isBelt) {
|
if (isBelt) {
|
||||||
box.move({x:0, y:z, z:0});
|
let bmove = {x:0, y:z, z:0};
|
||||||
if (fill) fill.move({x:0, y:z, z:0});
|
box.move(bmove);
|
||||||
|
pause.move(bmove);
|
||||||
|
if (fill) {
|
||||||
|
fill.move(bmove);
|
||||||
|
}
|
||||||
if (offset) {
|
if (offset) {
|
||||||
let bo = { x:0, y:offset.y, z:offset.z };
|
let bo = { x:0, y:offset.y, z:offset.z };
|
||||||
box.move(bo);
|
box.move(bo);
|
||||||
|
pause.move(bo);
|
||||||
if (fill) fill.move(bo);
|
if (fill) fill.move(bo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -375,12 +382,13 @@
|
||||||
onfirstout: (out => out.overate = (isBelt ? rate : 0))
|
onfirstout: (out => out.overate = (isBelt ? rate : 0))
|
||||||
});
|
});
|
||||||
if (fill && fill.length) {
|
if (fill && fill.length) {
|
||||||
|
// for pings, split path at 20mm
|
||||||
start = print.polyPrintPath(fill, start, layer, {
|
start = print.polyPrintPath(fill, start, layer, {
|
||||||
tool,
|
tool,
|
||||||
rate,
|
rate,
|
||||||
simple: true,
|
simple: true,
|
||||||
open: true,
|
open: true,
|
||||||
onfirst: (point) => { point.purgeOn = purgeOn }
|
onfirst: (point) => { point.purgeOn = purgeOn ? pause : undefined }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
layer.last().retract = true;
|
layer.last().retract = true;
|
||||||
|
|
@ -393,7 +401,6 @@
|
||||||
extrude: 0
|
extrude: 0
|
||||||
});
|
});
|
||||||
layer.last().overate = 0;
|
layer.last().overate = 0;
|
||||||
start.purgeOff = purgeOn;
|
|
||||||
return start;
|
return start;
|
||||||
} else {
|
} else {
|
||||||
console.log({no_purge_tower_for: nozzle, using, track, layer});
|
console.log({no_purge_tower_for: nozzle, using, track, layer});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue