pull/110/head
openbuilds-engineer 2019-09-13 20:39:59 +02:00
rodzic f87448118c
commit 3b35098a7e
9 zmienionych plików z 131 dodań i 64 usunięć

Wyświetl plik

@ -1,3 +1,5 @@
v1.0.189: Fixed Workbee1010 and Workbee1050 profile for new BlackBox wiring video
v1.0.188: Improved 3D Viewer for Inch mode files
v1.0.187: Fixed Workbee1510 profile for new BlackBox wiring video
v1.0.186: Fixes for 3D viewer in Inch mode
v1.0.185: Changed wording on Firmware Detection to avoid confusion

Wyświetl plik

@ -1,5 +1,107 @@
var sectionNum = 0;
var toolchanges = [];
function populateToolChanges(gcode) {
// toolChanges
toolchanges = setupToolChanges(gcode);
if (toolchanges.length) {
$('#runBtn').hide()
$('#runToolsBtn').show()
$('#toolChangesMenu').empty();
var dropdownTemplate = ``;
if (toolchanges[0].lineNum > 0) {
dropdownTemplate += `<li onclick="runGcodeAllTools()"><a href="#" onclick=""><i class="fas fa-play"></i> Run Complete Job</a></li>`
dropdownTemplate += `<li class="divider"></li>`
dropdownTemplate += `<li onclick="runGcodeSection(` + 0 + `,` + toolchanges[0].lineNum + `)"><a href="#" onclick=""><i class="fas fa-play"></i> Run Header (lines 1-` + toolchanges[0].lineNum + `)</a></li>`
}
for (i = 0; i < toolchanges.length; i++) {
var endline = false;
if (toolchanges[i + 1]) {
endline = toolchanges[i + 1].lineNum
}
dropdownTemplate += `<li onclick="runGcodeSection(` + toolchanges[i].lineNum + `,` + endline + `)">`
dropdownTemplate += `<a href="#" onclick=""><i class="fas fa-play"></i> Run Tool `
if (toolchanges[i].toolNum) {
dropdownTemplate += toolchanges[i].toolNum + ` `
}
dropdownTemplate += ` from line ` + (toolchanges[i].lineNum + 1) + ` `
if (toolchanges[i].toolComment) {
dropdownTemplate += `/ Tool Details: ` + toolchanges[i].toolComment + ` `
}
if (toolchanges[i].sectionComment) {
dropdownTemplate += `/ Section ` + toolchanges[i].sectionComment + ` `
}
dropdownTemplate += `</a></li>`
}
$('#toolChangesMenu').html(dropdownTemplate)
} else {
$('#runBtn').show()
$('#runToolsBtn').hide()
}
}
function runGcodeAllTools() {
var gcode = editor.getValue()
gcodeLines = gcode.split("\n")
var multiToolJob = [];
// Header
if (toolchanges[0].lineNum > 0) {
var headergcode = gcodeLines.slice(0, toolchanges[0].lineNum).join("\n").replace(/M6|M06|M006/i, "");
var section = {
gcode: headergcode,
toolNum: false,
toolComment: false,
sectionComment: sectionComment,
startLine: 0,
endLine: toolchanges[0].lineNum,
completed: false
}
multiToolJob.push(section)
}
// Toolchanges
for (i = 0; i < toolchanges.length; i++) {
var startLine = toolchanges[i].lineNum + 1
if (toolchanges[i + 1]) {
var endLine = toolchanges[i + 1].lineNum
} else {
endLine = false;
}
if (toolchanges[i].toolNum) {
var toolNum = toolchanges[i].toolNum
}
if (toolchanges[i].toolComment) {
var toolComment = toolchanges[i].toolComment
}
if (toolchanges[i].sectionComment) {
var sectionComment = toolchanges[i].sectionComment
}
if (endLine) {
var newgcode = gcodeLines.slice(startLine, endLine).join("\n").replace(/M6|M06|M006/i, "");
} else {
var newgcode = gcodeLines.slice(startLine).join("\n").replace(/M6|M06|M006/i, "");
}
var section = {
gcode: newgcode,
toolNum: toolNum,
toolComment: toolComment,
sectionComment: sectionComment,
startLine: startLine,
endLine: endLine,
completed: false
}
multiToolJob.push(section)
}
// Now run this array one by one
console.log(JSON.stringify(multiToolJob))
}
// endline can be Blank
function runGcodeSection(startline, endline) {
var gcode = editor.getValue()
@ -12,10 +114,10 @@ function runGcodeSection(startline, endline) {
var newGcodeString = newgcode.join("\n").replace(/M6|M06|M006/i, "");
console.log(newGcodeString)
socket.emit('runJob', newGcodeString);
}
function setupToolChanges(gcode) {
// scan gcode for tool change info
var fileLines = gcode

Wyświetl plik

@ -109,7 +109,7 @@ function setConnectBar(val, status) {
// Toolbar with play/pause/stop
function setControlBar(val, status) {
if (val == 0) { // Not Connected Yet
if (toolchanges.length) {
if (toolchanges && toolchanges.length) {
$('#runToolsBtn').hide().attr('disabled', true);
$('#runBtn').hide().attr('disabled', true);
} else {

Wyświetl plik

@ -139,7 +139,7 @@ function drawRulerInches(xmin, xmax, ymin, ymax) {
length10 = 1.7;
var unitsval = "in"
console.log(xmin, xmax, ymin, ymax)
// console.log(xmin, xmax, ymin, ymax)
var ruler = new THREE.Group();
var material = new THREE.LineBasicMaterial({
@ -225,7 +225,7 @@ function drawRulerInches(xmin, xmax, ymin, ymax) {
ymin = Math.floor(ymin * 0.0393701);
ymax = Math.ceil(ymax * 0.0393701);
console.log(xmin, xmax, ymin, ymax)
// console.log(xmin, xmax, ymin, ymax)
var x = [];
var y = [];

Wyświetl plik

@ -145,14 +145,14 @@ function drawWorkspace(xmin, xmax, ymin, ymax) {
}
function redrawGrid(xmin, xmax, ymin, ymax, inches) {
console.log(xmin, xmax, ymin, ymax, inches)
// console.log(xmin, xmax, ymin, ymax, inches)
if (inches) {
xmin = Math.floor(xmin * 25.4);
xmax = Math.ceil(xmax * 25.4);
ymin = Math.floor(ymin * 25.4);
ymax = Math.ceil(ymax * 25.4);
}
console.log(xmin, xmax, ymin, ymax, inches)
// console.log(xmin, xmax, ymin, ymax, inches)
sizexmax = xmax;
sizeymax = ymax;

Wyświetl plik

@ -25,6 +25,17 @@ $(document).ready(function() {
});
});
function showGrbl(bool) {
if (bool) {
sendGcode('$$')
sendGcode('$I')
$("#grblButtons").show()
$("#firmwarename").html('Grbl')
} else {
$("#grblButtons").hide()
$("#firmwarename").html('')
}
}
function printLog(string) {
if (document.getElementById("console") !== null) {
@ -139,24 +150,16 @@ function initSocket() {
z0proberesult(data)
});
function showGrbl(bool) {
if (bool) {
sendGcode('$$')
sendGcode('$I')
$("#grblButtons").show()
$("#firmwarename").html('Grbl')
} else {
$("#grblButtons").hide()
$("#firmwarename").html('')
}
}
socket.on("jobComplete", function(data) {
console.log("Job Complete", data)
});
socket.on("machinename", function(data) {
if (typeof setMachineButton !== 'undefined') {
setMachineButton(data)
}
});
socket.on("queueCount", function(data) {
// calc percentage
var left = parseInt(data[0])
@ -172,7 +175,7 @@ function initSocket() {
editor.gotoLine(parseInt(data[1]) - parseInt(data[0]));
}
if (typeof object !== 'undefined' && done > 0) {
if (object.userData !== 'undefined' && object.userData.lines.length > 2) {
if (object.userData !== 'undefined' && object.userData && object.userData.lines.length > 2) {
var timeremain = object.userData.lines[object.userData.lines.length - 1].p2.timeMinsSum - object.userData.lines[done].p2.timeMinsSum;
}
if (!isNaN(timeremain)) {

Wyświetl plik

@ -73,46 +73,7 @@ function parseGcodeInWebWorker(gcode) {
});
$('#3dviewicon').addClass('fa-pulse')
$('#3dviewlabel').html(' 3D View (rendering, please wait...)')
// toolChanges
// toolchanges = setupToolChanges(gcode);
//
// if (toolchanges.length) {
// $('#runBtn').hide()
// $('#runToolsBtn').show()
// $('#toolChangesMenu').empty();
// var dropdownTemplate = ``;
// if (toolchanges[0].lineNum > 0) {
// dropdownTemplate += `<li onclick="runGcodeSection(` + 0 + `,` + toolchanges[0].lineNum + `)"><a href="#" onclick=""><i class="fas fa-play"></i> Run Complete Job</a></li>`
// dropdownTemplate += `<li class="divider"></li>`
// dropdownTemplate += `<li onclick="runGcodeSection(` + 0 + `,` + toolchanges[0].lineNum + `)"><a href="#" onclick=""><i class="fas fa-play"></i> Run Header (lines 1-` + toolchanges[0].lineNum + `)</a></li>`
//
// }
// for (i = 0; i < toolchanges.length; i++) {
// var endline = false;
// if (toolchanges[i + 1]) {
// endline = toolchanges[i + 1].lineNum
// }
// dropdownTemplate += `<li onclick="runGcodeSection(` + toolchanges[i].lineNum + `,` + endline + `)">`
// dropdownTemplate += `<a href="#" onclick=""><i class="fas fa-play"></i> Run Tool `
// if (toolchanges[i].toolNum) {
// dropdownTemplate += toolchanges[i].toolNum + ` `
// }
// dropdownTemplate += ` from line ` + (toolchanges[i].lineNum + 1) + ` `
// if (toolchanges[i].toolComment) {
// dropdownTemplate += `/ Tool Details: ` + toolchanges[i].toolComment + ` `
// }
// if (toolchanges[i].sectionComment) {
// dropdownTemplate += `/ Section ` + toolchanges[i].sectionComment + ` `
// }
// dropdownTemplate += `</a></li>`
// }
// $('#toolChangesMenu').html(dropdownTemplate)
// } else {
// $('#runBtn').show()
// $('#runToolsBtn').hide()
// }
// populateToolChanges(gcode)
};

Wyświetl plik

@ -272,7 +272,7 @@ var status = {
},
},
comms: {
connectionStatus: 0, //0 = not connected, 1 = opening, 2 = connected, 3 = playing, 4 = paused
connectionStatus: 0, //0 = not connected, 1 = opening, 2 = connected, 3 = playing, 4 = paused, 5 = alarm, 6 = firmware upgrade
connectedTo: "none",
runStatus: "Pending", // 0 = init, 1 = idle, 2 = alarm, 3 = stop, 4 = run, etc?
queue: 0,
@ -2040,13 +2040,12 @@ function send1Q() {
break;
}
if (queuePointer >= gcodeQueue.length) {
if (!status.comms.connectionStatus == 5) {
status.comms.connectionStatus = 2; // finished
}
status.comms.connectionStatus = 2; // finished
clearInterval(queueCounter);
gcodeQueue.length = 0; // Dump the Queye
queuePointer = 0;
status.comms.connectionStatus = 2; // finished
io.sockets.emit('jobComplete', true);
}
} else {
console.log('Not Connected')

Wyświetl plik

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