diff --git a/src/kiri/conf.js b/src/kiri/conf.js
index 4346a5e8..8fc1352e 100644
--- a/src/kiri/conf.js
+++ b/src/kiri/conf.js
@@ -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
diff --git a/src/kiri/init.js b/src/kiri/init.js
index 5b926bd6..c25825da 100644
--- a/src/kiri/init.js
+++ b/src/kiri/init.js
@@ -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:''}),
UI.extAdd = UC.newButton(undefined, undefined, {icon:''}),
@@ -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
diff --git a/src/kiri/worker.js b/src/kiri/worker.js
index 7b9617ee..9f0a7981 100644
--- a/src/kiri/worker.js
+++ b/src/kiri/worker.js
@@ -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 }
});
},
diff --git a/src/mode/fdm/export.js b/src/mode/fdm/export.js
index 0376a028..c5247c06 100644
--- a/src/mode/fdm/export.js
+++ b/src/mode/fdm/export.js
@@ -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);
}
};
diff --git a/src/mode/fdm/prepare.js b/src/mode/fdm/prepare.js
index c3063362..209b5310 100644
--- a/src/mode/fdm/prepare.js
+++ b/src/mode/fdm/prepare.js
@@ -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,
diff --git a/web/kiri/index.css b/web/kiri/index.css
index 0d75a95b..2035015e 100644
--- a/web/kiri/index.css
+++ b/web/kiri/index.css
@@ -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;