diff --git a/src/index.js b/src/index.js index 995f9b8..5e7cb46 100644 --- a/src/index.js +++ b/src/index.js @@ -101,7 +101,7 @@ const parseLine = (() => { // Parse % commands for bCNC and CNCjs // - %wait Wait until the planner queue is empty if (letter === '%') { - result.cmds = (result.cmds || []).concat(`${letter}${argument}`); + result.cmds = (result.cmds || []).concat(line.trim()); continue; } diff --git a/test/index.js b/test/index.js index 326020e..d904343 100644 --- a/test/index.js +++ b/test/index.js @@ -81,6 +81,14 @@ describe('gcode-parser', () => { expect(data.cmds).to.deep.equal(['%wait']); } + { // %msg Restart spindle + const data = parseLine('%msg Restart spindle'); + expect(data).to.be.an('object'); + expect(data.line).to.be.an('string'); + expect(data.words).to.be.empty; + expect(data.cmds).to.deep.equal(['%msg Restart spindle']); + } + { // %zsafe=10 const data = parseLine('%zsafe=10'); expect(data).to.be.an('object');