enable sla. fix custom device gcode and naming persistence

This commit is contained in:
Stewart Allen 2020-04-16 15:20:24 -04:00
commit 438437e205
5 changed files with 38 additions and 13 deletions

View file

@ -243,8 +243,21 @@ let gs_kiri_sla = exports;
API.ajax("/kiri/output-sla.html", html => {
API.ui.print.innerHTML = html;
let printset = print.settings,
process = printset.process,
print_sec = (process.slaBaseLayers * process.slaBaseOn) +
(lines.length - process.slaBaseLayers) * process.slaLayerOn,
print_min = Math.floor(print_sec/60),
print_hrs = Math.floor(print_min/60);
print_sec -= (print_min * 60).toString().padStart(2,0);
print_min -= (print_hrs * 60).toString().padStart(2,0);
print_hrs = print_hrs.toString().padStart(2,0);
$('print-filename').value = filename;
$('print-layers').value = lines.length;
$('print-time').value = `${print_hrs}:${print_min}:${print_sec}`;
$('print-close').onclick = API.modal.hide;
$('print-photons').onclick = () => { download_photons(print) };
$('print-photon').onclick = () => { download_photon(print) };

View file

@ -674,9 +674,15 @@ var gs_kiri_init = exports;
UI.deviceClose.onclick = API.dialog.hide;
UI.deviceSave.onclick = function() {
let newname = UI.deviceName.value
if (newname !== selected) {
devs[newname] = devs[selected];
delete devs[selected];
}
API.function.clear();
API.conf.save();
showDevices();
selectDevice(newname);
};
UI.deviceAdd.onclick = function() {
API.function.clear();
@ -734,11 +740,8 @@ var gs_kiri_init = exports;
}
showDevices();
};
// if (API.show.favorites()) {
if (loc) opt.setAttribute("local", 1);
// } else {
if (loc || fav) opt.setAttribute("favorite", 1);
// }
if (loc) opt.setAttribute("local", 1);
if (loc || fav) opt.setAttribute("favorite", 1);
UI.deviceSelect.appendChild(opt);
if (device === selected) {
selectedIndex = incr;
@ -1458,10 +1461,6 @@ var gs_kiri_init = exports;
slaBasePeelLiftRate: UC.newInput('peel lift rate', {title:'peel lift speed\nin mm/sec', convert:UC.toFloat, modes:SLA}),
});
if (!LOCAL) {
UI.modeSLA.style.display = 'none';
}
if (!lang_set) {
// for english only, add underlined labels for hotkeys
UI.setupDevices.innerHTML = "D<u>e</u>vices";

View file

@ -1256,7 +1256,6 @@ self.kiri.copyright = exports.COPYRIGHT;
// given a settings region, update values of matching bound UI fields
function updateFieldsFromSettings(scope) {
if (!scope) return console.trace("missing scope");
for (let key in scope) {
if (!scope.hasOwnProperty(key)) continue;
let val = scope[key];

View file

@ -296,9 +296,16 @@ var gs_moto_ui = exports;
}
let lastPop = null;
let savePop = null;
function hidePop() {
if (lastPop) lastPop.style.display = "none";
if (lastPop) {
lastPop.style.display = "none";
}
if (savePop) {
savePop();
savePop = null;
}
lastPop = null;
}
@ -347,13 +354,19 @@ var gs_moto_ui = exports;
txt.setAttribute("cols", Math.max(30, cols + 1));
txt.setAttribute("rows", Math.max(10, rows.length + 1));
txt.onblur = () => {
console.log({text_lost_focus: txt});
};
let showing = pop === lastPop;
hidePop();
inputAction();
if (!showing) {
savePop = inputAction;
pop.style.display = "flex";
lastPop = pop;
txt.focus();
} else {
inputAction();
}
}
};

View file

@ -5,7 +5,8 @@
<div>
<table id="print-info">
<tr><th>file name</th><td><input id="print-filename" size="30" spellcheck="false" /></td></tr>
<tr><th>layers</th><td><input id="print-layers" size="10" spellcheck="false" /></td></tr>
<tr><th>print layers</th><td><input id="print-layers" size="10" spellcheck="false" /></td></tr>
<tr><th>print time</th><td><input id="print-time" size="10" spellcheck="false" /></td></tr>
</table>
</div>