Skip to content

Instantly share code, notes, and snippets.

@btastic
Created September 30, 2022 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btastic/4bd8e78a107d8733f802168398a506a3 to your computer and use it in GitHub Desktop.
Save btastic/4bd8e78a107d8733f802168398a506a3 to your computer and use it in GitHub Desktop.
DutchDudes Automatic Bed Selection (fixed)
[gcode_macro _LOAD_MESH_TEMP]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(0)|int %}
{% set FORCE = params.FORCE|default(0)|int %}
{% set SAVE = params.SAVE|default(0)|int %}
{action_respond_info("- AUTOMATED BED MESH GENERATOR -")}
{% if BED_TEMP|int < 30 %}
{action_respond_info("Your bed temp is to low, make sure it is at least 30 or higher")}
{% else %}
{% if printer.configfile.config["bed_mesh " + BED_TEMP|string] is defined and FORCE|int == 0 %}
BED_MESH_PROFILE LOAD={BED_TEMP|string}
{action_respond_info("Succesfully loaded bed_mesh "+ BED_TEMP|string)}
{% else %}
{% if printer.configfile.config["bed_mesh " + BED_TEMP|string] is defined and FORCE|int == 1 %}
BED_MESH_PROFILE REMOVE={BED_TEMP|string}
{% endif %}
{action_respond_info("bed_mesh not defined, your bed temperature will go up!")}
{action_respond_info("We will probe the bed and save the mesh as bed_mesh " + BED_TEMP|string)}
_ADD_BED_MESH TARGET_TEMP={BED_TEMP|string}
{% if SAVE|int == 1 %}
SAVE_CONFIG
{% endif %}
{% endif %}
{% endif %}
[gcode_macro _ADD_BED_MESH]
gcode:
{% set TARGET_TEMP = params.TARGET_TEMP|default(0)|int %}
{% if TARGET_TEMP|int < 30 %}
{action_respond_info("Your bed temp is to low, make sure it is at least 30 or higher")}
{% else %}
M190 S{TARGET_TEMP} # Wait for the bed to hit TARGET_TEMP
CG28
BED_MESH_CALIBRATE
BED_MESH_PROFILE SAVE={TARGET_TEMP}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment