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

@ -716,6 +716,8 @@
synth: {},
// widget extra info for slicing (extruder mapping)
widget: {},
// other stored info like palette3 config
extras: {},
mode: 'FDM',
id: genID(),
ver: CVER

View file

@ -109,12 +109,33 @@
}
}
function filamentSourceEditUpdate() {
if (UI.filamentSource && UI.filamentSourceEdit) {
const sel = UI.filamentSource.options[UI.filamentSource.selectedIndex];
if (sel) {
UI.filamentSourceEdit.style.display = sel.value === 'palette3' ? '' : 'none';
}
}
}
function filamentSourceSave() {
const sel = UI.filamentSource.options[UI.filamentSource.selectedIndex];
if (sel) {
settings().device.filamentSource = sel.value;
API.conf.save();
}
filamentSourceEditUpdate();
}
function palette3Config() {
let conf = API.conf.get().extras;
if (!conf.palette) {
conf.palette = { printer: "uuid" };
}
let uuid = prompt('Printer UID from Canvas', conf.palette.printer);
if (uuid) {
conf.palette.printer = uuid;
}
}
function detailSave() {
@ -868,6 +889,7 @@
}
UC.refresh();
filamentSourceEditUpdate();
if (dev.imageURL) {
if (dev.imageURL !== deviceURL) {
@ -1642,6 +1664,7 @@
extOffsetY: UC.newInput(LANG.dv_exoy_s, {title:LANG.dv_exoy_l, convert:UC.toFloat, modes:FDM}),
extSelect: UC.newText(LANG.dv_exts_s, {title:LANG.dv_exts_l, modes:FDM, size:14, height:3, modes:FDM, area:gcode}),
extDeselect: UC.newText(LANG.dv_dext_s, {title:LANG.dv_dext_l, modes:FDM, size:14, height:3, modes:FDM, area:gcode}),
extPad: UC.newBlank({class:"grow", modes:FDM}),
extActions: UC.newRow([
UI.extPrev = UC.newButton(undefined, undefined, {icon:'<i class="fas fa-less-than"></i>'}),
UI.extAdd = UC.newButton(undefined, undefined, {icon:'<i class="fas fa-plus"></i>'}),
@ -2764,6 +2787,16 @@
API.show.alert("this is a beta / development release");
SDB.kiri_beta = KIRI.beta;
}
// add palette3 edit button after filament source selector
{
let fsp = UI.filamentSource.parentNode;
let btn = UI.filamentSourceEdit = DOC.createElement('button');
btn.setAttribute('id', 'fs-edit');
btn.appendChild(DOC.createTextNode('edit'));
fsp.insertBefore(btn, UI.filamentSource);
btn.onclick = palette3Config;
}
}
// update static html elements with language overrides

View file

@ -446,11 +446,11 @@ KIRI.worker = {
}, function(debug) {
send.data({debug});
});
const { bounds, time, lines, bytes, distance, settings } = current.print;
const { bounds, time, lines, bytes, distance, settings, segments } = current.print;
send.done({
done: true,
output: output ? output : { bounds, time, lines, bytes, distance, settings }
output: output ? output : { bounds, time, lines, bytes, distance, settings, segments }
});
},

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,

View file

@ -1739,6 +1739,11 @@ th, tr, td, label {
font-family: monospace;
}
#fs-edit {
text-transform: none;
padding: 1px 3px 1px 3px;
margin: 0 3px 0 0 !important;
}
#gdpr {
position: absolute;
display: none;