M-codes for EEPROM config

From RepRap
Revision as of 13:00, 11 March 2011 by AlexRa (talk | contribs)
Jump to: navigation, search

(This is proposed by AlexRa on 11-March-2011. I have a TechZone's Huxley with a somewhat modified firmware and going to add these commands to it. Then it probably shouldn't be very difficult to port the changes over to RepRap's mainstream firmware (does such thing even exist?). The idea is very obvious and I'm sure other people thought about it before. If you know of a better / different way to do the configuration, please contribute).

Motivation: there is a number of physical parameters, such as steps-per-mm on the 3 axes and, especially, on the extruder, that normally require adjustment whenever a reprap is built, modified or the extruder hot-end replaced.

Currently, those parameters are constants hardcoded in the firmware. A user has to install a toolchain for the firmware modification and re-flashing (e.g. Arduino) and has to have at least some understanding of C programming to make the necessary adjustments.

However, every AVR MCU used in RepRap motherboards has persistent EEPROM memory where all such configurations can be conveniently saved. Below is a proposed set of M-codes for writing persistent settings into the motherboard:

M255 [Xnn] [Ynn] [Znn] [Ennn] [Tn] - Steps per mm for the axes and the extruder. The command writes only the specified axes, reports back all stored values in the "X: Y: Z: E:" format. If issued without any parameters, it just reports the current settings. The optional Tn parameter specifies the extruder to be set (on multiple-extruder repraps). If E is specified and T isn't, the extrusion rate is set for all available extruders (usually there is only one anyway). In the FiveD firmware, these settings should replace the X|Y|Z|E0|E1_STEPS_PER_MM constants in configuration.h.

M254 [Xnn] [Ynn] [Znn] - set safe axes boundaries (build volume) in mm. This is essential for printers with only one set of end-stops. Any movement beyond the defined boundaries should be blocked by the firmware. The command returns the current settings.

M253 [Xnn] [Ynn] [Znn] [Ennn] [Tn] - maximum speed (mm/sec) for any of the axes and the extruder. Especially the limiting value for the extruder is important, because it is often the extruder speed that limits the printer performance. The command returns the current settings.

M252 [Sn] [Tn] - set the max allowed temperature for the specified (or the default) extruder. That makes sure that any wild temperature setting sent in GCode will be detected by the firmware and won't cause uncontrolled overheating. Without the S parameter, reports the current setting.

M251 [Sn] - Same as above, but for the hot bed. This is particularly important, as some known hot bed designs (e.g. PCB-based) may be sensitive to overheating.