pull/153/head v1.0.196
openbuilds-engineer 2019-10-18 20:55:41 +02:00
rodzic 1ec235a9d3
commit 67b240a60e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 3AB95CA8F41E2655
10 zmienionych plików z 516 dodań i 398 usunięć

Wyświetl plik

@ -1,3 +1,4 @@
v1.0.196: Added menu to troubleshooting tab to selectively disable frontend features for debugging
v1.0.195: Fixed bug related to default state of 3D viewer
v1.0.194: Added option to disable 3D Viewer for slow machines
v1.0.193: Improved 3D viewer loading speed

Wyświetl plik

@ -295,8 +295,6 @@
<li onclick="keyboardShortcutsEditor();"><a href="#"><i class="far fa-edit fa-fw"></i> Customize Shortcut Key Assignments</a></li>
<li class="divider fg-lightGray"></li>
<li onclick="populateGrblBuilderToolForm();"><a href="#"><img src="img/grbl.png" /> Flashing Tool</a></li>
<li class="divider fg-lightGray"></li>
<li onclick="viewerdisable()" id="viewerdisabled" class=""><a href="#"><i class="mif-3d-rotation fa-fw" id="3dviewicon"></i> Disable 3D Viewer (For slower computers)</a></li>
</ul>
</div>
@ -335,6 +333,31 @@
</div>
<div class="section" id="section-troubleshooting">
<div class="group">
<div>
<button id="diagbtn" class="ribbon-button dropdown-toggle">
<span class="icon">
<span class="fa-layers fa-fw">
<i class="fas fa-stethoscope"></i>
</span>
</span>
<span class="caption">Application<br>Diagnostics</span>
</button>
<ul class="ribbon-dropdown grblmode" data-role="dropdown" data-duration="100">
<li onclick="disable3Dviewer = !disable3Dviewer; saveDiagnostics(); location.reload();" id="disable3DviewerTick"><a href="#"><i class="mif-3d-rotation fa-fw"></i> Disable 3D Viewer System (For slower computers)</a></li>
<li class="divider"></li>
<li onclick="disable3Dcontrols = !disable3Dcontrols; saveDiagnostics(); location.reload();" id="disable3DcontrolsTick"><a href="#"><i class="mif-3d-rotation fa-fw"></i> Disable 3D Viewer Interactions</a></li>
<li onclick="disable3Dskybox = !disable3Dskybox; saveDiagnostics(); location.reload();" id="disable3DskyboxTick"><a href="#"><i class="mif-3d-rotation fa-fw"></i> Disable 3D Viewer Skybox/Fog</a></li>
<li onclick="disable3Drealtimepos = !disable3Drealtimepos; saveDiagnostics(); location.reload();" id="disable3DrealtimeposTick"><a href="#"><i class="mif-3d-rotation fa-fw"></i> Disable 3D Viewer Realtime Job Position
Indicator</a></li>
<li onclick="disable3Dgcodepreview = !disable3Dgcodepreview; saveDiagnostics(); location.reload();" id="disable3DgcodepreviewTick"><a href="#"><i class="mif-3d-rotation fa-fw"></i> Disable 3D Viewer GCODE Preview</a></li>
<li class="divider"></li>
<li onclick="disableSerialLog =! disableSerialLog; saveDiagnostics(); location.reload();" id="disableSerialLogTick"><a href="#"><i class="fas fa-fw fa-terminal"></i> Disable Serial Log</a></li>
<li onclick="disableDROupdates = !disableDROupdates; saveDiagnostics(); location.reload();" id="disableDROupdatesTick"><a href="#"><i class="fas fa-fw fa-list-ol"></i> Disable DRO/Status Updates</a></li>
</ul>
</div>
<span class="title">Settings</span>
</div>
<div class="group" style="width: 100px;">
<button class="ribbon-button" onclick="socket.emit('clearAlarm', 2)">
<span class="icon">
@ -1222,12 +1245,15 @@
</script>
<script type="text/javascript" src="lib/fontawesome5/js/all.min.js"></script>
<script type="text/javascript" src="lib/jquery/jquery.min.js"></script>
<script type="text/javascript" src="lib/jquery/jquery-ui.js"></script>
<script type="text/javascript" src="lib/jquery/jquery-input-history.min.js"></script>
<script type="text/javascript" src="lib/jquery/jquery-swipe.js"></script>
<script type="text/javascript" src="js/diagnostics.js"></script>
<script type="text/javascript" src="lib/qrcode/qrcode.min.js"></script>
<script type="text/javascript" src="lib/ace/src-noconflict/ace.js"></script>

