fix tool change bug in serial sender

This commit is contained in:
Stewart Allen 2018-03-24 14:04:32 -04:00
commit ced2f6426a
3 changed files with 10 additions and 5 deletions

View file

@ -410,8 +410,9 @@ var gs_kiri_fdm = exports;
left: offset ? 0 : -device.bedWidth/2, left: offset ? 0 : -device.bedWidth/2,
right: offset ? device.bedWidth : device.bedWidth/2, right: offset ? device.bedWidth : device.bedWidth/2,
bottom: offset ? 0 : -device.bedDepth/2, bottom: offset ? 0 : -device.bedDepth/2,
kfactor: process.gcodeKFactor || 0,
z_max: device.maxHeight, z_max: device.maxHeight,
kfactor: process.gcodeKFactor || 0 layers: layers.length
}, },
seekMMM = process.outputSeekrate * 60, seekMMM = process.outputSeekrate * 60,
retDist = process.outputRetractDist, retDist = process.outputRetractDist,

View file

@ -259,8 +259,10 @@ var gs_kiri_serial = exports;
var data = msg.data.trim(); var data = msg.data.trim();
if (data.charAt(0) === '{') { if (data.charAt(0) === '{') {
data = js2o(data); data = js2o(data);
// if (data.Cmd) console.log(data); if (data.Cmd) console.log(data);
if (data.Cmd && data.Cmd === 'Queued' && data.Data) queueAck(data.Data); if (data.Cmd && data.Cmd === 'Queued' && data.Data) {
queueAck(data.Data);
}
if (data.QCnt >= 0) { if (data.QCnt >= 0) {
spjsQueueCount = data.QCnt; spjsQueueCount = data.QCnt;
gcRemoteQueue.value = spjsQueueCount; gcRemoteQueue.value = spjsQueueCount;
@ -390,6 +392,8 @@ var gs_kiri_serial = exports;
} }
} }
drainQueue(); drainQueue();
} else {
console.log("no gcode to send");
} }
} }
@ -529,7 +533,6 @@ var gs_kiri_serial = exports;
while (count++ < sendBatchMax && localQueue.length > 0) { while (count++ < sendBatchMax && localQueue.length > 0) {
next = (nextID++).toString(); next = (nextID++).toString();
waitingForAck.push(next);
line = localQueue.shift(); line = localQueue.shift();
if (line.indexOf("M6") === 0) { if (line.indexOf("M6") === 0) {
toolChange = true; toolChange = true;
@ -537,6 +540,7 @@ var gs_kiri_serial = exports;
// just stop sending until unpaused // just stop sending until unpaused
if (selectedMode === 'grbl') break; if (selectedMode === 'grbl') break;
} }
waitingForAck.push(next);
data.push({D:line, Id:next}); data.push({D:line, Id:next});
// for tinyg pause after M6 sent // for tinyg pause after M6 sent
if (toolChange) break; if (toolChange) break;

View file

@ -33,7 +33,7 @@
], ],
"cmd":{ "cmd":{
"fan_power": "M106 S{fan_speed}", "fan_power": "M106 S{fan_speed}",
"progress": "M117 {progress}% layer {layer}" "progress": "M117 {progress}% layer {layer} / {layers}"
}, },
"settings":{ "settings":{
"origin_center": false, "origin_center": false,