fix moto bug

This commit is contained in:
Stewart Allen 2020-03-17 16:32:43 -04:00
commit 7c7e5c2ed4
6 changed files with 47 additions and 33 deletions

View file

@ -46,6 +46,10 @@ var gs_kiri_init = exports;
editTools = null, editTools = null,
maxTool = 0; maxTool = 0;
// extend KIRI API with local functions
API.show.devices = showDevices;
API.device.set = selectDevice;
function settings() { function settings() {
return API.conf.get(); return API.conf.get();
} }
@ -659,8 +663,9 @@ var gs_kiri_init = exports;
API.conf.save(); API.conf.save();
} catch (e) { } catch (e) {
console.log({error:e, device:code}); console.log({error:e, device:code, devicename});
// API.show.alert("invalid or deprecated device. please select a new device."); API.show.alert(`invalid or deprecated device: "${devicename}"`, 10);
API.show.alert(`please select a new device`, 10);
showDevices(); showDevices();
} }
API.function.clear(); API.function.clear();
@ -1574,8 +1579,6 @@ var gs_kiri_init = exports;
API.space.restore(init_two) || checkSeed(init_two) || init_two(); API.space.restore(init_two) || checkSeed(init_two) || init_two();
// extend API
API.show.devices = showDevices;
}; };
// SECOND STAGE INIT AFTER UI RESTORED // SECOND STAGE INIT AFTER UI RESTORED
@ -1636,16 +1639,15 @@ var gs_kiri_init = exports;
// optional set-and-lock device (hides device menu) // optional set-and-lock device (hides device menu)
let DEVNAME = SETUP.dev ? SETUP.dev[0] : null; let DEVNAME = SETUP.dev ? SETUP.dev[0] : null;
// setup default mode and enable mode locking, if set
API.mode.set(SETMODE || STARTMODE || current.mode, SETMODE); API.mode.set(SETMODE || STARTMODE || current.mode, SETMODE);
API.show.controls(true);
// update everything dependent on the platform size
platform.update_size(); platform.update_size();
// ensure hot keys work even in iframes
API.focus(); API.focus();
if (STATS.get('upgrade')) DBUG.log("kiri | version upgrade");
STATS.del('upgrade');
if (!SETUP.s) console.log(`kiri | init main | ${KIRI.version}`);
// place version number a couple of places to help users // place version number a couple of places to help users
UI.helpButton.title = `${LANG.version} ` + KIRI.version; UI.helpButton.title = `${LANG.version} ` + KIRI.version;
@ -1673,14 +1675,23 @@ var gs_kiri_init = exports;
// clear alerts as they build up // clear alerts as they build up
setInterval(API.event.alerts, 1000); setInterval(API.event.alerts, 1000);
// add hide-alerts-on-alert-click
UI.alert.dialog.onclick = function() { UI.alert.dialog.onclick = function() {
API.event.alerts(true); API.event.alerts(true);
}; };
// default to ARRANGE view mode
API.view.set(VIEWS.ARRANGE); API.view.set(VIEWS.ARRANGE);
// add ability to override
API.show.controls(true);
// show version on startup // show version on startup
API.show.alert(`${LANG.version} ${KIRI.version}`); API.show.alert(`${LANG.version} ${KIRI.version}`);
if (!SETUP.s) console.log(`kiri | init main | ${KIRI.version}`);
if (STATS.get('upgrade')) DBUG.log("kiri | version upgrade");
STATS.del('upgrade');
} }
// schedule init_one to run after all page content is loaded // schedule init_one to run after all page content is loaded

View file

