Added OBC Support

pull/110/head v1.0.161
openbuilds-engineer 2019-04-29 19:26:29 +02:00
rodzic 5b0b672da4
commit 4bbe6c1375
8 zmienionych plików z 78 dodań i 35 usunięć

Wyświetl plik

@ -1,3 +1,4 @@
v1.0.161: Associate .OBC (OpenBuilds CAM files)
v1.0.160: Update MiniMill Grbl-defaults Profile to match New Video
v1.0.159: Added Feedrate/Spindle Override Reset Buttons
v1.0.158: Improvements to the Mobile Jog UI

Wyświetl plik

@ -109,7 +109,7 @@
</span>
<span class="caption">Unlock<br>Alarm</span>
</button>
<button class="ribbon-button" onclick="socket.emit('stop', true)">
<button class="ribbon-button" onclick="socket.emit('stop', false)">
<span class="icon">
<span class="fa-layers fa-fw">
<i class="fas fa-circle fg-red" data-fa-transform="grow-8"></i>
@ -186,7 +186,7 @@
</span>
<span class="caption">Pause<br>Job</span>
</button>
<button id="stopBtn" class="ribbon-button" onclick="socket.emit('stop', true)">
<button id="stopBtn" class="ribbon-button" onclick="socket.emit('stop', false)">
<span class="icon">
<i class="fas fa-stop"></i>
</span>
@ -291,7 +291,7 @@
</span>
<span class="caption">Unlock<br>Alarm</span>
</button>
<button class="ribbon-button" onclick="socket.emit('stop', true)">
<button class="ribbon-button" onclick="socket.emit('stop', false)">
<span class="icon">
<span class="fa-layers fa-fw">
<i class="fas fa-circle fg-red" data-fa-transform="grow-8"></i>
@ -324,7 +324,7 @@
</span>
<span class="caption">Unlock<br>Alarm</span>
</button>
<button class="ribbon-button" onclick="socket.emit('stop', true)">
<button class="ribbon-button" onclick="socket.emit('stop', false)">
<span class="icon">
<span class="fa-layers fa-fw">
<i class="fas fa-circle fg-red" data-fa-transform="grow-8"></i>

Wyświetl plik

@ -76,7 +76,7 @@
</span>
<span class="caption">Unlock</span>
</button>
<button class="button mb-2" onclick="socket.emit('stop', true)">
<button class="button mb-2" onclick="socket.emit('stop', false)">
<span class="icon">
<span class="fa-layers fa-fw">
<i class="fas fa-circle fg-red" data-fa-transform="grow-8"></i>

Wyświetl plik

@ -1,7 +1,3 @@
var realTimeJog
function cancelJog() {
clearInterval(realTimeJog)
socket.emit('stop', false)
// console.log('stopped jog')
socket.emit('stop', true)
}

Wyświetl plik

@ -80,7 +80,6 @@ function bindKeys() {
$(document).bind('keydown', keyboardShortcuts.xM, function(event) {
if (allowContinuousJog) {
if (!event.originalEvent.repeat) {
// startJog();
var direction = "X-";
var feed = $('#jograte').val();
socket.emit('runCommand', "$J=G91 G21 " + direction + "1000 F" + feed + "\n");
@ -100,7 +99,6 @@ function bindKeys() {
$(document).bind('keydown', keyboardShortcuts.xP, function(event) {
if (allowContinuousJog) {
if (!event.originalEvent.repeat) {
// startJog();
var direction = "X";
var feed = $('#jograte').val();
socket.emit('runCommand', "$J=G91 G21 " + direction + "1000 F" + feed + "\n");
@ -121,7 +119,6 @@ function bindKeys() {
$(document).bind('keydown', keyboardShortcuts.yM, function(event) {
if (allowContinuousJog) {
if (!event.originalEvent.repeat) {
// startJog();
var direction = "Y-";
var feed = $('#jograte').val();
socket.emit('runCommand', "$J=G91 G21 " + direction + "1000 F" + feed + "\n");
@ -210,7 +207,7 @@ function bindKeys() {
}
if (keyboardShortcuts.estop.length) {
$(document).bind('keydown', keyboardShortcuts.estop, function() {
socket.emit('stop', true)
socket.emit('stop', false)
});
}
if (keyboardShortcuts.playpause.length) {

Wyświetl plik

@ -429,7 +429,6 @@ function initSocket() {
}
$('#commstatus').html(string);
$('#runstatus').html(status.comms.runStatus);
$('#drvqueue').html(status.comms.queue);
// if (status.machine.firmware.buffer.length > 0) {
// $('#buffstatus').html(status.machine.firmware.buffer[0] + " blocks / " + status.machine.firmware.buffer[1] + " bytes");

Wyświetl plik

@ -153,6 +153,7 @@ if (isElectron()) {
var uploadsDir = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + 'Library/Preferences' : '/var/local')
}
var uploadedgcode = ""; // var to store uploaded gcode
var uploadedworkspace = ""; // var to store uploaded OpenBuildsCAM Workspace
mkdirp(uploadsDir, function(err) {
if (err) console.error(err)
@ -196,6 +197,7 @@ var has4thAxis = false;
var feedOverride = 100,
spindleOverride = 100;
//regex to identify MD5hash on sdupload later
var re = new RegExp("^[a-f0-9]{32}");
@ -470,7 +472,12 @@ app.get('/gcode', (req, res) => {
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.send(uploadedgcode);
}
})
app.get('/workspace', (req, res) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
res.send(uploadedworkspace);
})
// File Post
@ -1610,9 +1617,17 @@ function readFile(path) {
uploadedgcode = "";
}
if (data) {
io.sockets.emit('gcodeupload', data);
uploadedgcode = data;
return data
if (path.endsWith('.obc')) { // OpenBuildsCAM Workspace
uploadedworkspace = data;
const {
shell
} = require('electron')
shell.openExternal('https://cam.openbuilds.com')
} else { // GCODE
io.sockets.emit('gcodeupload', data);
uploadedgcode = data;
return data
}
}
});
}
@ -2078,25 +2093,31 @@ if (isElectron()) {
} else {
electronApp.on('second-instance', (event, commandLine, workingDirectory) => {
//Someone tried to run a second instance, we should focus our window.
if (jogWindow === null) {
createJogWindow();
jogWindow.show()
jogWindow.setAlwaysOnTop(true);
jogWindow.focus();
jogWindow.setAlwaysOnTop(false);
} else {
jogWindow.show()
jogWindow.setAlwaysOnTop(true);
jogWindow.focus();
jogWindow.setAlwaysOnTop(false);
}
// console.log('SingleInstance')
// console.log(commandLine)
var openFilePath = commandLine[1];
if (openFilePath !== "") {
// console.log(openFilePath);
readFile(openFilePath);
}
if (openFilePath.endsWith('.obc')) {
//
} else {
if (jogWindow === null) {
createJogWindow();
jogWindow.show()
jogWindow.setAlwaysOnTop(true);
jogWindow.focus();
jogWindow.setAlwaysOnTop(false);
} else {
jogWindow.show()
jogWindow.setAlwaysOnTop(true);
jogWindow.focus();
jogWindow.setAlwaysOnTop(false);
}
}
})
// Create myWindow, load the rest of the app, etc...
app.on('ready', () => {})
@ -2356,20 +2377,25 @@ if (isElectron()) {
}
function stop(hardstop) {
function stop(jog) {
if (status.comms.connectionStatus > 0) {
status.comms.paused = true;
console.log('STOP');
switch (status.machine.firmware.type) {
case 'grbl':
addQRealtime('!'); // hold
console.log('Sent: !');
if (jog) {
addQRealtime(String.fromCharCode(0x85)); // canceljog
console.log('Sent: 0x85 Jog Cancel');
} else {
addQRealtime('!'); // hold
console.log('Sent: !');
}
if (status.machine.firmware.version === '1.1d') {
addQRealtime(String.fromCharCode(0x9E)); // Stop Spindle/Laser
console.log('Sent: Code(0x9E)');
}
console.log('Cleaning Queue');
if (hardstop) {
if (!jog) {
addQRealtime(String.fromCharCode(0x18)); // ctrl-x
console.log('Sent: Code(0x18)');
}
@ -2453,4 +2479,22 @@ function unpause() {
}
}
function isJson(item) {
item = typeof item !== "string" ?
JSON.stringify(item) :
item;
try {
item = JSON.parse(item);
} catch (e) {
return false;
}
if (typeof item === "object" && item !== null) {
return true;
}
return false;
}
process.on('exit', () => console.log('exit'))

Wyświetl plik

@ -1,6 +1,6 @@
{
"name": "OpenBuildsCONTROL",
"version": "1.0.160",
"version": "1.0.161",
"license": "AGPL-3.0",
"description": "Machine Interface Driver for OpenBuilds",
"author": "github.com/openbuilds <webmaster@openbuilds.com>",
@ -53,6 +53,12 @@
"artifactName": "${productName}-Setup-${version}.${ext}"
},
"fileAssociations": [
{
"ext": "obc",
"name": "OpenBuilds CAM Workspace",
"description": "OpenBuilds CAM Workspace",
"role": "Viewer"
},
{
"ext": "gcode",
"name": "GCODE File",