get sla working
This commit is contained in:
parent
c5d9442fe6
commit
01b81a101d
11 changed files with 142 additions and 157 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -7,7 +7,7 @@ logs
|
|||
mod
|
||||
node_modules
|
||||
package-lock.json
|
||||
src/ext/three.js
|
||||
three.js
|
||||
tmp
|
||||
.docusaurus
|
||||
build
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
|
||||
export const client = {
|
||||
import { $ } from '../../moto/webui.js';
|
||||
import { api } from '../../kiri/api.js';
|
||||
|
||||
export const SLA = {
|
||||
init,
|
||||
printDownload
|
||||
};
|
||||
}
|
||||
|
||||
function init(kiri, api) {
|
||||
export function init() {
|
||||
api.event.on("mode.set", (mode) => {
|
||||
if (mode === 'SLA') {
|
||||
api.ui.func.preview.classList.add('hide');
|
||||
|
|
@ -15,71 +18,66 @@ function init(kiri, api) {
|
|||
});
|
||||
}
|
||||
|
||||
function printDownload(output, api, names) {
|
||||
export function printDownload(output, api, names) {
|
||||
const { file, width, height, layers, volume } = output;
|
||||
const fileroot = names[0] || "print";
|
||||
const filename = `${fileroot}-${new Date().getTime().toString(36)}`;
|
||||
|
||||
api.modal.show('xsla');
|
||||
// api.ajax("/kiri/output-sla.html", html => {
|
||||
// api.ui.print.innerHTML = html;
|
||||
|
||||
let settings = api.conf.get(),
|
||||
process = settings.process,
|
||||
device = settings.device,
|
||||
print_sec = (process.slaBaseLayers * process.slaBaseOn) +
|
||||
(layers - process.slaBaseLayers) * process.slaLayerOn;
|
||||
let settings = api.conf.get(),
|
||||
process = settings.process,
|
||||
device = settings.device,
|
||||
print_sec = (process.slaBaseLayers * process.slaBaseOn) +
|
||||
(layers - process.slaBaseLayers) * process.slaLayerOn;
|
||||
|
||||
// add peel lift/drop times to total print time
|
||||
for (let i=0; i<layers; i++) {
|
||||
let dist = process.slaPeelDist,
|
||||
lift = process.slaPeelLiftRate,
|
||||
drop = process.slaPeelDropRate,
|
||||
off = process.slaLayerOff;
|
||||
if (i < process.slaBaseLayers) {
|
||||
dist = process.slaBasePeelDist;
|
||||
lift = process.slaBasePeelLiftRate;
|
||||
off = process.slaBaseOff;
|
||||
}
|
||||
print_sec += (dist * lift) / 60;
|
||||
print_sec += (dist * drop) / 60;
|
||||
print_sec += off;
|
||||
// add peel lift/drop times to total print time
|
||||
for (let i = 0; i < layers; i++) {
|
||||
let dist = process.slaPeelDist,
|
||||
lift = process.slaPeelLiftRate,
|
||||
drop = process.slaPeelDropRate,
|
||||
off = process.slaLayerOff;
|
||||
if (i < process.slaBaseLayers) {
|
||||
dist = process.slaBasePeelDist;
|
||||
lift = process.slaBasePeelLiftRate;
|
||||
off = process.slaBaseOff;
|
||||
}
|
||||
print_sec += (dist * lift) / 60;
|
||||
print_sec += (dist * drop) / 60;
|
||||
print_sec += off;
|
||||
}
|
||||
|
||||
let print_min = Math.floor(print_sec/60),
|
||||
print_hrs = Math.floor(print_min/60),
|
||||
download = $('print-sla');
|
||||
let print_min = Math.floor(print_sec / 60),
|
||||
print_hrs = Math.floor(print_min / 60),
|
||||
download = $('print-sla');
|
||||
|
||||
// add lift/drop time
|
||||
print_sec -= (print_min * 60);
|
||||
print_min -= (print_hrs * 60);
|
||||
print_sec = Math.round(print_sec).toString().padStart(2,'0');
|
||||
print_min = print_min.toString().padStart(2,'0');
|
||||
print_hrs = print_hrs.toString().padStart(2,'0');
|
||||
// add lift/drop time
|
||||
print_sec -= (print_min * 60);
|
||||
print_min -= (print_hrs * 60);
|
||||
print_sec = Math.round(print_sec).toString().padStart(2, '0');
|
||||
print_min = print_min.toString().padStart(2, '0');
|
||||
print_hrs = print_hrs.toString().padStart(2, '0');
|
||||
|
||||
$('print-filename-sla').value = filename;
|
||||
$('print-volume').value = (volume/1000).round(2);
|
||||
$('print-layers').value = layers;
|
||||
$('print-time').value = `${print_hrs}:${print_min}:${print_sec}`;
|
||||
$('print-filename-sla').value = filename;
|
||||
$('print-volume').value = (volume / 1000).round(2);
|
||||
$('print-layers').value = layers;
|
||||
$('print-time').value = `${print_hrs}:${print_min}:${print_sec}`;
|
||||
|
||||
switch (device.deviceName) {
|
||||
case 'Anycubic.Photon':
|
||||
download.innerText += " .photon";
|
||||
download.onclick = () => { saveFile(api, file, ".photon") };
|
||||
break;
|
||||
case 'Anycubic.Photon.S':
|
||||
download.innerText += " .photons";
|
||||
download.onclick = () => { saveFile(api, file, ".photons") };
|
||||
break;
|
||||
case 'Creality.Halot.Sky':
|
||||
default:
|
||||
download.innerText += " .cxdlp";
|
||||
download.onclick = () => { saveFile(api, file, ".cxdlp") };
|
||||
break;
|
||||
}
|
||||
|
||||
// api.modal.show('print');
|
||||
// });
|
||||
switch (device.deviceName) {
|
||||
case 'Anycubic.Photon':
|
||||
download.innerText += " .photon";
|
||||
download.onclick = () => { saveFile(api, file, ".photon") };
|
||||
break;
|
||||
case 'Anycubic.Photon.S':
|
||||
download.innerText += " .photons";
|
||||
download.onclick = () => { saveFile(api, file, ".photons") };
|
||||
break;
|
||||
case 'Creality.Halot.Sky':
|
||||
default:
|
||||
download.innerText += " .cxdlp";
|
||||
download.onclick = () => { saveFile(api, file, ".cxdlp") };
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function saveFile(api, file, ext) {
|
||||
|
|
|
|||
|
|
@ -1,21 +1,30 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
|
||||
import { newPrint } from '../../kiri/print.js';
|
||||
import { sla_slice } from './slice.js';
|
||||
import { sla_export } from './export.js';
|
||||
|
||||
export const driver = {
|
||||
prepare,
|
||||
legacy: false
|
||||
export const SLA = {
|
||||
init,
|
||||
legacy: false,
|
||||
slice: sla_slice,
|
||||
prepare: sla_prepare,
|
||||
export: sla_export,
|
||||
};
|
||||
|
||||
if (driver.legacy) {
|
||||
if (SLA.legacy) {
|
||||
console.log("SLA Driver in Legacy Mode");
|
||||
}
|
||||
|
||||
function init(worker) {
|
||||
// console.log({ INIT_SLA: worker });
|
||||
}
|
||||
|
||||
// runs in worker. would usually be in src/mode/sla/prepare.js
|
||||
// but the SLA driver skips the prepare step because there is no path routing
|
||||
async function prepare(widgets, settings, update) {
|
||||
self.worker.print = newPrint(settings, widgets);
|
||||
if (!driver.wasm) {
|
||||
async function sla_prepare(widgets, settings, update) {
|
||||
self.kiri_worker.current.print = newPrint(settings, widgets);
|
||||
if (!SLA.wasm) {
|
||||
fetch('/wasm/kiri-sla.wasm')
|
||||
.then(response => response.arrayBuffer())
|
||||
.then(bytes => WebAssembly.instantiate(bytes, {
|
||||
|
|
@ -28,7 +37,7 @@ async function prepare(widgets, settings, update) {
|
|||
let {module, instance} = results;
|
||||
let {exports} = instance;
|
||||
let heap = new Uint8Array(exports.memory.buffer);
|
||||
driver.wasm = {
|
||||
SLA.wasm = {
|
||||
heap,
|
||||
memory: exports.memory,
|
||||
render: exports.render,
|
||||
|
|
@ -38,5 +47,3 @@ async function prepare(widgets, settings, update) {
|
|||
}
|
||||
update(1);
|
||||
}
|
||||
|
||||
export { prepare };
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
import { base } from '../geo/base.js';
|
||||
import { driver } from '../kiri-mode/sla/driver.js';
|
||||
import { x_cxdlp } from '../kiri-mode/sla/x_cxdlp.js';
|
||||
import { x_photon } from '../kiri-mode/sla/x_photon.js';
|
||||
|
||||
|
||||
const { base, kiri } = root
|
||||
const { driver } = kiri;
|
||||
const { util } = base;
|
||||
const { SLA } = driver;
|
||||
import { CXDLP } from './x_cxdlp.js';
|
||||
import { photon } from './x_photon.js';
|
||||
import { SLA } from './driver.js';
|
||||
|
||||
/**
|
||||
* DRIVER CONTRACT - runs in worker
|
||||
|
|
@ -16,7 +10,7 @@ const { SLA } = driver;
|
|||
* @param {Function} online streaming reply
|
||||
* @param {Function} ondone last reply
|
||||
*/
|
||||
SLA.export = function(print, online, ondone) {
|
||||
export function sla_export(print, online, ondone) {
|
||||
let widgets = print.widgets,
|
||||
settings = print.settings,
|
||||
device = settings.device,
|
||||
|
|
@ -164,9 +158,6 @@ SLA.export = function(print, online, ondone) {
|
|||
console.log('print.export', Date.now() - mark);
|
||||
};
|
||||
|
||||
function generateCXDLP(print, conf, progress) {
|
||||
export function generateCXDLP(print, conf, progress) {
|
||||
console.log({generateCXDLP: print, conf, progress});
|
||||
}
|
||||
|
||||
|
||||
export { generateCXDLP, widgets, isPhoton, legacyMode, d, masks, i, render, index, param, exp_func, file, part1, part2, slices, thumb, tdata, x, y, p, r, g, b, v, preview1, pdata, preview2 };
|
||||
|
|
|
|||
|
|
@ -1,20 +1,14 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
import { base } from '../geo/base.js';
|
||||
import { point } from '../geo/point.js';
|
||||
import { polygon } from '../geo/polygon.js';
|
||||
import { polygons } from '../geo/polygons.js';
|
||||
import { slice } from '../kiri/slice.js';
|
||||
import { driver } from '../kiri-mode/sla/driver.js';
|
||||
import { pngjs } from '../ext/pngjs.js';
|
||||
|
||||
import { util } from '../../geo/base.js';
|
||||
import { slicer } from '../../geo/slicer.js';
|
||||
import { newPolygon } from '../../geo/polygon.js';
|
||||
import { polygons as POLY } from '../../geo/polygons.js';
|
||||
import { newSlice, newTop } from '../../kiri/slice.js';
|
||||
import { doShells, doDiff, projectFlats, projectBridges } from '../fdm/slice.js';
|
||||
import { PNG } from '../../ext/pngjs.esm.js';
|
||||
import { SLA } from './driver.js';
|
||||
|
||||
const { base, kiri } = root;
|
||||
const { driver, newSlice, newTop } = kiri;
|
||||
const { util, newPoint, newPolygon, polygons } = base;
|
||||
const { SLA } = driver;
|
||||
|
||||
const POLY = polygons;
|
||||
const FDM = driver.FDM.share;
|
||||
const tracker = util.pwait;
|
||||
|
||||
let fill_cache;
|
||||
|
|
@ -26,9 +20,10 @@ let fill_cache;
|
|||
* @param {Function} onupdate (called with % complete and optional message)
|
||||
* @param {Function} ondone (called when complete with an array of Slice objects)
|
||||
*/
|
||||
SLA.slice = function(settings, widget, onupdate, ondone) {
|
||||
let { process, device, controller } = settings,
|
||||
isConcurrent = controller.threaded && kiri.minions.concurrent,
|
||||
export function sla_slice(settings, widget, onupdate, ondone) {
|
||||
let { minions } = self.kiri_worker,
|
||||
{ process, device, controller } = settings,
|
||||
isConcurrent = controller.threaded && minions.concurrent,
|
||||
work_total,
|
||||
work_remain;
|
||||
|
||||
|
|
@ -66,10 +61,10 @@ SLA.slice = function(settings, widget, onupdate, ondone) {
|
|||
break;
|
||||
}
|
||||
|
||||
let sws = self.worker.snap.url;
|
||||
let sws = self.kiri_worker.current.snap.url;
|
||||
let b64 = atob(sws.substring(sws.indexOf(',') + 1));
|
||||
let bin = Uint8Array.from(b64, c => c.charCodeAt(0));
|
||||
let img = new png.PNG();
|
||||
let img = new PNG();
|
||||
img.parse(bin, (err, data) => {
|
||||
SLA.preview = img;
|
||||
SLA.previewSmall = samplePNG(img, smallDims.x, smallDims.y);
|
||||
|
|
@ -154,14 +149,14 @@ SLA.slice = function(settings, widget, onupdate, ondone) {
|
|||
work_remain = work_total;
|
||||
forSlices(slices, 5, (slice,index) => {
|
||||
if (process.slaShell) {
|
||||
FDM.doShells(slice, 2, 0, process.slaShell);
|
||||
doShells(slice, 2, 0, process.slaShell);
|
||||
} else {
|
||||
FDM.doShells(slice, 1, 0);
|
||||
doShells(slice, 1, 0);
|
||||
}
|
||||
}, "shells");
|
||||
forSlices(slices, 10, (slice) => {
|
||||
if (slice.synth) return;
|
||||
FDM.doDiff(slice, 0.000001, {
|
||||
doDiff(slice, 0.000001, {
|
||||
sla: true,
|
||||
fakedown: !process.slaOpenBase
|
||||
});
|
||||
|
|
@ -169,8 +164,8 @@ SLA.slice = function(settings, widget, onupdate, ondone) {
|
|||
if (solidLayers) {
|
||||
forSlices(slices, 10, (slice) => {
|
||||
if (slice.synth) return;
|
||||
FDM.projectFlats(slice, solidLayers);
|
||||
FDM.projectBridges(slice, solidLayers);
|
||||
projectFlats(slice, solidLayers);
|
||||
projectBridges(slice, solidLayers);
|
||||
}, "project");
|
||||
async function doUnionSolid(slice) {
|
||||
if (slice.synth) return;
|
||||
|
|
@ -179,7 +174,7 @@ SLA.slice = function(settings, widget, onupdate, ondone) {
|
|||
let trims = slice.solids || [];
|
||||
traces.appendAll(trims);
|
||||
// slice.unioned = POLY.setZ(POLY.union(traces, undefined, true), slice.z);
|
||||
slice.unioned = POLY.setZ(await kiri.minions.union(traces), slice.z);
|
||||
slice.unioned = POLY.setZ(await minions.union(traces), slice.z);
|
||||
} else {
|
||||
slice.unioned = traces;
|
||||
}
|
||||
|
|
@ -212,7 +207,7 @@ SLA.slice = function(settings, widget, onupdate, ondone) {
|
|||
let bounds = widget.getBoundingBox();
|
||||
let points = widget.getPoints();
|
||||
|
||||
base.slice(points, {
|
||||
slicer.slice(points, {
|
||||
indices: process.indices || process.xray,
|
||||
union: controller.healMesh,
|
||||
debug: process.xray,
|
||||
|
|
@ -222,7 +217,7 @@ SLA.slice = function(settings, widget, onupdate, ondone) {
|
|||
zInc: height,
|
||||
// slicer function (worker local or minion distributed)
|
||||
slicer(z, points, opts) {
|
||||
return (isConcurrent ? kiri.minions.sliceZ : base.sliceZ)(z, points, opts);
|
||||
return (isConcurrent ? minions.sliceZ : slicer.sliceZ)(z, points, opts);
|
||||
},
|
||||
onupdate(v) {
|
||||
return onupdate(0.0 + v * 0.25);
|
||||
|
|
@ -603,7 +598,7 @@ function fillPolys(slice, settings) {
|
|||
if (!cached && seq_c !== 1)
|
||||
for (let x=start_x; x<end_x; x += step_x) {
|
||||
fill.push(
|
||||
base.newPolygon().centerRectangle({
|
||||
newPolygon().centerRectangle({
|
||||
x: x + step_x/2,
|
||||
y: 0,
|
||||
z: slice.z
|
||||
|
|
@ -614,7 +609,7 @@ function fillPolys(slice, settings) {
|
|||
if (!cached && seq_c !== 3)
|
||||
for (let y=start_y; y<end_y; y += step_y) {
|
||||
fill.push(
|
||||
base.newPolygon().centerRectangle({
|
||||
newPolygon().centerRectangle({
|
||||
x: 0,
|
||||
y: y + step_y/2,
|
||||
z: slice.z
|
||||
|
|
@ -699,6 +694,3 @@ function samplePNG(png, width, height) {
|
|||
|
||||
return {width, height, data:buf, png};
|
||||
}
|
||||
|
||||
|
||||
export { doupdate, forSlices, onSliceDone, doUnionSolid, doRender, computeSupports, projectSupport, projectPillar, fillPolys, pixAt, averageBlock, samplePNG, POLY, FDM, tracker, smallDims, largeDims, sws, b64, bin, img, height, cap, layers, outer, union, expand, s, slice, i, solidLayers, traces, trims, promises, bounds, points, slices, tops, render, poly, area, ops, mass_per_bear, rem_mass, ord, j, seq, flat, out, rec, num, track, sp, rp, isin, nusize, prec, nextpoint, x, close, p, d, newp, process, seq_i, y, idx, dat, th };
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const data_term = 0x0d0a;
|
|||
// CL-89 3840 x 2400
|
||||
// CL-133 3840 x 2160
|
||||
|
||||
class CXDLP {
|
||||
export class CXDLP {
|
||||
constructor() {
|
||||
Object.assign(this, default_values);
|
||||
}
|
||||
|
|
@ -447,6 +447,3 @@ if (!self.navigator && self.process && self.process.env) {
|
|||
} else if (self.navigator) {
|
||||
self.CXDLP = CXDLP;
|
||||
}
|
||||
|
||||
|
||||
export { read_string, write_string, scaleMovePoly, writePoly, default_values, data_term, read, len, str, meta, layers, i, size, lines, cksum, out, rec, j, d1, d2, d3, y_start, y_end, x_end, color, output, pos, start, b1, b2, b3, b4, b5, ckpos, array, cxdlp, width2, count, area, points, p, inner, bounds, point, slice, polys, wasm, imagelen, writer, poly, image, x, lastv, y, v, fs, args, file, fpos, view };
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
|
||||
const { base, kiri } = root;
|
||||
const { driver } = kiri;
|
||||
const { util } = base;
|
||||
const { SLA } = driver;
|
||||
import { SLA } from './driver.js';
|
||||
|
||||
function generatePhoton(print, conf, progress) {
|
||||
let printset = print.settings,
|
||||
|
|
@ -529,12 +526,9 @@ function polyout(poly, ctx, opt) {
|
|||
ctx.closePath();
|
||||
}
|
||||
|
||||
self.photon = {
|
||||
export const photon = {
|
||||
generatePhoton,
|
||||
generatePhotons,
|
||||
renderLayer,
|
||||
renderLayerWasm
|
||||
};
|
||||
|
||||
|
||||
export { generatePhoton, generatePhotons, encodeLayers, rleEncode, rleByte, rleDecode, writePhotonImage, renderLayerWasm, scaleMovePoly, writePoly, renderLayer, polyout, printset, d, i, ccl, tcl, converted, count, lineDV, bits, bitsDV, subs, sl, s, view, mask, dv, codedlen, codelen, buflen, filebuf, filedat, printtime, hirez, layerpos, lorez, proppos, proplen, propstart, layers, layerat, sc, l, layer, clo, tlo, j, filePos, index, subindex, data, encoded, maxlen, newColor, bytes, hpos, pos, r, heap, width2, array, area, points, p, inner, bounds, point, slice, polys, wasm, imagelen, writer, poly, image, rlelen, opt, ctx, red };
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import { Widget, newWidget } from '../kiri/widget.js';
|
|||
import { CAM } from '../kiri-mode/cam/driver-be.js';
|
||||
import { FDM } from '../kiri-mode/fdm/driver-be.js';
|
||||
import { LASER } from '../kiri-mode/laser/driver.js';
|
||||
import { SLA } from '../kiri-mode/sla/driver.js';
|
||||
|
||||
const { time } = util;
|
||||
|
||||
|
|
@ -26,7 +27,8 @@ let debug = (self.debug === true),
|
|||
drivers = {
|
||||
CAM,
|
||||
FDM,
|
||||
LASER
|
||||
LASER,
|
||||
SLA
|
||||
},
|
||||
ccvalue = self.navigator ? self.navigator.hardwareConcurrency || 0 : 0,
|
||||
concurrent = Math.min(4, self.Worker && ccvalue > 3 ? ccvalue - 1 : 0),
|
||||
|
|
@ -757,5 +759,6 @@ const worker = self.kiri_worker = {
|
|||
CAM.init(worker);
|
||||
FDM.init(worker);
|
||||
LASER.init(worker);
|
||||
SLA.init(worker);
|
||||
|
||||
broker.publish("worker.started", { dispatch, minions: minwork });
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { api } from './api.js';
|
|||
import { conf } from './conf.js';
|
||||
import { space } from '../moto/space.js';
|
||||
import { devices as devlist } from '../pack/devices.js';
|
||||
import { settings, conf as setconf } from './settings.js';
|
||||
|
||||
export const device = {
|
||||
clone: cloneDevice,
|
||||
|
|
@ -22,15 +23,15 @@ export const devices = {
|
|||
};
|
||||
|
||||
function isBelt() {
|
||||
return api.conf.get().device.bedBelt;
|
||||
return setconf.get().device.bedBelt;
|
||||
}
|
||||
|
||||
function currentDeviceName() {
|
||||
return api.conf.get().filter[api.mode.get()];
|
||||
return setconf.get().filter[api.mode.get()];
|
||||
}
|
||||
|
||||
function currentDeviceCode() {
|
||||
return api.conf.get().devices[currentDeviceName()];
|
||||
return setconf.get().devices[currentDeviceName()];
|
||||
}
|
||||
|
||||
function getModeDevices() {
|
||||
|
|
@ -38,7 +39,7 @@ function getModeDevices() {
|
|||
}
|
||||
|
||||
export function showDevices() {
|
||||
api.settings.sync.get().then(_showDevices);
|
||||
settings.sync.get().then(_showDevices);
|
||||
}
|
||||
|
||||
function _showDevices() {
|
||||
|
|
@ -52,7 +53,7 @@ function updateDeviceList() {
|
|||
|
||||
function updateDeviceName(newname) {
|
||||
let selected = api.device.get(),
|
||||
devs = api.conf.get().devices;
|
||||
devs = setconf.get().devices;
|
||||
if (newname !== selected) {
|
||||
devs[newname] = devs[selected];
|
||||
delete devs[selected];
|
||||
|
|
@ -62,18 +63,18 @@ function updateDeviceName(newname) {
|
|||
}
|
||||
|
||||
function putLocalDevice(devicename, obj) {
|
||||
api.conf.get().devices[devicename] = obj;
|
||||
api.conf.save();
|
||||
setconf.get().devices[devicename] = obj;
|
||||
setconf.save();
|
||||
}
|
||||
|
||||
function removeLocalDevice(devicename) {
|
||||
delete api.conf.get().devices[devicename];
|
||||
api.conf.save();
|
||||
api.settings.sync.put();
|
||||
delete setconf.get().devices[devicename];
|
||||
setconf.save();
|
||||
settings.sync.put();
|
||||
}
|
||||
|
||||
function isLocalDevice(devicename) {
|
||||
return api.conf.get().devices[devicename] ? true : false;
|
||||
return setconf.get().devices[devicename] ? true : false;
|
||||
}
|
||||
|
||||
function getSelectedDevice() {
|
||||
|
|
@ -82,9 +83,9 @@ function getSelectedDevice() {
|
|||
|
||||
function selectDevice(devicename) {
|
||||
if (isLocalDevice(devicename)) {
|
||||
setDeviceCode(api.conf.get().devices[devicename], devicename);
|
||||
setDeviceCode(setconf.get().devices[devicename], devicename);
|
||||
} else {
|
||||
let code = devices[api.mode.get_lower()][devicename];
|
||||
let code = devlist[api.mode.get_lower()][devicename];
|
||||
if (code) {
|
||||
setDeviceCode(code, devicename);
|
||||
}
|
||||
|
|
@ -94,7 +95,7 @@ function selectDevice(devicename) {
|
|||
// only for local filters
|
||||
function cloneDevice() {
|
||||
let name = `${getSelectedDevice().replace(/\./g,' ')}`;
|
||||
let code = api.clone(api.conf.get().device);
|
||||
let code = api.clone(setconf.get().device);
|
||||
code.mode = api.mode.get();
|
||||
if (name.toLowerCase().indexOf('my ') >= 0) {
|
||||
name = `${name} copy`;
|
||||
|
|
@ -103,11 +104,11 @@ function cloneDevice() {
|
|||
}
|
||||
putLocalDevice(name, code);
|
||||
setDeviceCode(code, name);
|
||||
api.settings.sync.put();
|
||||
settings.sync.put();
|
||||
}
|
||||
|
||||
function updateLaserState() {
|
||||
const dev = api.conf.get().device;
|
||||
const dev = setconf.get().device;
|
||||
$('laser-on').style.display = dev.useLaser ? 'flex' : 'none';
|
||||
$('laser-off').style.display = dev.useLaser ? 'flex' : 'none';
|
||||
}
|
||||
|
|
@ -119,7 +120,7 @@ function setDeviceCode(code, devicename) {
|
|||
|
||||
let mode = api.mode.get(),
|
||||
lmode = mode.toLowerCase(),
|
||||
current = api.conf.get(),
|
||||
current = setconf.get(),
|
||||
local = isLocalDevice(devicename),
|
||||
dev = current.device = conf.device_from_code(code,mode),
|
||||
dproc = current.devproc[devicename], // last process name for this device
|
||||
|
|
@ -228,7 +229,7 @@ function setDeviceCode(code, devicename) {
|
|||
}
|
||||
ui.deviceAdd.disabled = dev.noclone;
|
||||
|
||||
api.conf.update_fields();
|
||||
setconf.update_fields();
|
||||
space.platform.setBelt(isBelt());
|
||||
platform.update_size();
|
||||
platform.update_origin();
|
||||
|
|
@ -242,12 +243,12 @@ function setDeviceCode(code, devicename) {
|
|||
|
||||
if (dproc) {
|
||||
// restore last process associated with this device
|
||||
api.conf.load(null, dproc);
|
||||
setconf.load(null, dproc);
|
||||
} else {
|
||||
api.conf.update();
|
||||
setconf.update();
|
||||
}
|
||||
|
||||
api.conf.save();
|
||||
setconf.save();
|
||||
|
||||
if (isBelt()) {
|
||||
// space.view.setHome(dev.bedBelt ? Math.PI/2 : 0, Math.PI / 2.5);
|
||||
|
|
@ -276,7 +277,7 @@ function setDeviceCode(code, devicename) {
|
|||
function renderDevices(devices) {
|
||||
let selected = api.device.get() || devices[0],
|
||||
features = api.feature,
|
||||
devs = api.conf.get().devices,
|
||||
devs = setconf.get().devices,
|
||||
dfilter = typeof(features.device_filter) === 'function' ? features.device_filter : undefined;
|
||||
|
||||
for (let local in devs) {
|
||||
|
|
@ -300,8 +301,8 @@ function renderDevices(devices) {
|
|||
ui.deviceSave.onclick = function() {
|
||||
event.emit('device.save');
|
||||
api.function.clear();
|
||||
api.conf.save();
|
||||
api.settings.sync.put();
|
||||
setconf.save();
|
||||
settings.sync.put();
|
||||
showDevices();
|
||||
api.modal.hide();
|
||||
};
|
||||
|
|
@ -320,8 +321,8 @@ function renderDevices(devices) {
|
|||
api.uc.prompt(`Rename "${selected}`, selected).then(newname => {
|
||||
if (newname) {
|
||||
updateDeviceName(newname);
|
||||
api.conf.save();
|
||||
api.settings.sync.put();
|
||||
setconf.save();
|
||||
settings.sync.put();
|
||||
showDevices();
|
||||
} else {
|
||||
showDevices();
|
||||
|
|
@ -333,7 +334,7 @@ function renderDevices(devices) {
|
|||
version: kiri.version,
|
||||
device: selected,
|
||||
process: api.process.code(),
|
||||
profiles: event.altKey ? api.settings.prof() : undefined,
|
||||
profiles: event.altKey ? settings.prof() : undefined,
|
||||
code: devs[selected],
|
||||
time: Date.now()
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { local } from '../data/local.js';
|
|||
import { util } from '../geo/base.js';
|
||||
import { MODES } from './consts.js';
|
||||
import { LASER as laser_driver } from '../kiri-mode/laser/driver.js';
|
||||
import { client as sla_client } from '../kiri-mode/sla/client.js';
|
||||
import { SLA as sla_client } from '../kiri-mode/sla/client.js';
|
||||
|
||||
let printSeq = parseInt(local['kiri-print-seq'] || local['print-seq'] || "0") + 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { settings as set_ctrl } from './settings.js';
|
|||
import { init as initCAM } from '../kiri-mode/cam/client.js';
|
||||
import { init as initFDM } from '../kiri-mode/fdm/client.js';
|
||||
import { init as initLaser } from '../kiri-mode/laser/client.js';
|
||||
import { init as initSLA } from '../kiri-mode/sla/client.js';
|
||||
|
||||
let { CAM, SLA, FDM, LASER, DRAG, WJET, WEDM } = MODES,
|
||||
{ consts, client, catalog, platform, selection } = api,
|
||||
|
|
@ -402,7 +403,7 @@ function keyHandler(evt) {
|
|||
case cca('p'): // prepare
|
||||
if (api.mode.get() !== 'SLA') {
|
||||
// hidden in SLA mode
|
||||
api.function.print();
|
||||
api.function.prepare();
|
||||
}
|
||||
break;
|
||||
case cca('X'): // export
|
||||
|
|
@ -1366,6 +1367,7 @@ function init_one() {
|
|||
initFDM();
|
||||
initCAM();
|
||||
initLaser();
|
||||
initSLA();
|
||||
|
||||
// override old style settings two-button menu
|
||||
ui.settingsSave.onclick = () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue