fix cnc feedrates for imperial. update grid when changing units

This commit is contained in:
Stewart Allen 2020-06-13 11:23:52 -04:00
commit 4c23d16e66
6 changed files with 61 additions and 45 deletions

View file

@ -78,6 +78,11 @@
return false;
}
function unitsSave() {
API.conf.update();
platform.update_size();
}
function booleanSave() {
let control = settings().controller;
let isDark = control.dark;
@ -1246,7 +1251,7 @@
freeLayout: UC.newBoolean(LANG.op_free_s, booleanSave, {title:LANG.op_free_l, modes:ALL}),
reverseZoom: UC.newBoolean(LANG.op_invr_s, booleanSave, {title:LANG.op_invr_l, modes:ALL}),
thinRender: UC.newBoolean(LANG.op_thin_s, booleanSave, {title:LANG.op_thin_l, modes:ALL}),
units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, modes:CAM}, "units"),
units: UC.newSelect(LANG.op_unit_s, {title: LANG.op_unit_l, modes:CAM, action:unitsSave}, "units"),
prefadd: UC.checkpoint(),
export: UC.newGroup(LANG.xp_menu, $('prefs-out'), {inline: true}),
@ -1674,20 +1679,7 @@
$('mode-cam').appendChild(mksvg(icons.cnc));
$('mode-laser').appendChild(mksvg(icons.laser));
SPACE.platform.setSize(
settings().device.bedWidth,
settings().device.bedDepth,
settings().device.bedHeight
);
if (dark) {
SPACE.platform.setGrid(25, 5, 0x999999, 0x333333);
SPACE.platform.opacity(0.8);
DOC.body.classList.add('dark');
} else {
SPACE.platform.setGrid(25, 5, 0x999999, 0xcccccc);
SPACE.platform.opacity(0.3);
}
API.platform.update_size();
SPACE.mouse.downSelect(function(int,event) {
// lay flat with meta or ctrl clicking a selected face

View file

@ -985,6 +985,19 @@
depth = parseInt(dev.bedDepth),
height = parseFloat(dev.bedHeight)
);
let ctrl = settings.controller,
unitMM = ctrl.units === 'mm',
gridMajor = unitMM ? 25 : 25.4,
gridMinor = unitMM ? 5 : 25.4 / 4;
if (ctrl.dark) {
SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0x333333);
SPACE.platform.opacity(0.8);
DOC.body.classList.add('dark');
} else {
SPACE.platform.setGrid(gridMajor, gridMinor, 0x999999, 0xcccccc);
SPACE.platform.opacity(0.3);
DOC.body.classList.remove('dark');
}
SPACE.platform.setGZOff(height/2 - 0.1);
platform.update_origin();
SPACE.scene.freeze(frozen);

View file

@ -335,13 +335,15 @@
origin = settings.origin,
mode = settings.mode,
tools = [],
driver = KIRI.driver[mode];
driver = KIRI.driver[mode],
mark = Date.now();
if (mode === 'FDM') {
tools = settings.device.extruders || [];
}
driver.printRender(this, {tools, aslines:settings.controller.thinRender});
if (KIRI.api.const.LOCAL) console.log({printRender: Date.now() - mark});
};
function pref(a,b) {

View file

@ -713,7 +713,9 @@
* render all slice and processed data
*/
PRO.render = function() {
let mark = Date.now();
DRIVERS[this.settings.mode.toUpperCase()].sliceRender(this);
if (KIRI.api.const.LOCAL) console.log({sliceRender: Date.now() - mark});
};
PRO.hideSlices = function() {