aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorjake-b <1012393+jake-b@users.noreply.github.com>2022-09-02 11:30:06 -0300
committerGitHub <noreply@github.com>2022-09-02 10:30:06 -0400
commitae6c16422f1107139fa2f36cbd31360b37312ff7 (patch)
treee739bbce8c7a129b7e0314fdc17ce2c98523e454 /config
parent354915d2ad0e17f5b7df98c1e78da1585c52f441 (diff)
downloadkutter-ae6c16422f1107139fa2f36cbd31360b37312ff7.tar.gz
kutter-ae6c16422f1107139fa2f36cbd31360b37312ff7.tar.xz
kutter-ae6c16422f1107139fa2f36cbd31360b37312ff7.zip
mcp4018: Add SET_DIGIPOT command to mcp4018 implementation (#5737)
Added a SET_DIGIPOT command to the mcp4018 implementation. Previously the mcp4018 was read only, and set at the time of configuration. This allows you to change the value during a print, which is needed for some older printers that need to lower the stepper current during preheating. Signed-off-by: Jake Bordens <jake@allaboutjake.com>
Diffstat (limited to 'config')
-rw-r--r--config/sample-macros.cfg47
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 %}