Fixes for Smoothieware

pull/110/head
openbuilds-engineer 2018-08-09 19:29:41 +02:00
rodzic 5232e830ad
commit 2e23dfbdb7
3 zmienionych plików z 17 dodań i 100 usunięć

Wyświetl plik

@ -3,7 +3,6 @@ var server = ''; //192.168.14.100';
var programBoard = {};
var grblParams = {}
var smoothieParams = {}
var sduploading;
var nostatusyet = true;
var safeToUpdateSliders = false;
var laststatus
@ -134,21 +133,6 @@ function initSocket() {
socket.on('data', function(data) {
// console.log(data.length, data)
var toPrint = data.response;
if (data.response.indexOf("Done saving file.") != -1) {
$('#sdupload_modal').modal('hide');
$("#sduploadform").show()
$("#sduploadprogress").hide()
$("#sduploadbtn").prop('disabled', false);
$("#sduploadcancelbtn").prop('disabled', false);
$("#sdmodalclosebtn").prop('disabled', false);
$('#sdprogressup').css('width', '0%').attr('aria-valuenow', 0);
}
if (data.response.indexOf("End file list") != -1) {
// We just got an M20 sd listing back... lets update UI
setTimeout(function() {
sdListPopulate();
}, 600);
}
// Parse Grbl Settings Feedback
if (data.response.indexOf('$') === 0) {
@ -192,11 +176,6 @@ function initSocket() {
var progressbar = $("#progressbar").data("progress");
progressbar.val(donepercent);
// }
sduploading = data[2];
if (sduploading) {
var percent = 100 - (parseInt(data[0]) / parseInt(data[1]) * 100)
$('#sdprogressup').css('width', percent + '%').attr('aria-valuenow', percent);
}
})
socket.on('toastError', function(data) {
@ -421,22 +400,6 @@ function initSocket() {
}
});
$("#sdtogglemodal").on("click", function() {
$('#sdupload_modal').modal('show');
if (sduploading) {
$("#sduploadform").hide()
$("#sduploadprogress").show()
} else {
$("#sduploadform").show()
$("#sduploadprogress").hide()
}
})
$("#sdlist").on("click", function() {
sendGcode("M20");
})
var bellflash = setInterval(function() {
if (!nostatusyet) {
if (laststatus) {
@ -500,42 +463,6 @@ function sendGcode(gcode) {
// $('#editorContextMenu').hide();
// }
function sdListPopulate() {
$('#sdfilelist').empty();
if (laststatus.machine.sdcard.list.length > 0) {
for (i = laststatus.machine.sdcard.list.length - 1; i >= 0; i--) {
var name = laststatus.machine.sdcard.list[i]
console.log(name);
if (name.length > 25) {
var newname = ""
newname += name.substring(0, 10)
newname += "..."
newname += name.substring(name.length - 10)
name = newname;
}
if (name.indexOf("config") != -1 || name.indexOf("CONFIG") != -1) {
$("#sdfilelist").append(`<tr><td><i class="far fa-file"></i> ` + name + `</td><td></td></tr>`);
} else if (name.indexOf("FIRMWARE.CUR") != -1 || name.indexOf("firmware.cur") != -1) {
$("#sdfilelist").append(`<tr><td><i class="far fa-file"></i> ` + name + `</td><td></td></tr>`);
} else {
$("#sdfilelist").append(`<tr>
<td>
<i class="far fa-file"></i> ` + name + `
</td>
<td>
<div class="btn-group btn-group-xs" role="group">
<button type="button" class="btn btn-xs btn-outline-secondary" onclick="sendGcode('rm /sd/` + laststatus.machine.sdcard.list[i].replace(/(\r\n|\n|\r)/gm, "") + `'); sendGcode('M20'); ">Delete</button>
<button type="button" class="btn btn-xs btn-outline-secondary" onclick="sendGcode('M32 ` + laststatus.machine.sdcard.list[i].replace(/(\r\n|\n|\r)/gm, "") + `'); sendGcode('M20'); ">Print</button>
</div>
</td>
</tr>`);
}
}
$("#sdlist_modal").modal("show")
}
}
function feedOverride(step) {
if (socket) {
@ -549,20 +476,6 @@ function spindleOverride(step) {
}
}
function sdUpload() {
$("#sduploadbtn").prop('disabled', true);
$("#sduploadcancelbtn").prop('disabled', true);
$("#sdmodalclosebtn").prop('disabled', true);
$("#sduploadform").hide()
$("#sduploadprogress").show()
var filename = $("#sdfilename").val();
var gcode = editor.getValue()
var data = []
data.push(filename)
data.push(gcode)
socket.emit("saveToSd", data)
}
function friendlyPort(i) {
// var likely = false;
var img = 'usb.png';

Wyświetl plik

@ -735,9 +735,7 @@ io.on("connection", function(socket) {
// Start interval for status queries
statusLoop = setInterval(function() {
if (status.comms.connectionStatus > 0) {
if (!status.comms.sduploading) {
addQRealtime("?");
}
addQRealtime("?");
}
}, 250);
} else if (data.indexOf("LPC176") >= 0) { // LPC1768 or LPC1769 should be Smoothieware
@ -756,12 +754,7 @@ io.on("connection", function(socket) {
// Start interval for status queries
statusLoop = setInterval(function() {
if (status.comms.connectionStatus > 0) {
if (!status.comms.sduploading) {
addQRealtime("?");
if (status.machine.tools.hotend1 || status.machine.tools.hotend2 || status.machine.tools.heatbed) {
addQToStart("M105\n");
}
}
addQRealtime("?");
}
}, 200);
} // end of machine identification
@ -778,6 +771,11 @@ io.on("connection", function(socket) {
// console.log('got OK from ' + command)
command = sentBuffer.shift();
}
if (status.machine.firmware.type === "smoothie") {
// console.log('got OK from ' + command)
command = sentBuffer.shift();
}
status.comms.blocked = false;
send1Q();
} else if (data.indexOf('ALARM') === 0) { //} || data.indexOf('HALTED') === 0) {
@ -797,7 +795,7 @@ io.on("connection", function(socket) {
status.comms.connectionStatus = 5;
} else if (data.indexOf('WARNING: After HALT you should HOME as position is currently unknown') != -1) { //} || data.indexOf('HALTED') === 0) {
status.comms.connectionStatus = 2;
} else if (data.indexOf('Emergency Stop Requested ') != -1) { //} || data.indexOf('HALTED') === 0) {
} else if (data.indexOf('Emergency Stop Requested') != -1) { //} || data.indexOf('HALTED') === 0) {
console.log("Emergency Stop Requested")
status.comms.connectionStatus = 5;
} else if (data.indexOf('wait') === 0) { // Got wait from Repetier -> ignore
@ -1321,10 +1319,16 @@ io.on("connection", function(socket) {
console.log('Cleaning Queue');
addQRealtime(String.fromCharCode(0x18)); // ctrl-x
console.log('Sent: Code(0x18)');
status.comms.connectionStatus = 2;
break;
case 'smoothie':
status.comms.paused = true;
addQRealtime('M112'); // ctrl-x
setTimeout(function() {
addQToEnd("?");
send1Q();
}, 1000);
status.comms.connectionStatus = 5;
console.log('Sent: M112');
break;
}
@ -1332,12 +1336,12 @@ io.on("connection", function(socket) {
status.comms.queue = 0
queuePointer = 0;
gcodeQueue.length = 0; // Dump the queue
sentBuffer.length = 0; // Dump the queue
// sentBuffer.length = 0; // Dump bufferSizes
laserTestOn = false;
status.comms.blocked = false;
status.comms.paused = false;
status.comms.runStatus = 'Stopped';
status.comms.connectionStatus = 2;
if (jogWindow && !jogWindow.isFocused()) {
appIcon.displayBalloon({
icon: nativeImage.createFromPath(iconPath),
@ -1445,7 +1449,6 @@ function machineSend(gcode) {
var data = []
data.push(queueLeft);
data.push(queueTotal);
data.push(status.comms.sduploading)
io.sockets.emit("queueCount", data);
// console.log(gcode)
port.write(gcode);
@ -1774,6 +1777,7 @@ function send1Q() {
gcode = gcodeQueue[queuePointer];
queuePointer++;
status.comms.blocked = true;
sentBuffer.push(gcode);
machineSend(gcode + '\n');
// console.log('Sent: ' + gcode + ' Q: ' + (gcodeQueue.length - queuePointer));
}

Wyświetl plik

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