fix grbl protocol in gcode/serial sender

This commit is contained in:
Stewart Allen 2018-02-17 19:21:27 -05:00
commit 0f8b520b9e
2 changed files with 30 additions and 9 deletions

View file

@ -175,9 +175,9 @@ var gs_kiri_serial = exports;
if (dm.charAt(0) === '<') { if (dm.charAt(0) === '<') {
// grbl status update // grbl status update
dm = dm.substring(1,dm.length-2); dm = dm.substring(1,dm.length-2);
dm = dm.split(','); dm = dm.split('|');
// console.log(dm); // console.log(dm);
status = dm[0]; status = dm.shift();
senderStatus.value = status; senderStatus.value = status;
switch (status) { switch (status) {
case 'Idle': case 'Idle':
@ -194,12 +194,33 @@ var gs_kiri_serial = exports;
senderStatus.style.color = '#880'; senderStatus.style.color = '#880';
break; break;
} }
rpx.value = dm[1].split(':')[1]; var dmt, tt, tv;
rpy.value = dm[2]; while (dmt = dm.shift()) {
rpz.value = dm[3]; dmt = dmt.split(":");
wpx.value = dm[4].split(':')[1]; tt = dmt[0];
wpy.value = dm[5]; tv = dmt[1].split(",");
wpz.value = dm[6]; switch (tt) {
case 'MPos':
rpx.value = tv[0];
rpy.value = tv[1];
rpz.value = tv[2];
break;
case 'MPos':
wpx.value = tv[0];
wpy.value = tv[1];
wpz.value = tv[2];
break;
case 'WCO':
wpx.value = tv[0];
wpy.value = tv[1];
wpz.value = tv[2];
break;
case 'FS':
break;
case 'Ov':
break;
}
}
} else } else
if (dm.charAt(0) === '{') { if (dm.charAt(0) === '{') {
// tinyg status update // tinyg status update

View file

@ -1,7 +1,7 @@
var exports = { var exports = {
COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - All Rights Reserved", COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - All Rights Reserved",
LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.", LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.",
VERSION:"1.0.99" VERSION:"1.1.00"
}; };
if (!module) var module = {}; if (!module) var module = {};
module.exports = exports; module.exports = exports;