Rather than Arduino and ESP8266, I wonder if ESP14 might work as a GCODE interpreter. Mmm...looks like a job for Forth, so I got hold of eForth (for the STM8) from another hackaday.io project (thanks to Thomas @TG9541 - see https://hackaday.io/project/16097-eforth-for-cheap-stm8s-value-line-gadgets). It looks like the GCODE interpreter is going to be about 3K of code on top of about 4.5K of eForth. Not a fancy interpreter by any means but it'll work (I believe).

I decided to implement each GCODE command as a Forth word. For example, the GCODE M17 command is to enable the motors, and has no parameters. Its implementation is trivial, as follows:

: M17; \ enable motors motorsOn ;

GCODE interpretation rules generally say to quietly ignore any GCODE command that does not apply to the particular machine, but Forth typically aborts operation if an unknown command is received. So, we want to change the outer interpreter. This is easy in eForth, thus:

\ GCODE interpreter \ no prompt; ignore undefined words : GEV ( NAME? IF EXECUTE ELSE DROP THEN ;

\ change interpreter over for GCODE ' GEV ' EVAL !

and include the following in the initialisation routineThe forward kinematics and reverse kinematics routines are coded but untested. I've had a lot of fun with VARIABLEs and have finally reached a good way forward for this project. Just a little more coding and then some serious testing on ESP14, with both CPUs running Forth. Now that will be fun!