Hi
I'm having no luck finding an existing application that just works for me for sending G-Code to an Arduino Due running g2core hocked up to a 3040 CNC.
(I'm running an "edge" based firmware on the Due)
I have tried
https://goko.fr/
https://winder.github.io/ugs_website/
https://github.com/synthetos/node-g2core-api
At least on my laptop running Debian unstable the programs goko and ugs have a hard time simply connecting to g2core, I have been unable to run node-g2core-api due to what seems to be a sort of version issue with nodejs.
Also I need the CNC to be running offline so ChiliPeppr is more or less out of the question.
Anyway when connecting to the g2core using minicom (a serial terminal) I can move the CNC around without problems.
I therefor thought that I could simply write a small python script to send g-code to to the g2core. I could then later on perhaps expand it into a small GUI using wxpython.
I have written a script and it sort of works.
The way I understand:
https://github.com/synthetos/g2/wiki/g2core-Communications#linemode-protocol
is that I need to keep track of the acknowledge {'r' responds that should match the number of lines/requests the script sends
(that should generate such responds.)
Additionally I'm apparently allowed to have up to 4 outstanding requests that have yet to be acknowledged before I should sending more lines.
However when I send a "large" g-code file the g2core keeps quickly sending me {'r' responds for each line the script sends.
The script there for keeps sending lines to the g2core... and everyone is happy until the communication fails due to:
{"er":{"fb":100.26,"st":28,"msg":"Failed to get planner buffer - mp_get_write_buffer()"}}
{"er":{"fb":100.26,"st":36,"msg":"Failed to get planner buffer - aline()"}}
Even when I reduce the "sliding window size" to 1 reducing the protocol to:
Send a line, wait for a {'r' before sending another
The g2core still keeps on requesting data until it fails.
The following is some output from the script leading up to the error while sending a dummy file:
<- {"r":{},"f":[1,0,17]}
-> {"gc":"G1 X0"}
<- {"r":{},"f":[1,0,16]}
<- {"sr":{"posx":9.898,"vel":198.33}}
-> {"gc":"G1 X10"}
<- {"r":{},"f":[1,0,17]}
-> {"gc":"G1 X0"}
<- {"r":{},"f":[1,0,16]}
-> {"gc":"G1 X10"}
<- {"r":{},"f":[1,0,17]}
<- {"sr":{"posx":8.129,"vel":1000}}
-> {"gc":"G1 X0"}
<- {"r":{},"f":[1,0,16]}
-> {"gc":"G1 X10"}
<- {"r":{},"f":[1,0,17]}
<- {"sr":{"posx":3.99}}
-> {"gc":"G1 X0"}
<- {"er":{"fb":100.26,"st":28,"msg":"Failed to get planner buffer - mp_get_write_buffer()"}}
<- {"er":{"fb":100.26,"st":36,"msg":"Failed to get planner buffer - aline()"}}
<- {"r":{},"f":[1,36,16]}
-> {"gc":"G1 X10"}
<- {"r":{},"f":[1,206,17]}
I must be overlooking something, but what?
Does the line mode described in the wiki not work with the g2core code in brand "edge"?
Have I misunderstood the protocol in regard to how the g2core is suppoed to halt the transmission of more data?
Any help would be appreciated.
Kind regards Visti Andresen