add palette3 printer id editing, segment data for generating palette files, persistence of palette data in settings

This commit is contained in:
Stewart Allen 2021-11-10 11:40:34 -05:00
commit 929fe8f35a
6 changed files with 54 additions and 5 deletions

View file

@ -120,7 +120,8 @@
inloops = 0,
arcQ = [],
minz = { x: Infinity, y: Infinity, z: Infinity },
isPalette = device.filamentSource === 'palette3';
isPalette = device.filamentSource === 'palette3',
segments = [];
// smallish band-aid. refactor above to remove redundancy
function updateParams(layer) {
@ -485,6 +486,7 @@
// look for extruder change, run scripts, recalc emit factor
if (out.tool !== undefined && out.tool != tool) {
segments.push({emitted, tool});
appendAllSub(extruder.extDeselect);
tool = out.tool;
subst.nozzle = subst.tool = tool;
@ -496,7 +498,10 @@
extruder.extFilament,
path.layer === 0 ?
(process.firstSliceHeight || process.sliceHeight) : path.height);
appendAllSub(extruder.extSelect);
// do not run extruder swapping code when source is Palette3
if (!isPalette) {
appendAllSub(extruder.extSelect);
}
}
// if no point in output, it's a dwell command
@ -804,6 +809,7 @@
append(`M808`);
}
segments.push({emitted, tool});
subst.material = UTIL.round(emitted,2);
subst.time = UTIL.round(time,2);
subst['print_time'] = subst.time;
@ -816,12 +822,14 @@
// force emit of buffer
append();
print.segments = segments;
print.distance = emitted;
print.lines = lines;
print.bytes = bytes + lines - 1;
print.time = time;
if (debug) {
console.log('segments', segments);
console.log('minz', minz);
}
};

View file

@ -242,6 +242,7 @@
}
}
// determine size/location of purge blocks
let blokpos, walkpos, blok;
if (bounds.min.x < bounds.min.y) {
let dx = ((bounds.max.x - bounds.min.x) - (extcount * 10)) / 2 + 5;
@ -255,7 +256,7 @@
blok = { x:4, y:9 };
}
// compute purge blocks
// replace extruders array with object array containing more info
extruders = extruders.map((ext,i) => {
if (!ext) return ext;
let noz = device.extruders[i].extNozzle,