It is probably documented somewhere, but I went the hard way, and checked the
configuration.h file to find the place where the number of steps per mm is defined for each axis.
Then I almost went and changed it, but read about the G-code command M92 just in time.
Turns out that we can override the standard settings by issuing a M92 command before running any other G-code.
The syntax is:
M92 Xnum Ynum Znum Enum
num is the number of steps per mm for the corresponding axis. Because Marlin is written for 3D printing, there is also an
E setting for the extruder. For CNC we can ignore
E, but since it must be specified, any number will do.
I am using a lead-screw with 8mm of travel per revolution. Steppers with 200 steps per revolution and a driver with 32 microsteps per step. Hence the number of steps per mm is: 200 * 32 / 8 = 800. And since all axis are the same, my M92 command is:
M92 X800 Y800 Z800 E800
Note that it is possible to use fractional numbers if that were necessary.
In a first test I took the test shape G-code and put the M92 command in front of the entire sequence. That worked!
Of course it is not practical to manually edit all G-code files, and there is no need for it. Because there is an EEPROM that the settings can be written to. And on each reset (power-up) these settings override the default settings in the Marlin code. This is done with the M500 G-code command.
So I made an extra file, called set-movement.gcode with the content:
M92 X800 Y800 Z800 E800 M500
Then wrote that to the micro-SD and executed it on the Arduino. It did work, but when I restarted the Arduino I discovered that it was not written to EEPROM. After some digging I found that Marlin has the option to disable the EEPROM, which is what V1Engineering has done. This option can also be found in the
configuration.h file. Hence it is still necessary to update the configuration file and re-compile and re-burn the Marlin driver to the Arduino.
With this done, the proof of concept has been completed. Everything is now ready for the next step(s): design, buy and build the hardware that will do the cutting!