Wyświetl plik

@ -0,0 +1,86 @@
var disable3Dviewer = false;
var disable3Dcontrols = false;
var disable3Dskybox = false;
var disable3Drealtimepos = false;
var disable3Dgcodepreview = false;
var disableSerialLog = false; // todo also hide tab when set to true
var disableDROupdates = false;
function saveDiagnostics() {
localStorage.setItem('disable3Dviewer', disable3Dviewer);
localStorage.setItem('disable3Dcontrols', disable3Dcontrols);
localStorage.setItem('disable3Dskybox', disable3Dskybox);
localStorage.setItem('disable3Drealtimepos', disable3Drealtimepos);
localStorage.setItem('disable3Dgcodepreview', disable3Dgcodepreview);
localStorage.setItem('disableSerialLog', disableSerialLog);
localStorage.setItem('disableDROupdates', disableDROupdates);
}
function initDiagnostics() {
if (localStorage.getItem('disable3Dviewer')) {
if (JSON.parse(localStorage.getItem('disable3Dviewer')) == true) {
disable3Dviewer = true;
$('#disable3DviewerTick').addClass("checked");
}
} else {
disable3Dviewer = false;
}
if (localStorage.getItem('disable3Dcontrols')) {
if (JSON.parse(localStorage.getItem('disable3Dcontrols')) == true) {
disable3Dcontrols = true;
$('#disable3DcontrolsTick').addClass("checked");
}
} else {
disable3Dcontrols = false;
}
if (localStorage.getItem('disable3Dskybox')) {
if (JSON.parse(localStorage.getItem('disable3Dskybox')) == true) {
disable3Dskybox = true;
$('#disable3DskyboxTick').addClass("checked");
}
} else {
disable3Dskybox = false;
}
if (localStorage.getItem('disable3Drealtimepos')) {
if (JSON.parse(localStorage.getItem('disable3Drealtimepos')) == true) {
disable3Drealtimepos = true;
$('#disable3DrealtimeposTick').addClass("checked");
}
} else {
disable3Drealtimepos = false;
}
if (localStorage.getItem('disable3Dgcodepreview')) {
if (JSON.parse(localStorage.getItem('disable3Dgcodepreview')) == true) {
disable3Dgcodepreview = true;
$('#disable3DgcodepreviewTick').addClass("checked");
}
} else {
disable3Dgcodepreview = false;
}
if (localStorage.getItem('disableSerialLog')) {
if (JSON.parse(localStorage.getItem('disableSerialLog')) == true) {
disableSerialLog = true;
$('#disableSerialLogTick').addClass("checked");
$('#consoletab').hide()
$('#gcodeeditortab').click()
}
} else {
disableSerialLog = false;
}
if (localStorage.getItem('disableDROupdates')) {
if (JSON.parse(localStorage.getItem('disableDROupdates')) == true) {
disableDROupdates = true;
$('#disableDROupdatesTick').addClass("checked");
}
} else {
disableDROupdates = false;
}
};
initDiagnostics();

Wyświetl plik

@ -21,6 +21,9 @@ function getChangelog() {
}
$(document).ready(function() {
initDiagnostics(); // run second time to ensure checkboxes are ticked
if (!isJogWidget) {
init3D();
}
@ -79,7 +82,7 @@ $(document).ready(function() {
editor.session.setValue(data);
parseGcodeInWebWorker(data)
$('#controlTab').click()
if (!setViewerDisableUI() || !webgl) {
if (!webgl) {
$('#gcodeviewertab').click();
} else {
$('#gcodeeditortab').click()
@ -122,7 +125,7 @@ function loadFile(f) {
r.readAsText(f);
r.onload = function(event) {
editor.session.setValue(this.result);
if (!setViewerDisableUI() || !webgl) {
if (webgl) {
printLog('<span class="fg-red">[ GCODE Parser ]</span><span class="fg-green"> GCODE File Loaded, please wait while we render a preview... </span>');
} else {
printLog('<span class="fg-red">[ GCODE Parser ]</span><span class="fg-green"> GCODE File Loaded </span>');
@ -180,12 +183,17 @@ function versionCompare(v1, v2, options) {
}
var webgl = (function() {
if (disable3Dviewer) {
return false;
} else {
// console.log("Testing WebGL")
try {
return !!window.WebGLRenderingContext && !!document.createElement('canvas').getContext('experimental-webgl');
} catch (e) {
return false;
}
}
})();
function saveGcode() {
@ -245,36 +253,36 @@ function invokeSaveAsDialog(file, fileName) {
}
}
function setViewerDisableUI() {
if (localStorage.getItem('viewerDisable')) {
if (JSON.parse(localStorage.getItem('viewerDisable')) == true) {
$('#viewerdisabled').removeClass("checked");
} else {
$('#viewerdisabled').addClass("checked");
}
} else {
$('#viewerdisabled').removeClass("checked");
return false;
}
return (!JSON.parse(localStorage.getItem('viewerDisable')))
}
function viewerdisable() {
console.log("viewerdisable")
if (localStorage.getItem('viewerDisable')) {
if (JSON.parse(localStorage.getItem('viewerDisable')) == true) {
console.log("viewerdisable disabled")
localStorage.setItem('viewerDisable', false);
location.reload();
} else {
console.log("viewerdisable enabled")
localStorage.setItem('viewerDisable', true);
location.reload();
}
} else {
console.log("viewerdisable defaulted")
localStorage.setItem('viewerDisable', false);
location.reload();
}
setViewerDisableUI()
}
// function setViewerDisableUI() {
// if (localStorage.getItem('viewerDisable')) {
// if (JSON.parse(localStorage.getItem('viewerDisable')) == true) {
// $('#viewerdisabled').removeClass("checked");
// } else {
// $('#viewerdisabled').addClass("checked");
// }
// } else {
// $('#viewerdisabled').removeClass("checked");
// return false;
// }
// return (!JSON.parse(localStorage.getItem('viewerDisable')))
// }
//
// function viewerdisable() {
// console.log("viewerdisable")
// if (localStorage.getItem('viewerDisable')) {
// if (JSON.parse(localStorage.getItem('viewerDisable')) == true) {
// console.log("viewerdisable disabled")
// localStorage.setItem('viewerDisable', false);
// location.reload();
// } else {
// console.log("viewerdisable enabled")
// localStorage.setItem('viewerDisable', true);
// location.reload();
// }
// } else {
// console.log("viewerdisable defaulted")
// localStorage.setItem('viewerDisable', false);
// location.reload();
// }
// setViewerDisableUI()
// }

Wyświetl plik

@ -273,11 +273,13 @@ function setJogPanel(val, status) {
$('#zPos').html('0.00');
if (!isJogWidget && webgl) {
if (!simRunning) {
if (!setViewerDisableUI() || !webgl) {
if (webgl) {
if (!disable3Drealtimepos) {
cone.visible = false;
}
}
}
}
} else if (val == 1 || val == 2) { // Connected, but not Playing yet
// Show panel and resize editor
@ -296,7 +298,9 @@ function setJogPanel(val, status) {
if (!isJogWidget && webgl) {
if (object) {
if (!simRunning) {
if (!disable3Drealtimepos) {
cone.visible = false;
}
// update3Dprogress(object.children.length)
}
}
@ -317,11 +321,13 @@ function setJogPanel(val, status) {
}
if (!isJogWidget && webgl) {
if (!simRunning) {
if (!setViewerDisableUI() || !webgl) {
if (webgl) {
if (!disable3Drealtimepos) {
cone.visible = true;
}
}
}
}
} else if (val == 4) { // Paused
// Show panel and resize editor
// $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
@ -337,9 +343,11 @@ function setJogPanel(val, status) {
}
if (!isJogWidget && webgl) {
if (!simRunning) {
if (!disable3Drealtimepos) {
cone.visible = true;
}
}
}
} else if (val == 5) { // Alarm State
// Show panel and resize editor
// $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 485 + 'px)');
@ -356,11 +364,13 @@ function setJogPanel(val, status) {
}
if (!isJogWidget && webgl) {
if (!simRunning) {
if (!setViewerDisableUI() || !webgl) {
if (webgl) {
if (!disable3Drealtimepos) {
cone.visible = false;
}
}
}
}
} else if (val == 6) { // Firmware Upgrade State
// Show panel and resize editor
// $("#jogcontrols").slideUp(20);
@ -381,10 +391,12 @@ function setJogPanel(val, status) {
$('#zPos').html('0.00');
if (!isJogWidget && webgl) {
if (!simRunning) {
if (!disable3Drealtimepos) {
cone.visible = false;
}
}
}
}
}
function setConsole(val, status) {

Wyświetl plik

@ -89,6 +89,7 @@ function drawWorkspace(xmin, xmax, ymin, ymax) {
scene.fog = new THREE.Fog(0xffffff, 1, 20000);
// SKYDOME
if (!disable3Dskybox) {
var uniforms = {
topColor: {
value: new THREE.Color(0x0077ff)
@ -121,7 +122,9 @@ function drawWorkspace(xmin, xmax, ymin, ymax) {
sky = new THREE.Mesh(skyGeo, skyMat);
sky.name = "Skydome"
workspace.add(sky);
}
if (!disable3Drealtimepos) {
cone = new THREE.Mesh(new THREE.CylinderGeometry(0, 5, 40, 15, 1, false), new THREE.MeshPhongMaterial({
color: 0x0000ff,
specular: 0x0000ff,
@ -138,6 +141,7 @@ function drawWorkspace(xmin, xmax, ymin, ymax) {
cone.visible = false;
cone.name = "Simulation Marker"
workspace.add(cone)
}
gridsystem.name = "Grid System"
workspace.add(gridsystem)
redrawGrid(xmin, xmax, ymin, ymax, false);
@ -283,7 +287,7 @@ function setBullseyePosition(x, y, z) {
}
function init3D() {
if (!setViewerDisableUI()) {
if (webgl) {
console.log('WebGL Support found! success: this application will work optimally on this device!');
printLog("<span class='fg-red'>[ 3D Viewer ] </span><span class='fg-green'>WebGL Support found! success: this application will work optimally on this device!</span>")
@ -309,6 +313,7 @@ function init3D() {
camera.updateProjectionMatrix();
if (!disable3Dcontrols) {
controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.target.set(0, 0, 0); // view direction perpendicular to XY-plane
@ -323,6 +328,8 @@ function init3D() {
controls.enableZoom = true; // optional
controls.maxDistance = 8000; // limit max zoom out
controls.enableKeys = false; // Disable Keyboard on canvas
}
drawWorkspace();
@ -344,16 +351,6 @@ function init3D() {
$('#consoletab').click()
return false;
};
} else {
console.log('3D Viewer Disabled from the Tools and Wizards menu');
printLog('3D Viewer Disabled from the Tools and Wizards menu');
$('#gcodeviewertab').hide()
$('#consoletab').click()
return false;
}
}
@ -366,43 +363,10 @@ function animate() {
scene.remove(scene.children[1])
}
// var documents = new THREE.Group();
// documents.name = "Documents";
// for (i = 0; i < objectsInScene.length; i++) {
// documents.add(objectsInScene[i])
// }
// scene.add(documents)
//
// var toolpaths = new THREE.Group();
// toolpaths.name = "Toolpaths";
// for (i = 0; i < toolpathsInScene.length; i++) {
//
// if (toolpathsInScene[i].userData.visible) {
// if (toolpathsInScene[i].userData.inflated) {
// if (toolpathsInScene[i].userData.inflated.userData.pretty) {
// if (toolpathsInScene[i].userData.inflated.userData.pretty.children.length > 0) {
// toolpaths.add(toolpathsInScene[i].userData.inflated.userData.pretty);
// } else {
// toolpaths.add(toolpathsInScene[i].userData.inflated);
// }
// } else {
// toolpaths.add(toolpathsInScene[i].userData.inflated);
// }
// };
// }
// }
// scene.add(toolpaths)
// if (fancysim == true) {
// scene.add(simgcodeobj)
// } else {
if (object) {
scene.add(object)
}
// }
clearSceneFlag = false;
} // end clearSceneFlag
@ -415,9 +379,8 @@ function animate() {
}
}
function viewExtents(objecttosee) {
if (!disable3Dcontrols) {
// console.log("viewExtents. object:", objecttosee);
// console.log("controls:", controls);
//wakeAnimate();
@ -495,6 +458,7 @@ function viewExtents(objecttosee) {
controls.object.updateProjectionMatrix();
}
}
}
};
function makeSprite(scene, rendererType, vals) {
@ -564,7 +528,9 @@ function fixRenderSize() {
//renderer.setSize(window.innerWidth, window.innerHeight);
camera.aspect = sceneWidth / sceneHeight;
camera.updateProjectionMatrix();
if (!disable3Dcontrols) {
controls.reset();
}
setTimeout(function() {
resetView();
}, 10);

Wyświetl plik

@ -38,6 +38,7 @@ function showGrbl(bool) {
}
function printLog(string) {
if (!disableSerialLog) {
if (document.getElementById("console") !== null) {
if (string.isString) {
// split(/\r\n|\n|\r/);
@ -55,7 +56,8 @@ function printLog(string) {
$('#console').append(template);
$('#console').scrollTop(($("#console")[0].scrollHeight - $("#console").height()) + 20);
}
}
}
};
function initSocket() {
socket = io.connect(server); // socket.io init
@ -79,7 +81,7 @@ function initSocket() {
editor.session.setValue(data);
parseGcodeInWebWorker(data)
$('#controlTab').click()
if (!setViewerDisableUI() || !webgl) {
if (webgl) {
$('#gcodeviewertab').click();
} else {
$('#gcodeeditortab').click()
@ -298,6 +300,7 @@ function initSocket() {
$('#runStatus').html("Controller: " + status.comms.runStatus);
if (!disableDROupdates) {
if (unit == "mm") {
var xpos = status.machine.position.work.x + unit;
var ypos = status.machine.position.work.y + unit;
@ -317,25 +320,32 @@ function initSocket() {
if ($('#zPos').html() != zpos) {
$('#zPos').html(zpos);
}
} else {
$('#xPos').html('disabled');
$('#yPos').html('disabled');
$('#zPos').html('disabled');
}
if (webgl) {
if (!disable3Drealtimepos) {
if (!isJogWidget) {
if (!simRunning) {
if (object) {
if (object.userData.inch) {
cone.position.x = status.machine.position.work.x * 0.0393701
cone.position.y = status.machine.position.work.y * 0.0393701
cone.position.z = (parseFloat(status.machine.position.work.z * 0.0393701) + 20)
} else {
// if (object.userData.inch) {
// cone.position.x = status.machine.position.work.x * 0.0393701
// cone.position.y = status.machine.position.work.y * 0.0393701
// cone.position.z = (parseFloat(status.machine.position.work.z * 0.0393701) + 20)
// } else {
cone.position.x = status.machine.position.work.x
cone.position.y = status.machine.position.work.y
cone.position.z = (parseFloat(status.machine.position.work.z) + 20)
}
// }
}
}
}
}
}
if (safeToUpdateSliders) {
if ($('#fro').data('slider') && $('#tro').data('slider')) {

Wyświetl plik

@ -59,7 +59,8 @@ function convertParsedDataToObject(parsedData) {
function parseGcodeInWebWorker(gcode) {
if (!setViewerDisableUI() || !webgl) {
if (webgl) {
if (!disable3Dgcodepreview) {
simstop()
scene.remove(object)
object = false;
@ -116,7 +117,7 @@ function parseGcodeInWebWorker(gcode) {
printLog("<span class='fg-red'>[ GCODE Parser ]</span><span class='fg-green'> GCODE Preview Rendered Succesfully: Estimated GCODE Run Time: </span><span class='badge inline bg-darkGreen fg-white'>" + formattedTime + "</span>")
}
}, 200);
$('#3dviewicon').removeClass('fa-pulse')
$('#3dviewicon').removeClass('fa-pulse');
$('#3dviewlabel').html(' 3D View')
}
}, false);
@ -124,10 +125,11 @@ function parseGcodeInWebWorker(gcode) {
worker.postMessage({
'data': gcode
});
$('#3dviewicon').addClass('fa-pulse')
$('#3dviewicon').addClass('fa-pulse');
$('#3dviewlabel').html(' 3D View (rendering, please wait...)')
// populateToolChanges(gcode)
}
}
};
function simSpeed() {
@ -160,6 +162,7 @@ function sim(startindex) {
$('#runSimBtn').hide()
$('#stopSimBtn').show()
clearSceneFlag = true;
if (!disable3Drealtimepos) {
$("#conetext").show();
cone.visible = true
var posx = object.userData.lines[0].p2.x; //- (sizexmax/2);
@ -175,7 +178,7 @@ function sim(startindex) {
opacity: 0.9,
transparent: true
})
}
simRunning = true;
// timefactor = 1;
$('#simspeedval').text(timefactor);
@ -260,6 +263,7 @@ function runSim() {
var simTimeInSec = simTime * 60;
// console.log(simTimeInSec)
if (!object.userData.lines[simIdx].args.isFake) {
if (!disable3Drealtimepos) {
TweenMax.to(cone.position, simTimeInSec, {
x: posx,
y: posy,
@ -278,6 +282,7 @@ function runSim() {
}
}
})
}
} else {
if (simRunning == false) {
//return
@ -350,6 +355,7 @@ function runSimArc() {
// console.log(simTimeInSec)
if (!object.userData.lines[simIdx].args.isFake) {
if (!disable3Drealtimepos) {
TweenMax.to(cone.position, simTimeInSec, {
x: posx,
y: posy,
@ -369,6 +375,7 @@ function runSimArc() {
}
}
})
}
} else {
if (simRunning == false) {
//return
@ -393,6 +400,8 @@ function simstop() {
// timefactor = 1;
$('#simspeedval').text(timefactor);
editor.gotoLine(0)
if (!disable3Drealtimepos) {
cone.visible = false;
}
clearSceneFlag = true;
}

Wyświetl plik

@ -1,6 +1,6 @@
{
"name": "OpenBuildsCONTROL",
"version": "1.0.195",
"version": "1.0.196",
"license": "AGPL-3.0",
"description": "Machine Interface Driver for OpenBuilds",
"author": "github.com/openbuilds <webmaster@openbuilds.com>",