@ -65,7 +65,6 @@ self.kiri.license = exports.LICENSE;
viewMode = VIEWS.ARRANGE, viewMode = VIEWS.ARRANGE,
layoutOnAdd = true, layoutOnAdd = true,
local = SETUP.local, local = SETUP.local,
// mouseMoved = false,
camStock = null, camStock = null,
camTopZ = 0, camTopZ = 0,
topZ = 0, topZ = 0,
@ -156,7 +155,8 @@ self.kiri.license = exports.LICENSE;
layer_range: 0 layer_range: 0
}, },
device: { device: {
get: currentDeviceName get: currentDeviceName,
set: undefined // set during init
}, },
dialog: { dialog: {
show: showDialog, show: showDialog,
@ -196,10 +196,6 @@ self.kiri.license = exports.LICENSE;
set: setMode, set: setMode,
switch: switchMode switch: switchMode
}, },
// mouse : {
// moved : function() { return mouseMoved },
// movedSet : function(b) { mouseMoved = b }
// },
opacity, opacity,
print: { print: {
get: function() { return currentPrint }, get: function() { return currentPrint },
@ -213,6 +209,7 @@ self.kiri.license = exports.LICENSE;
selection, selection,
show: { show: {
alert: alert2, alert: alert2,
devices: undefined, // set during init
progress: setProgress, progress: setProgress,
controls: setControlsVisible, controls: setControlsVisible,
favorites: getShowFavorites, favorites: getShowFavorites,
@ -1426,7 +1423,7 @@ self.kiri.license = exports.LICENSE;
alert2("workspace saved", 1); alert2("workspace saved", 1);
} }
function restoreWorkspace(ondone, skipwidgets) { function restoreWorkspace(ondone, skip_widget_load) {
var loaded = 0, var loaded = 0,
toload = ls2o('ws-widgets',[]), toload = ls2o('ws-widgets',[]),
newset = ls2o('ws-settings'), newset = ls2o('ws-settings'),
@ -1462,11 +1459,14 @@ self.kiri.license = exports.LICENSE;
if (camera) SPACE.view.load(camera); if (camera) SPACE.view.load(camera);
else setTimeout(SPACE.view.home, 100); else setTimeout(SPACE.view.home, 100);
if (skipwidgets) return; if (skip_widget_load) return;
// remove any widgets from platform
forAllWidgets(function(widget) { forAllWidgets(function(widget) {
platform.delete(widget); platform.delete(widget);
}); });
// load any widget by name that was saved to the workspace
toload.forEach(function(widgetid) { toload.forEach(function(widgetid) {
Widget.loadFromState(widgetid, function(widget) { Widget.loadFromState(widgetid, function(widget) {
if (widget) { if (widget) {
@ -1476,12 +1476,10 @@ self.kiri.license = exports.LICENSE;
platform.deselect(); platform.deselect();
if (ondone) { if (ondone) {
ondone(); ondone();
// if ((newset || settings).mode != 'CAM') { setTimeout(() => {
setTimeout(() => { platform.update_top_z();
platform.update_top_z(); SPACE.update();
SPACE.update(); }, 1);
}, 1);
// };
} }
} }
}, position); }, position);
@ -1789,6 +1787,7 @@ self.kiri.license = exports.LICENSE;
// update device stat for FDM/CAM // update device stat for FDM/CAM
STATS.set(`ud_${getModeLower()}`, settings.filter[mode] || 'default'); STATS.set(`ud_${getModeLower()}`, settings.filter[mode] || 'default');
MODE = MODES[mode]; MODE = MODES[mode];
// updates right-hand menu by enabling/disabling fields
UC.setMode(MODE); UC.setMode(MODE);
loadNamedSetting(); loadNamedSetting();
saveSettings(); saveSettings();
@ -1802,7 +1801,7 @@ self.kiri.license = exports.LICENSE;
if (camStock) { if (camStock) {
camStock.material.visible = settings.mode === 'CAM'; camStock.material.visible = settings.mode === 'CAM';
} }
restoreWorkspace(null,true); restoreWorkspace(null, true);
// if (MODE !== MODES.FDM) platform.layout(); // if (MODE !== MODES.FDM) platform.layout();
if (then) then(); if (then) then();
triggerSettingsEvent(); triggerSettingsEvent();

View file

@ -3,7 +3,7 @@
"use strict"; "use strict";
let gs_moto_ctrl = exports; let gs_moto_ctrl = exports;
let MOTO = window.moto = window.moto || {}; var MOTO = window.moto = window.moto || {};
/** /**
* Adapted from THREE.OrbitControls * Adapted from THREE.OrbitControls

View file

@ -2,7 +2,7 @@
"use strict"; "use strict";
let gs_moto_space = exports; let gs_moto_space = exports;
let MOTO = window.moto = window.moto || {}; var MOTO = window.moto = window.moto || {};
(function() { (function() {

View file

@ -2,7 +2,7 @@
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix ## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
* `B` restore settings should restore all mode/device/settings * `B` restore settings should restore all mode/device/settings (find corner cases)
* `C` set page background color? or dark mode? * `C` set page background color? or dark mode?
* `C` better small screen support (on screen button for hiding side panels, compact selectors) * `C` better small screen support (on screen button for hiding side panels, compact selectors)
* `F` implement an in-app bug reporting system * `F` implement an in-app bug reporting system
@ -11,10 +11,10 @@
* share raw data w/ dups, encode/decode * share raw data w/ dups, encode/decode
* `F` remember object's original position/orientation for reset/multi-object import alignment * `F` remember object's original position/orientation for reset/multi-object import alignment
* `P` bail on decimation if it's proving ineffective * `P` bail on decimation if it's proving ineffective
* `P` improve decimation speed by avoiding in/out of Point * `P` improve decimation speed by avoiding in/out of Point?
* `P` server-side processing (determine protocol and storage) * `P` server-side processing (determine protocol and storage)
* `P` refactor / simplify POLY.expand (put onus on collector) * `P` refactor / simplify POLY.expand (put onus on collector)
* `P` cloned objects should share same slice data unless rotated * `P` cloned objects should share same slice data unless rotated or scaled
# FDM # FDM
@ -40,9 +40,11 @@
# CAM # CAM
* `B` fix zooming, workspace thickness for larger workspaces
* `B` fails in pancaking (clone) when there are no sliced layers (like z bottom too high) * `B` fails in pancaking (clone) when there are no sliced layers (like z bottom too high)
* `B` linear finishing should extend beyond part boundaries by tool radius
* `B` outside cutting direction in roughing mode inverted * `B` outside cutting direction in roughing mode inverted
* `F` do not rough areas that go all the way through the part
https://github.com/GridSpace/grid-apps/issues/20
* `F` send gcode to cncjs * `F` send gcode to cncjs
* `F` trapezoidal tabs (in the Z axis) * `F` trapezoidal tabs (in the Z axis)
* `F` lead-in milling * `F` lead-in milling
@ -50,13 +52,13 @@
* `F` implement z line-only follows for ball/taper * `F` implement z line-only follows for ball/taper
* `F` add option to spiral in vs out (optimal tool life) vs mixed (optimal path) * `F` add option to spiral in vs out (optimal tool life) vs mixed (optimal path)
* `F` add endmill spiral direction to fully respect climb vs conventional * `F` add endmill spiral direction to fully respect climb vs conventional
* `F` add tapered ball mills * `F` add support for tapered ball mills
* `F` warn when part > stock or cuts go outside bed * `F` warn when part > stock or cuts go outside bed
* `F` add M03 tool feedrate support * `F` add M03 tool feedrate support
* `P` refactor slicing around flats w/ interpolation instead of culling * `P` refactor slicing around flats w/ interpolation instead of culling
* `P` optimize away topo generation (for z hop/move) when part is flat * `P` optimize away topo generation (for z hop/move) when part is flat
* `P` store tab and camshell polys in widget.topo to minimize z on edge moves * `P` store tab and camshell polys in widget.topo to minimize z on edge moves
* `P` linear finishing going back to z top too often * `P` linear finishing is going back to z top too often
* `P` option to skip milling holes that would be drilled * `P` option to skip milling holes that would be drilled
* `P` crossing open space check point is outside camshell before returning max z * `P` crossing open space check point is outside camshell before returning max z

View file

@ -221,6 +221,7 @@ button[del] {
xoverflow: hidden; xoverflow: hidden;
} }
#control-left { #control-left {
display: none;
position: fixed; position: fixed;
z-index: 10000; z-index: 10000;
color: black; color: black;
@ -242,6 +243,7 @@ button[del] {
display: none; display: none;
} }
#control-right { #control-right {
display: none;
position: fixed; position: fixed;
z-index: 10000; z-index: 10000;
top: 5px; top: 5px;