add gcode PREAMBLE control for ultimaker
This commit is contained in:
parent
58a6f9c5b1
commit
07b7cc0454
1 changed files with 39 additions and 20 deletions
|
|
@ -249,30 +249,47 @@ FDM.export = function(print, online, ondone, ondebug) {
|
|||
append(arg.join(''));
|
||||
}
|
||||
|
||||
append(`; Generated by Kiri:Moto ${kiri.version}`);
|
||||
append(`; ${new Date().toString()}`);
|
||||
appendSub("; Bed left:{left} right:{right} top:{top} bottom:{bottom}");
|
||||
append(`; Bed type: ${bedType}`);
|
||||
append(`; Target: ${filter[mode]}`);
|
||||
// inject thumbnail preview
|
||||
if (exportThumb && worker.snap) {
|
||||
let { width, height, url } = worker.snap;
|
||||
let data = url.substring(url.indexOf(',') + 1);
|
||||
append(`; thumbnail begin ${width} ${height} ${data.length}`);
|
||||
for (let i=0; i<data.length; i += 78) {
|
||||
append(`; ${data.substring(i, i + 78)}`);
|
||||
function preamble() {
|
||||
append(`; Generated by Kiri:Moto ${kiri.version}`);
|
||||
append(`; ${new Date().toString()}`);
|
||||
appendSub("; Bed left:{left} right:{right} top:{top} bottom:{bottom}");
|
||||
append(`; Bed type: ${bedType}`);
|
||||
append(`; Target: ${filter[mode]}`);
|
||||
// inject thumbnail preview
|
||||
if (exportThumb && worker.snap) {
|
||||
let { width, height, url } = worker.snap;
|
||||
let data = url.substring(url.indexOf(',') + 1);
|
||||
append(`; thumbnail begin ${width} ${height} ${data.length}`);
|
||||
for (let i=0; i<data.length; i += 78) {
|
||||
append(`; ${data.substring(i, i + 78)}`);
|
||||
}
|
||||
append('; thumbnail end');
|
||||
}
|
||||
append('; thumbnail end');
|
||||
append("; --- process ---");
|
||||
for (let pk in process) {
|
||||
appendTok("; ", pk, " = ", process[pk]);
|
||||
}
|
||||
append("; --- startup ---");
|
||||
}
|
||||
append("; --- process ---");
|
||||
for (let pk in process) {
|
||||
appendTok("; ", pk, " = ", process[pk]);
|
||||
|
||||
// lookg for ";; PREAMBLE <MODE>" comment
|
||||
let pre = 0;
|
||||
let gcpre = [];
|
||||
for (let line of device.gcodePre) {
|
||||
line = line.trim();
|
||||
if (line.indexOf(";; PREAMBLE ") === 0) {
|
||||
if (line === ';; PREAMBLE OFF') pre = 1;
|
||||
if (line === ';; PREAMBLE END') pre = 2;
|
||||
} else {
|
||||
gcpre.push(line);
|
||||
}
|
||||
}
|
||||
append("; --- startup ---");
|
||||
|
||||
if (pre === 0) preamble();
|
||||
|
||||
let t0 = false;
|
||||
let t1 = false;
|
||||
for (let i=0; i<device.gcodePre.length; i++) {
|
||||
let line = device.gcodePre[i];
|
||||
for (let line of gcpre) {
|
||||
if (line.indexOf('T0') === 0) t0 = true; else
|
||||
if (line.indexOf('T1') === 0) t1 = true; else
|
||||
if (line.indexOf('M82') === 0) {
|
||||
|
|
@ -320,6 +337,8 @@ FDM.export = function(print, online, ondone, ondebug) {
|
|||
}
|
||||
}
|
||||
|
||||
if (pre === 2) preamble();
|
||||
|
||||
function dwell(ms) {
|
||||
time += ms/1000;
|
||||
// break up dwell times over 4s because of
|
||||
|
|
|
|||
Loading…
Reference in a new issue