fix belt settings mixture across mode changes. commend cleanup, rm dead code
This commit is contained in:
parent
4aa9b7ed49
commit
d88f603e38
4 changed files with 19 additions and 20 deletions
|
|
@ -501,17 +501,14 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
|
|||
let y = poly.bounds.maxy;
|
||||
let z = slice.z;
|
||||
// at 45 degrees, 1mm in Z is 1mm in Y
|
||||
// find formula for other angles
|
||||
let by = (slope * z) - y;
|
||||
if (by < miny) miny = by;
|
||||
if (by < smin) smin = by;
|
||||
}
|
||||
slice.belt = { miny, touch: miny.round(3) == 0 };
|
||||
// console.log({ miny: miny.round(3), z:slice.z, touch: slice.belt.touch });
|
||||
}
|
||||
console.log({ smin: smin.round(5) });
|
||||
// mark slices with tops touching belt
|
||||
// also find max width of first 5 layers
|
||||
slice.belt = { miny, touch: miny.round(3) == 0 };
|
||||
}
|
||||
// find max width of first 5 layers for brim additions
|
||||
let start;
|
||||
let minx = Infinity, maxx = -Infinity;
|
||||
let peek = 0;
|
||||
|
|
@ -522,13 +519,10 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
|
|||
maxx = Math.max(maxx, poly.bounds.maxx);
|
||||
}
|
||||
}
|
||||
// mark slice as touching belt if near miny
|
||||
// if (Math.abs(slice.belt.miny - smin) < 0.01) {
|
||||
if (!start && slice.belt.touch) start = slice;
|
||||
// if (Math.abs(slice.belt.miny) < 0.01) {
|
||||
// slice.belt.touch = true;
|
||||
// if (!start) start = slice;
|
||||
// }
|
||||
// find first slice touching belt for start of anchor
|
||||
if (!start && slice.belt.touch) {
|
||||
start = slice;
|
||||
}
|
||||
}
|
||||
// ensure we start against a layer with shells
|
||||
while (start && start.up && start.topShells().length === 0) {
|
||||
|
|
@ -569,7 +563,6 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
|
|||
let snew = addto.addTop(splat).fill_sparse = [ splat ];
|
||||
adds.push(snew);
|
||||
start = addto;
|
||||
// console.log({ z: z.round(3), anchorlen: anchorlen.round(3) });
|
||||
anchorlen -= (step * slope);
|
||||
}
|
||||
// add anchor bump
|
||||
|
|
|
|||
|
|
@ -259,6 +259,13 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
}
|
||||
|
||||
function onBooleanClick(el) {
|
||||
// copy some ui elements to target settings
|
||||
let settings = api.conf.get();
|
||||
settings.device.bedBelt = ui.deviceBelt.checked && api.mode.is_fdm();
|
||||
settings.device.bedRound = ui.deviceRound.checked && api.mode.is_fdm();
|
||||
settings.device.originCenter = ui.deviceOrigin.checked || ui.deviceRound.checked;
|
||||
settings.device.fwRetract = ui.fwRetract.checked;
|
||||
// refresh vars and other ui elements
|
||||
uc.refresh();
|
||||
api.conf.update();
|
||||
DOC.activeElement.blur();
|
||||
|
|
@ -726,8 +733,6 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
try {
|
||||
if (typeof(code) === 'string') code = js2o(code) || {};
|
||||
|
||||
api.event.emit('device.set', devicename);
|
||||
|
||||
let mode = api.mode.get(),
|
||||
lmode = mode.toLowerCase(),
|
||||
current = settings(),
|
||||
|
|
|
|||
|
|
@ -931,7 +931,7 @@ gapp.register("kiri.main", [], (root, exports) => {
|
|||
// restore cached device profile for this mode
|
||||
if (current.cdev[mode]) {
|
||||
current.device = clone(current.cdev[mode]);
|
||||
api.event.emit('device.set', currentDeviceName());
|
||||
api.event.emit('device.select', currentDeviceName());
|
||||
}
|
||||
// hide/show
|
||||
api.uc.setVisible($('set-tools'), mode === 'CAM');
|
||||
|
|
|
|||
|
|
@ -46,10 +46,11 @@ function saveSettings() {
|
|||
const mode = settings.mode;
|
||||
settings.sproc[mode].default = settings.process;
|
||||
settings.sproc[mode][settings.process.processName] = settings.process;
|
||||
settings.device.bedBelt = ui.deviceBelt.checked;
|
||||
settings.device.bedRound = ui.deviceRound.checked;
|
||||
settings.device.originCenter = ui.deviceOrigin.checked || ui.deviceRound.checked;
|
||||
settings.device.fwRetract = ui.fwRetract.checked;
|
||||
// moved to init.onBooleanClick() -- delete later after confirming no side-effects
|
||||
// settings.device.bedBelt = ui.deviceBelt.checked;
|
||||
// settings.device.bedRound = ui.deviceRound.checked;
|
||||
// settings.device.originCenter = ui.deviceOrigin.checked || ui.deviceRound.checked;
|
||||
// settings.device.fwRetract = ui.fwRetract.checked;
|
||||
local.setItem('ws-settings', JSON.stringify(settings));
|
||||
api.event.emit('settings.saved', settings);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue