add device locking

This commit is contained in:
Stewart Allen 2017-11-03 19:55:18 -04:00
commit d9896c253e

View file

@ -438,6 +438,7 @@ self.kiri.license = exports.LICENSE;
renderMode = 4, renderMode = 4,
viewMode = VIEWS.ARRANGE, viewMode = VIEWS.ARRANGE,
layoutOnAdd = true, layoutOnAdd = true,
deviceLock = false,
local = SETUP.local, local = SETUP.local,
sliceRemote = !local, sliceRemote = !local,
printRemote = !local, printRemote = !local,
@ -2678,7 +2679,9 @@ self.kiri.license = exports.LICENSE;
return UI.deviceSelect.options[UI.deviceSelect.selectedIndex].text; return UI.deviceSelect.options[UI.deviceSelect.selectedIndex].text;
} }
function selectDevice(devicename) { function selectDevice(devicename, lock) {
deviceLock = lock;
if (lock) UI.setupDevices.style.display = 'none';
if (inMode('LASER')) return; if (inMode('LASER')) return;
if (isLocalDevice(devicename)) { if (isLocalDevice(devicename)) {
setDeviceCode(settings.devices[devicename], devicename); setDeviceCode(settings.devices[devicename], devicename);
@ -2998,7 +3001,7 @@ self.kiri.license = exports.LICENSE;
} }
function showDevices() { function showDevices() {
if (MODE === MODES.LASER) return; if (MODE === MODES.LASER || deviceLock) return;
setViewMode(VIEWS.ARRANGE); setViewMode(VIEWS.ARRANGE);
@ -3260,9 +3263,12 @@ self.kiri.license = exports.LICENSE;
console.log({octoprint:OCTOPRINT}); console.log({octoprint:OCTOPRINT});
} }
// mode passed in on url // mode passed on url
var SETMODE = SETUP.mode ? SETUP.mode[0] : null; var SETMODE = SETUP.mode ? SETUP.mode[0] : null;
// device name pass on url
var DEVNAME = SETUP.dev ? SETUP.dev[0] : null;
setMode(SETMODE || STARTMODE || settings.mode, SETMODE); setMode(SETMODE || STARTMODE || settings.mode, SETMODE);
setControlsVisible(true); setControlsVisible(true);
updatePlatformSize(); updatePlatformSize();
@ -3294,7 +3300,7 @@ self.kiri.license = exports.LICENSE;
// DOC.addEventListener('visibilitychange', function() { document.title = document.hidden }); // DOC.addEventListener('visibilitychange', function() { document.title = document.hidden });
// ensure settings has gcode // ensure settings has gcode
selectDevice(currentDeviceName()); selectDevice(DEVNAME || currentDeviceName(), DEVNAME);
// ensure field data propagation // ensure field data propagation
updateSettings(); updateSettings();