diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/sample-macros.cfg | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/config/sample-macros.cfg b/config/sample-macros.cfg index 3590268c..7b68f5d0 100644 --- a/config/sample-macros.cfg +++ b/config/sample-macros.cfg @@ -261,3 +261,50 @@ gcode: {% if 'U' in params %} EXCLUDE_OBJECT RESET=1 NAME={params.U} {% endif %} + +###################################################################### +# G130: Set digital potentiometer value +###################################################################### + +# The macro below uses the MCP4018 SET_DIGIPOT command to implement +# a `G130` as used on classic Mightyboard-based printers such as +# The Makerbot Replicator 2/2X. +# +# The `G130` command can be used to lower the stepper current +# during preheating and raise the current again prior to starting +# the print. This is necessary for printers with smaller power +# supplies that needed all the power to heat the bed. +# +# This macro requires one or more [mcp4018] configuration sections: +# (x_axis_pot, y_axis_pot, z_axis_pot, a_axis_pot, b_axis_pot) +# +# Example: G130 X20 Y20 Z20 A20 B20 ; Lower stepper Vrefs while heating + +[gcode_macro G130] +gcode: + M400 + {% if ('X' in params) and ('mcp4018 x_axis_pot' in printer.configfile.config) %} + {% set x_value = params['X']|float %} + {% set x_axis_pot_scale = printer.configfile.config["mcp4018 x_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=x_axis_pot WIPER={ x_axis_pot_scale * (x_value / 127.0)} + {% endif %} + {% if ('Y' in params) and ('mcp4018 y_axis_pot' in printer.configfile.config) %} + {% set y_value = params['Y']|float %} + {% set y_axis_pot_scale = printer.configfile.config["mcp4018 y_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=y_axis_pot WIPER={ y_axis_pot_scale * (y_value / 127.0)} + {% endif %} + {% if ('Z' in params) and ('mcp4018 z_axis_pot' in printer.configfile.config) %} + {% set z_value = params['Z']|float %} + {% set z_axis_pot_scale = printer.configfile.config["mcp4018 z_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=z_axis_pot WIPER={ z_axis_pot_scale * (z_value / 127.0)} + {% endif %} + {% if ('A' in params) and ('mcp4018 a_axis_pot' in printer.configfile.config) %} + {% set a_value = params['A']|float %} + {% set a_axis_pot_scale = printer.configfile.config["mcp4018 a_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=a_axis_pot WIPER={ a_axis_pot_scale * (a_value / 127.0)} + {% endif %} + {% if ('B' in params) and ('mcp4018 b_axis_pot' in printer.configfile.config) %} + {% set b_value = params['B']|float %} + {% set b_axis_pot_scale = printer.configfile.config["mcp4018 b_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=b_axis_pot WIPER={ b_axis_pot_scale * (b_value / 127.0)} + {% endif %} |