diff --git a/app/css/main.css b/app/css/main.css index 3348cc4..975b8e2 100644 --- a/app/css/main.css +++ b/app/css/main.css @@ -15,8 +15,8 @@ body { height: calc(100% - 1px); width: 100%; border-top: 1px solid #ccc; - margin-top: 5px; - box-shadow: 0 0 5px 10px #fff; + /* margin-top: 5px; */ + box-shadow: 0 0 2px 2px #ddd; } #console { @@ -28,7 +28,7 @@ body { overflow-x: none; text-align: left; background-color: #fff; - box-shadow: 0 0 5px 10px #fff; + box-shadow: 0 0 2px 2px #ddd; padding: 0px; font-size: 12px; padding-left: 20px; diff --git a/app/index.html b/app/index.html index bec2617..0d13661 100644 --- a/app/index.html +++ b/app/index.html @@ -520,7 +520,7 @@
- + @@ -533,13 +533,15 @@
- - - - - - - + +   +   +   +   +   +   +   +
diff --git a/app/js/grblsettings.js b/app/js/grblsettings.js index b18d3c4..8712af5 100644 --- a/app/js/grblsettings.js +++ b/app/js/grblsettings.js @@ -198,17 +198,21 @@ function checkifchanged() { function grblSaveSettings() { + var commands = "" for (var key in grblParams) { if (grblParams.hasOwnProperty(key)) { var j = key.substring(1) var newVal = $("#val-" + j + "-input").val(); // Only send values that changed if (parseFloat(newVal) != parseFloat(grblParams[key])) { - console.log(key + ' was ' + grblParams[key] + ' but now, its ' + newVal); - sendGcode(key + '=' + newVal); + // console.log(key + ' was ' + grblParams[key] + ' but now, its ' + newVal); + commands += key + '=' + newVal + "\n" + // sendGcode(key + '=' + newVal); } } } + console.log("commands", commands) + socket.emit('runJob', commands); grblParams = {}; Metro.dialog.create({ diff --git a/app/js/ui.js b/app/js/ui.js index 1dfd279..c018086 100644 --- a/app/js/ui.js +++ b/app/js/ui.js @@ -130,7 +130,7 @@ function setJogPanel(val, status) { if (val == 0) { // Not Connected Yet // Show panel and resize editor $("#jogcontrols").slideUp(20); - $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 250 + 'px)'); + $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 290 + 'px)'); $("#console").css('height', 'calc(' + 100 + 'vh - ' + 290 + 'px)'); // $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height()); editor.resize() @@ -141,7 +141,7 @@ function setJogPanel(val, status) { } else if (val == 0 || val == 2) { // Connected, but not Playing yet // Show panel and resize editor $("#jogcontrols").slideDown(20); - $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 445 + 'px)'); + $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)'); $("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)'); // $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height()); editor.resize() @@ -151,7 +151,7 @@ function setJogPanel(val, status) { } } else if (val == 3) { // Busy Streaming GCODE // Show panel and resize editor - $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 445 + 'px)'); + $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)'); $("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)'); // $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height()); editor.resize() @@ -163,7 +163,7 @@ function setJogPanel(val, status) { } else if (val == 4) { // Paused // Show panel and resize editor $("#jogcontrols").slideDown(20); - $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 445 + 'px)'); + $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)'); $("#console").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)'); // $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height()); editor.resize() @@ -174,7 +174,7 @@ function setJogPanel(val, status) { } else if (val == 5) { // Alarm State // Show panel and resize editor $("#jogcontrols").slideUp(20); - $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 295 + 'px)'); + $("#editor").css('height', 'calc(' + 100 + 'vh - ' + 290 + 'px)'); $("#console").css('height', 'calc(' + 100 + 'vh - ' + 290 + 'px)'); // $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height()); editor.resize() diff --git a/index.js b/index.js index 550692d..f819a43 100644 --- a/index.js +++ b/index.js @@ -199,9 +199,8 @@ var statusLoop; var queueCounter; var listPortsLoop; -var GRBL_RX_BUFFER_SIZE = 128; // 128 characters +var GRBL_RX_BUFFER_SIZE = 32; // 128 characters var grblBufferSize = []; -var new_grbl_buffer = false; var SMOOTHIE_RX_BUFFER_SIZE = 64; // max. length of one command line var smoothie_buffer = false; @@ -804,7 +803,7 @@ io.on("connection", function(socket) { statusLoop = setInterval(function() { if (status.comms.connectionStatus > 0) { if (!status.comms.sduploading) { - machineSend("?"); + // machineSend("?"); } } }, 250); @@ -1084,6 +1083,7 @@ io.on("connection", function(socket) { socket.on('runJob', function(data) { + // console.log(data) console.log('Run Job (' + data.length + ')'); if (status.comms.connectionStatus > 0) { if (data) { @@ -1678,6 +1678,7 @@ function machineSend(gcode) { data.push(queueTotal); data.push(status.comms.sduploading) io.sockets.emit("queueCount", data); + // console.log(gcode) port.write(gcode); if (gcode != "?") { lastGcode.push(gcode); @@ -1719,6 +1720,7 @@ function grblBufferSpace() { return GRBL_RX_BUFFER_SIZE - total; } + function send1Q() { var gcode; var gcodeLen = 0; @@ -1726,43 +1728,18 @@ function send1Q() { if (status.comms.connectionStatus > 0) { switch (status.machine.firmware.type) { case 'grbl': - if (new_grbl_buffer) { - if (grblBufferSize.length === 0) { - spaceLeft = GRBL_RX_BUFFER_SIZE; - while ((queueLen - queuePointer) > 0 && spaceLeft > 0 && !status.comms.blocked && !status.comms.paused) { - gcodeLen = gcodeQueue[queuePointer].length; - if (gcodeLen < spaceLeft) { - // Add gcode to send buffer - gcode = gcodeQueue[queuePointer]; - queuePointer++; - grblBufferSize.push(gcodeLen + 1); - gcodeLine += gcode + '\n'; - spaceLeft = GRBL_RX_BUFFER_SIZE - gcodeLine.length; - } else { - // Not enough space left in send buffer - status.comms.blocked = true; - } - } - if (gcodeLine.length > 0) { - // Send the buffer - status.comms.blocked = true; - machineSend(gcodeLine); - // console.log('Sent: ' + gcodeLine + ' Q: ' + (queueLen - queuePointer)); - } - } - } else { - while ((queueLen - queuePointer) > 0 && !status.comms.blocked && !status.comms.paused) { - spaceLeft = grblBufferSpace(); - gcodeLen = gcodeQueue[queuePointer].length; - if (gcodeLen < spaceLeft) { - gcode = gcodeQueue[queuePointer]; - queuePointer++; - grblBufferSize.push(gcodeLen + 1); - machineSend(gcode + '\n'); - // console.log('Sent: ' + gcode + ' Q: ' + (queueLen - queuePointer) + ' Bspace: ' + (spaceLeft - gcodeLen - 1)); - } else { - status.comms.blocked = true; - } + while ((queueLen - queuePointer) > 0 && !status.comms.blocked && !status.comms.paused) { + spaceLeft = grblBufferSpace(); + gcodeLen = gcodeQueue[queuePointer].length; + console.log(gcodeLen, spaceLeft) + if (gcodeLen < spaceLeft) { + gcode = gcodeQueue[queuePointer]; + queuePointer++; + grblBufferSize.push(gcodeLen + 1); + machineSend(gcode + '\n'); + // console.log('Sent: ' + gcode + ' Q: ' + (queueLen - queuePointer) + ' Bspace: ' + (spaceLeft - gcodeLen - 1)); + } else { + status.comms.blocked = true; } } break; @@ -1772,7 +1749,7 @@ function send1Q() { queuePointer++; status.comms.blocked = true; machineSend(gcode + '\n'); - // console.log('Sent: ' + gcode + ' Q: ' + (gcodeQueue.length - queuePointer)); + // console.log('Sent: ' + gcode + ' Q: ' + (gcodeQueue.length - queuePointer)); } break; }