@chamnit
Right, if I need to write a whole new buffer for SPJS (refer the fight in issue 52 on openhardwarecoza/LaserWeb2), i'd rather start over fresh (In nodejs, where i am comfortable, and without the few hundred thousand lines of SPJS code to confuse me)
So, what I built here: https://github.com/openhardwarecoza/LaserWeb3/blob/master/server.js
node-serialport: Connect to a serial endpoint. Keeping it VERY simple to start off...
I have an array called gcodeQueue
To this queue I can prepend data (to push a request for position feedback into the queue in front) or append to the back - with respectively
https://github.com/openhardwarecoza/LaserWeb3/blob/master/server.js#L162- jumpQ (puts it in front)
https://github.com/openhardwarecoza/LaserWeb3/blob/master/server.js#L158 - addQ (adds it last)
Next I can take entries from this array, by shifting them out into a var https://github.com/openhardwarecoza/LaserWeb3/blob/master/server.js#L170-L177 and writing it to the serial port.
the send1Q function only sends one LINE of gcode.
It gets called after a 50ms delay after an OK (so simple ping pong buffer) - I also manually call it after adding a M114 to the queue: https://github.com/openhardwarecoza/LaserWeb3/blob/master/server.js#L114-L115
Now, theoretically, for marlin, that should result in a send, ok, send, ok.
Can you advise me, what is the best way to get this done to Grbl?
We never could get it working nicely in Laserweb v 1 - LaserWeb/deprecated-LaserWeb1#94
In LaserWeb v2 it works, but depends on Serial Port JSON server (and I'm tired of being told of TinyG's superiority - so i'm moving on)
Appreciate any help, lets hope 3rd times the charm and we get Grbl + laserWeb playing really nicely under node-serialport!