checkpoint gx util
This commit is contained in:
parent
da0af16894
commit
073be5ae61
2 changed files with 29 additions and 32 deletions
|
|
@ -224,18 +224,13 @@ class GXSender {
|
||||||
if (len < 4096) {
|
if (len < 4096) {
|
||||||
chunk = Buffer.concat([chunk, new Buffer(4096-len).fill(0)]);
|
chunk = Buffer.concat([chunk, new Buffer(4096-len).fill(0)]);
|
||||||
}
|
}
|
||||||
// let crc = crc32.unsigned(chunk);
|
|
||||||
let block = Buffer.concat([
|
let block = Buffer.concat([
|
||||||
preamble,
|
preamble,
|
||||||
uint32b(slice),
|
uint32b(slice),
|
||||||
uint32b(len),
|
uint32b(len),
|
||||||
// length,
|
|
||||||
uint32b(crc),
|
uint32b(crc),
|
||||||
chunk
|
chunk
|
||||||
]);
|
]);
|
||||||
// console.log(block);
|
|
||||||
// console.log(block.slice(4080));
|
|
||||||
// console.log(block.length);
|
|
||||||
ctrl.sendBuffer(block, lines => { console.log(lines) });
|
ctrl.sendBuffer(block, lines => { console.log(lines) });
|
||||||
}
|
}
|
||||||
ctrl.sendCommand("M29", lines => { console.log(lines) }); // end of send
|
ctrl.sendCommand("M29", lines => { console.log(lines) }); // end of send
|
||||||
|
|
@ -327,31 +322,33 @@ const crc32 = require('buffer-crc32');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
const arg = process.argv.slice(2);
|
if (!module.parent) {
|
||||||
const cmd = arg.shift();
|
const arg = process.argv.slice(2);
|
||||||
|
const cmd = arg.shift();
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 'pipe':
|
case 'pipe':
|
||||||
new TCPipe(parseInt(arg.shift()), arg.shift(), parseInt(arg.shift()));
|
new TCPipe(parseInt(arg.shift()), arg.shift(), parseInt(arg.shift()));
|
||||||
break;
|
break;
|
||||||
case 'read':
|
case 'read':
|
||||||
new GXReader(arg.shift());
|
new GXReader(arg.shift());
|
||||||
break;
|
break;
|
||||||
case 'make':
|
case 'make':
|
||||||
let output = arg.shift();
|
let output = arg.shift();
|
||||||
new GXWriter(arg.shift(), arg.shift(), parseInt(arg.shift() || 100), parseInt(arg.shift() || 100)).write(output);
|
new GXWriter(arg.shift(), arg.shift(), parseInt(arg.shift() || 100), parseInt(arg.shift() || 100)).write(output);
|
||||||
break;
|
break;
|
||||||
case 'send':
|
case 'send':
|
||||||
new GXSender(arg.shift(), arg.shift(), parseInt(arg.shift()), arg.shift());
|
new GXSender(arg.shift(), arg.shift(), parseInt(arg.shift()), arg.shift());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log([
|
console.log([
|
||||||
"invalid command: " + cmd,
|
"invalid command: " + cmd,
|
||||||
"usage:",
|
"usage:",
|
||||||
" read [file]",
|
" read [file]",
|
||||||
" make [outfile] [gcode] [bmp] <time> <length>",
|
" make [outfile] [gcode] [bmp] <time> <length>",
|
||||||
" send [file] [host] [port] <filename>",
|
" send [file] [host] [port] <filename>",
|
||||||
" print [file]"
|
" print [file]"
|
||||||
].join("\n"));
|
].join("\n"));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
<div class="print-sel">
|
<div class="print-sel">
|
||||||
<table><tr><th>
|
<table><tr><th>
|
||||||
<button id="print-download">download gcode file</button>
|
<button id="print-download">download .gcode</button>
|
||||||
<button id="print-serial">use gcode sender</button>
|
<button id="print-serial">use gcode sender</button>
|
||||||
</th></tr></table>
|
</th></tr></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue