kopia lustrzana https://github.com/OpenBuilds/OpenBuilds-CONTROL
Smaller buffer header to prevent overflow
rodzic
1367310951
commit
beaf33d925
|
@ -15,8 +15,8 @@ body {
|
||||||
height: calc(100% - 1px);
|
height: calc(100% - 1px);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-top: 1px solid #ccc;
|
border-top: 1px solid #ccc;
|
||||||
margin-top: 5px;
|
/* margin-top: 5px; */
|
||||||
box-shadow: 0 0 5px 10px #fff;
|
box-shadow: 0 0 2px 2px #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#console {
|
#console {
|
||||||
|
@ -28,7 +28,7 @@ body {
|
||||||
overflow-x: none;
|
overflow-x: none;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
box-shadow: 0 0 5px 10px #fff;
|
box-shadow: 0 0 2px 2px #ddd;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
|
|
|
@ -520,7 +520,7 @@
|
||||||
<div id="console"></div>
|
<div id="console"></div>
|
||||||
<div class="fixed-bottom m-3 mb-9">
|
<div class="fixed-bottom m-3 mb-9">
|
||||||
<form class="inline-form" id="commandform">
|
<form class="inline-form" id="commandform">
|
||||||
<input data-prepend=" <i class='fas fa-terminal'></i>" data-role="input" data-clear-button="false" data-role="input" id="command" type="text" autocomplete="on" class="needs-connection" style="width: calc(100vw - 170px);" />
|
<input data-prepend=" <i class='fas fa-terminal'></i>" data-role="input" data-clear-button="false" data-role="input" id="command" type="text" autocomplete="on" class=" dark needs-connection" style="width: calc(100vw - 170px);" />
|
||||||
<button id="sendCommand" class="button dark needs-connection" type="button" data-role="hint" data-hint-position="top" data-hint-text="Execute Command" data-cls-hint="bg-light fg-dark drop-shadow">
|
<button id="sendCommand" class="button dark needs-connection" type="button" data-role="hint" data-hint-position="top" data-hint-text="Execute Command" data-cls-hint="bg-light fg-dark drop-shadow">
|
||||||
<i class="fa fa-play" style="margin-right: 10px;"></i> Send
|
<i class="fa fa-play" style="margin-right: 10px;"></i> Send
|
||||||
</button>
|
</button>
|
||||||
|
@ -533,13 +533,15 @@
|
||||||
<div class="section" id="tab-two">
|
<div class="section" id="tab-two">
|
||||||
<div id="editor"></div>
|
<div id="editor"></div>
|
||||||
<div class="fixed-bottom m-3 mb-9">
|
<div class="fixed-bottom m-3 mb-9">
|
||||||
<button data-toggle="tooltip" data-placement="bottom" title="Find and Replace" class="button dark" onclick="editor.execCommand('replace')"><i class="fas fa-search"></i></button>
|
<!-- <form class="inline-form"> -->
|
||||||
<button data-toggle="tooltip" data-placement="bottom" title="Select All" class="button dark" onclick="editor.execCommand('selectall')"><i class="far fa-check-square"></i></button>
|
<button title="Find and Replace" class="button dark" onclick="editor.execCommand('replace')"><i class="fas fa-search"></i> Find/Replace</button>
|
||||||
<button data-toggle="tooltip" data-placement="bottom" title="Undo" class="button dark" onclick="editor.execCommand('undo')"><i class="fas fa-undo"></i></button>
|
<button title="Select All" class="button dark" onclick="editor.execCommand('selectall')"><i class="far fa-check-square"></i> Select All</button>
|
||||||
<button data-toggle="tooltip" data-placement="bottom" title="Redo" class="button dark" onclick="editor.execCommand('redo')"><i class="fas fa-redo"></i></button>
|
<button title="Undo" class="button dark" onclick="editor.execCommand('undo')"><i class="fas fa-undo"></i> Undo</button>
|
||||||
<button data-toggle="tooltip" data-placement="bottom" title="Go to End" class="button dark" onclick="editor.execCommand('gotoend')"><i class="fas fa-chevron-down"></i></button>
|
<button title="Redo" class="button dark" onclick="editor.execCommand('redo')"><i class="fas fa-redo"></i> Redo</button>
|
||||||
<button data-toggle="tooltip" data-placement="bottom" title="Go to Start" class="button dark" onclick="editor.execCommand('gotostart')"><i class="fas fa-chevron-up"></i></button>
|
<button title="Go to End" class="button dark" onclick="editor.execCommand('gotoend')"><i class="fas fa-chevron-down"></i></button>
|
||||||
<button data-toggle="tooltip" data-placement="bottom" title="Clear Editor" class="button dark" onclick="editor.execCommand('selectall'); editor.execCommand('del');"><i class="fas fa-eraser"></i></button>
|
<button title="Go to Start" class="button dark" onclick="editor.execCommand('gotostart')"><i class="fas fa-chevron-up"></i></button>
|
||||||
|
<button title="Clear Editor" class="button dark" onclick="editor.execCommand('selectall'); editor.execCommand('del');"><i class="fas fa-eraser"></i> Clear</button>
|
||||||
|
<!-- </form> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -198,17 +198,21 @@ function checkifchanged() {
|
||||||
|
|
||||||
|
|
||||||
function grblSaveSettings() {
|
function grblSaveSettings() {
|
||||||
|
var commands = ""
|
||||||
for (var key in grblParams) {
|
for (var key in grblParams) {
|
||||||
if (grblParams.hasOwnProperty(key)) {
|
if (grblParams.hasOwnProperty(key)) {
|
||||||
var j = key.substring(1)
|
var j = key.substring(1)
|
||||||
var newVal = $("#val-" + j + "-input").val();
|
var newVal = $("#val-" + j + "-input").val();
|
||||||
// Only send values that changed
|
// Only send values that changed
|
||||||
if (parseFloat(newVal) != parseFloat(grblParams[key])) {
|
if (parseFloat(newVal) != parseFloat(grblParams[key])) {
|
||||||
console.log(key + ' was ' + grblParams[key] + ' but now, its ' + newVal);
|
// console.log(key + ' was ' + grblParams[key] + ' but now, its ' + newVal);
|
||||||
sendGcode(key + '=' + newVal);
|
commands += key + '=' + newVal + "\n"
|
||||||
|
// sendGcode(key + '=' + newVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log("commands", commands)
|
||||||
|
socket.emit('runJob', commands);
|
||||||
grblParams = {};
|
grblParams = {};
|
||||||
|
|
||||||
Metro.dialog.create({
|
Metro.dialog.create({
|
||||||
|
|
10
app/js/ui.js
10
app/js/ui.js
|
@ -130,7 +130,7 @@ function setJogPanel(val, status) {
|
||||||
if (val == 0) { // Not Connected Yet
|
if (val == 0) { // Not Connected Yet
|
||||||
// Show panel and resize editor
|
// Show panel and resize editor
|
||||||
$("#jogcontrols").slideUp(20);
|
$("#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").css('height', 'calc(' + 100 + 'vh - ' + 290 + 'px)');
|
||||||
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
||||||
editor.resize()
|
editor.resize()
|
||||||
|
@ -141,7 +141,7 @@ function setJogPanel(val, status) {
|
||||||
} else if (val == 0 || val == 2) { // Connected, but not Playing yet
|
} else if (val == 0 || val == 2) { // Connected, but not Playing yet
|
||||||
// Show panel and resize editor
|
// Show panel and resize editor
|
||||||
$("#jogcontrols").slideDown(20);
|
$("#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").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||||
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
||||||
editor.resize()
|
editor.resize()
|
||||||
|
@ -151,7 +151,7 @@ function setJogPanel(val, status) {
|
||||||
}
|
}
|
||||||
} else if (val == 3) { // Busy Streaming GCODE
|
} else if (val == 3) { // Busy Streaming GCODE
|
||||||
// Show panel and resize editor
|
// 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").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||||
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
||||||
editor.resize()
|
editor.resize()
|
||||||
|
@ -163,7 +163,7 @@ function setJogPanel(val, status) {
|
||||||
} else if (val == 4) { // Paused
|
} else if (val == 4) { // Paused
|
||||||
// Show panel and resize editor
|
// Show panel and resize editor
|
||||||
$("#jogcontrols").slideDown(20);
|
$("#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").css('height', 'calc(' + 100 + 'vh - ' + 480 + 'px)');
|
||||||
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
||||||
editor.resize()
|
editor.resize()
|
||||||
|
@ -174,7 +174,7 @@ function setJogPanel(val, status) {
|
||||||
} else if (val == 5) { // Alarm State
|
} else if (val == 5) { // Alarm State
|
||||||
// Show panel and resize editor
|
// Show panel and resize editor
|
||||||
$("#jogcontrols").slideUp(20);
|
$("#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").css('height', 'calc(' + 100 + 'vh - ' + 290 + 'px)');
|
||||||
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
// $('#console').scrollTop($("#console")[0].scrollHeight - $("#console").height());
|
||||||
editor.resize()
|
editor.resize()
|
||||||
|
|
59
index.js
59
index.js
|
@ -199,9 +199,8 @@ var statusLoop;
|
||||||
var queueCounter;
|
var queueCounter;
|
||||||
var listPortsLoop;
|
var listPortsLoop;
|
||||||
|
|
||||||
var GRBL_RX_BUFFER_SIZE = 128; // 128 characters
|
var GRBL_RX_BUFFER_SIZE = 32; // 128 characters
|
||||||
var grblBufferSize = [];
|
var grblBufferSize = [];
|
||||||
var new_grbl_buffer = false;
|
|
||||||
|
|
||||||
var SMOOTHIE_RX_BUFFER_SIZE = 64; // max. length of one command line
|
var SMOOTHIE_RX_BUFFER_SIZE = 64; // max. length of one command line
|
||||||
var smoothie_buffer = false;
|
var smoothie_buffer = false;
|
||||||
|
@ -804,7 +803,7 @@ io.on("connection", function(socket) {
|
||||||
statusLoop = setInterval(function() {
|
statusLoop = setInterval(function() {
|
||||||
if (status.comms.connectionStatus > 0) {
|
if (status.comms.connectionStatus > 0) {
|
||||||
if (!status.comms.sduploading) {
|
if (!status.comms.sduploading) {
|
||||||
machineSend("?");
|
// machineSend("?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 250);
|
}, 250);
|
||||||
|
@ -1084,6 +1083,7 @@ io.on("connection", function(socket) {
|
||||||
|
|
||||||
|
|
||||||
socket.on('runJob', function(data) {
|
socket.on('runJob', function(data) {
|
||||||
|
// console.log(data)
|
||||||
console.log('Run Job (' + data.length + ')');
|
console.log('Run Job (' + data.length + ')');
|
||||||
if (status.comms.connectionStatus > 0) {
|
if (status.comms.connectionStatus > 0) {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -1678,6 +1678,7 @@ function machineSend(gcode) {
|
||||||
data.push(queueTotal);
|
data.push(queueTotal);
|
||||||
data.push(status.comms.sduploading)
|
data.push(status.comms.sduploading)
|
||||||
io.sockets.emit("queueCount", data);
|
io.sockets.emit("queueCount", data);
|
||||||
|
// console.log(gcode)
|
||||||
port.write(gcode);
|
port.write(gcode);
|
||||||
if (gcode != "?") {
|
if (gcode != "?") {
|
||||||
lastGcode.push(gcode);
|
lastGcode.push(gcode);
|
||||||
|
@ -1719,6 +1720,7 @@ function grblBufferSpace() {
|
||||||
return GRBL_RX_BUFFER_SIZE - total;
|
return GRBL_RX_BUFFER_SIZE - total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function send1Q() {
|
function send1Q() {
|
||||||
var gcode;
|
var gcode;
|
||||||
var gcodeLen = 0;
|
var gcodeLen = 0;
|
||||||
|
@ -1726,43 +1728,18 @@ function send1Q() {
|
||||||
if (status.comms.connectionStatus > 0) {
|
if (status.comms.connectionStatus > 0) {
|
||||||
switch (status.machine.firmware.type) {
|
switch (status.machine.firmware.type) {
|
||||||
case 'grbl':
|
case 'grbl':
|
||||||
if (new_grbl_buffer) {
|
while ((queueLen - queuePointer) > 0 && !status.comms.blocked && !status.comms.paused) {
|
||||||
if (grblBufferSize.length === 0) {
|
spaceLeft = grblBufferSpace();
|
||||||
spaceLeft = GRBL_RX_BUFFER_SIZE;
|
gcodeLen = gcodeQueue[queuePointer].length;
|
||||||
while ((queueLen - queuePointer) > 0 && spaceLeft > 0 && !status.comms.blocked && !status.comms.paused) {
|
console.log(gcodeLen, spaceLeft)
|
||||||
gcodeLen = gcodeQueue[queuePointer].length;
|
if (gcodeLen < spaceLeft) {
|
||||||
if (gcodeLen < spaceLeft) {
|
gcode = gcodeQueue[queuePointer];
|
||||||
// Add gcode to send buffer
|
queuePointer++;
|
||||||
gcode = gcodeQueue[queuePointer];
|
grblBufferSize.push(gcodeLen + 1);
|
||||||
queuePointer++;
|
machineSend(gcode + '\n');
|
||||||
grblBufferSize.push(gcodeLen + 1);
|
// console.log('Sent: ' + gcode + ' Q: ' + (queueLen - queuePointer) + ' Bspace: ' + (spaceLeft - gcodeLen - 1));
|
||||||
gcodeLine += gcode + '\n';
|
} else {
|
||||||
spaceLeft = GRBL_RX_BUFFER_SIZE - gcodeLine.length;
|
status.comms.blocked = true;
|
||||||
} 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1772,7 +1749,7 @@ function send1Q() {
|
||||||
queuePointer++;
|
queuePointer++;
|
||||||
status.comms.blocked = true;
|
status.comms.blocked = true;
|
||||||
machineSend(gcode + '\n');
|
machineSend(gcode + '\n');
|
||||||
// console.log('Sent: ' + gcode + ' Q: ' + (gcodeQueue.length - queuePointer));
|
// console.log('Sent: ' + gcode + ' Q: ' + (gcodeQueue.length - queuePointer));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue