checkpoint gx util

This commit is contained in:
Stewart Allen 2017-10-12 13:43:24 -04:00
commit 073be5ae61
2 changed files with 29 additions and 32 deletions

View file

@ -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,6 +322,7 @@ const crc32 = require('buffer-crc32');
const net = require('net'); const net = require('net');
const fs = require('fs'); const fs = require('fs');
if (!module.parent) {
const arg = process.argv.slice(2); const arg = process.argv.slice(2);
const cmd = arg.shift(); const cmd = arg.shift();
@ -355,3 +351,4 @@ switch (cmd) {
].join("\n")); ].join("\n"));
break; break;
} }
}

View file

@ -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>