From d0e7d8800da263ba25bda5859dc3ec96cb2c55c9 Mon Sep 17 00:00:00 2001 From: h3n3 Date: Sat, 18 May 2024 20:09:57 +0200 Subject: [PATCH] jschuh klipper macros geupdated van zijn github --- .../klipper_config/bed_mesh_org.cfg | 69 - .../LICENSE | 0 .../klipper-macros-main/README.md | 1170 +++++++++++++++++ .../klipper-macros-main/bed_mesh_fast.cfg | 226 ++++ .../klipper-macros-main/bed_surface.cfg | 287 ++++ .../klipper-macros-main/beep.cfg | 30 + .../klipper-macros-main/draw.cfg | 130 ++ .../klipper-macros-main/fans.cfg | 86 ++ .../klipper-macros-main/filament.cfg | 167 +++ .../klipper-macros-main/globals.cfg | 466 +++++++ .../klipper-macros-main/heaters.cfg | 245 ++++ .../klipper-macros-main/idle.cfg | 17 + .../klipper-macros-main/kinematics.cfg | 67 + .../klipper-macros-main/layers.cfg | 411 ++++++ .../klipper-macros-main/optional/bed_mesh.cfg | 14 + .../optional/lcd_menus.cfg | 976 ++++++++++++++ .../klipper-macros-main/park.cfg | 91 ++ .../pause_resume_cancel.cfg | 144 ++ .../klipper-macros-main/start_end.cfg | 484 +++++++ .../klipper-macros-main/state.cfg | 42 + .../klipper-macros-main/status_events.cfg | 152 +++ .../klipper-macros-main/velocity.cfg | 61 + .../klipper_config/klipper-macros-oud/LICENSE | 674 ++++++++++ .../README.md | 0 .../bed_mesh_fast.cfg | 0 .../bed_surface.cfg | 0 .../beep.cfg | 0 .../draw.cfg | 0 .../fans.cfg | 0 .../filament.cfg | 0 .../globals.cfg | 0 .../heaters.cfg | 0 .../idle.cfg | 0 .../kinematics.cfg | 0 .../layers.cfg | 0 .../optional/bed_mesh.cfg | 0 .../optional/lcd_menus.cfg | 0 .../park.cfg | 0 .../pause_resume_cancel.cfg | 0 .../start_end.cfg | 0 .../state.cfg | 0 .../velocity.cfg | 0 .../klipper-macros/.kinematics.cfg.swp | Bin 12288 -> 0 bytes .../klipper_config/macros/jschuh_macros.cfg | 16 +- .../printer-20220104_172505.cfg | 907 ------------- .../printer-20230405_194210.cfg | 1009 -------------- .../printer-20230412_175951.cfg | 1010 -------------- .../DNV-TPU-Ender3/klipper_config/printer.cfg | 1 + 48 files changed, 5949 insertions(+), 3003 deletions(-) delete mode 100644 klipper/DNV-TPU-Ender3/klipper_config/bed_mesh_org.cfg rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-main}/LICENSE (100%) create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/README.md create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/bed_mesh_fast.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/bed_surface.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/beep.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/draw.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/fans.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/filament.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/globals.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/heaters.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/idle.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/kinematics.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/layers.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/optional/bed_mesh.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/optional/lcd_menus.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/park.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/pause_resume_cancel.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/start_end.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/state.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/status_events.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/velocity.cfg create mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/LICENSE rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/README.md (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/bed_mesh_fast.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/bed_surface.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/beep.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/draw.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/fans.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/filament.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/globals.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/heaters.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/idle.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/kinematics.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/layers.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/optional/bed_mesh.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/optional/lcd_menus.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/park.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/pause_resume_cancel.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/start_end.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/state.cfg (100%) rename klipper/DNV-TPU-Ender3/klipper_config/{klipper-macros => klipper-macros-oud}/velocity.cfg (100%) delete mode 100644 klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/.kinematics.cfg.swp delete mode 100644 klipper/DNV-TPU-Ender3/klipper_config/printer-20220104_172505.cfg delete mode 100644 klipper/DNV-TPU-Ender3/klipper_config/printer-20230405_194210.cfg delete mode 100644 klipper/DNV-TPU-Ender3/klipper_config/printer-20230412_175951.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/bed_mesh_org.cfg b/klipper/DNV-TPU-Ender3/klipper_config/bed_mesh_org.cfg deleted file mode 100644 index 6818608..0000000 --- a/klipper/DNV-TPU-Ender3/klipper_config/bed_mesh_org.cfg +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) 2022 Justin Schuh -# -# This file may be distributed under the terms of the GNU GPLv3 license. -# -# Credit to original source: -# https://gist.github.com/ChipCE/95fdbd3c2f3a064397f9610f915f7d02 - -[gcode_macro bed_mesh_calibrate] -rename_existing: _KM_BED_MESH_CALIBRATE_BASE -description: Wraps BED_MESH_CALIBRATE, scaling probe count to specified area. - Usage: See Klipper documentation. -gcode: - {% set km = printer["gcode_macro _km_globals"] %} - {% set probe_mesh_padding = km.probe_mesh_padding %} - {% set probe_min_count = km.probe_min_count %} - {% set probe_count_scale = km.probe_count_scale %} - {% set bed_mesh = printer.configfile.config.bed_mesh %} - - # don't have the math functions available to work on a delta bed. - {%if "mesh_radius" not in bed_mesh %} - {% set safe_min_x = bed_mesh.mesh_min.split(",")[0]|float %} - {% set safe_min_y = bed_mesh.mesh_min.split(",")[1]|float %} - {% set safe_max_x = bed_mesh.mesh_max.split(",")[0]|float %} - {% set safe_max_y = bed_mesh.mesh_max.split(",")[1]|float %} - - {% if "MESH_MIN" in params %} - {% set mesh_min_x = (params.MESH_MIN.split(",")[0]|float - - probe_mesh_padding, safe_min_x)|max %} - {% set mesh_min_y = (params.MESH_MIN.split(",")[1]|float - - probe_mesh_padding, safe_min_y)|max %} - {% else %} - {% set mesh_min_x = safe_min_x %} - {% set mesh_min_y = safe_min_y %} - {% endif %} - {% if "MESH_MAX" in params %} - {% set mesh_max_x = (params.MESH_MAX.split(",")[0]|float + - probe_mesh_padding, safe_max_x)|min %} - {% set mesh_max_y = (params.MESH_MAX.split(",")[1]|float + - probe_mesh_padding, safe_max_y)|min %} - {% else %} - {% set mesh_max_x = safe_max_x %} - {% set mesh_max_y = safe_max_y %} - {% endif %} - - {% set max_x_probes = (params.PROBE_COUNT | - default(bed_mesh.probe_count)).split(",")[0]|int %} - {% set max_y_probes = (params.PROBE_COUNT | - default(bed_mesh.probe_count)).split(",")[1]|int %} - - {% set x_probes = (max_x_probes * (mesh_max_x - mesh_min_x) / - (safe_max_x - safe_min_x) * probe_count_scale) - | round(0) | int %} - {% set x_probes = ((x_probes, probe_min_count)|max, max_x_probes)|min %} - - {% set y_probes = (max_y_probes * (mesh_max_y - mesh_min_y ) / - (safe_max_y - safe_min_y) * probe_count_scale ) - | round(0) | int %} - {% set y_probes = ((y_probes, probe_min_count)|max, max_y_probes)|min %} - - {% set dummy = params.__setitem__("MESH_MIN", mesh_min_x~","~mesh_min_y) %} - {% set dummy = params.__setitem__("MESH_MAX", mesh_max_x~","~mesh_max_y) %} - {% set dummy = params.__setitem__("PROBE_COUNT", x_probes~","~y_probes) %} - {% endif %} - _km_bed_mesh_calibrate_base{%for k in params%}{ - ' '~k~'="'~params[k]~'"'}{%endfor%} - -[gcode_macro g29] -gcode: - BED_MESH_CALIBRATE \ No newline at end of file diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/LICENSE b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/LICENSE similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/LICENSE rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/LICENSE diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/README.md b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/README.md new file mode 100644 index 0000000..7e4f3c0 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/README.md @@ -0,0 +1,1170 @@ +# klipper-macros + +This is a collection of macros for the +[Klipper 3D printer firmware](https://github.com/Klipper3d/klipper). I +originally created this repo just to have a consistent set of macros shared +between my own 3D printers. But since I've found them useful, I thought other +people might as well. + +## What can I do with these? + +Most of these macros improve basic functionality (e.g. [selectable build sheets +](#bed-surface)) and Klipper compatability with g-code targeting Marlin +printers. However, there are also some nice extras: + +* **[Schedule commands at heights and layer changes](#layer-triggers)** - + This is similar to what your slicer can already do, but I find it simpler, and + you can schedule these commands while a print is active. As an example of + usage, I added an [LCD menu item](#lcd-menus) to pause the print at the next + layer change. This way the pause won't mar the print by e.g. pausing inside + an external perimeter. +* **Dynamically scale [heaters](#heaters) and [fans](#fans)** - This makes it + easy to do things like persistently adjust fan settings during a live print, + or maintain simpler slicer profiles by moving things like a heater bump for a + hardened steel nozzle into state stored on the printer. +* **Cleaner [LCD menu interface](#lcd-menus)** - I've simplified the menus and + provided a much easier way to customize materials in the LCD menu (or at least + I think so). I've also added confirmation dialogs for commands that would + abort an active print. +* **[Optimized mesh bed leveling](#bed-mesh-improvements)** - Probes only within + the printed area, which can save a lot of time on smaller prints. +* **[Automated purge lines](#draw_purge_line)** - Set the desired extrusion + length as `variable_start_purge_length` in your config and a correctly sized + set of purge lines will be extruded in front of the print area immediately + before the print starts. + +## A few warnings... + +* **BACK UP YOUR FULL CONFIG BEFORE MAKING ANY CHANGES!!!** I've seen so many + newcomers desperately looking for help on public forums because they didn't + have a good config to fall back to after messing up their current config while + experimenting with other people's macros. You'll save yourself and everyone + else a whole lot of time and nuisance if you just make sure you always have a + working config backed up. +* **You really should avoid custom macros like this until you're comfortable + using Klipper with a basic config.** Advanced Klipper macros tend to rely + extensively on [monkey patching](https://en.wikipedia.org/wiki/Monkey_patch), + which can lead to problems with unusual configurations or when mixing macros + from various sources. So, you really want to know what you're doing before + including someone else's macros—particularly when including macros with + overlapping functionality from different sources. +* You must have a `heater_bed`, `extruder`, and other [sections listed + below](#klipper-setup) configured, otherwise the macros will ***force a + printer shutdown at startup***. Unfortunately, the Klipper macro system + doesn't have a more graceful way of handling this sort of thing. +* The multi-extruder and chamber heater functionality is very under-tested and + may have bugs, since I haven't used it much at all. Patches welcome. +* There's probably other stuff I haven't used enough to test thoroughly, so use + these macros at your own risk. + +# Troubleshooting + +* Double check that you followed the [installation instructions](#installation) + and are not seeing any console or log errors. +* Ensure that you're running the most current version of stock Klipper, and not + a fork or otherwise altered or outdated copy. +* Ensure you're using the most current version of these macros and haven't + made changes to any files in the `klipper-macros` directory. +* Ensure that you've restarted Klipper after any updates or config changes. +* Run `CHECK_KM_CONFIG` in the Klipper console and fix any errors it reports + to the console and/or logs (it won't output anything if no config errors + were detected). +* Run `_INIT_SURFACES` in the Klipper console to validate that bed surfaces are + being initialized without any errors reported to the console and/or logs. +* Verify your slicer settings and review that the gcode output is correct. Pay + particular attention the initialization portions of the gcode and the + parameters passed to PRINT_START. +* Look for similar issues and post troubleshooting questions in the [Github Q&A + Discussion]( + https://github.com/jschuh/klipper-macros/discussions/categories/q-a). + +# Reporting Bugs + +If you've followed the troubleshooting steps and were unable to resolve the +issue you can [report a bug via Github]( +https://github.com/jschuh/klipper-macros/issues/new/choose). I will probably +respond within a few days (almost certainly within a week). I probably won't +respond through other channels (e.g. Discord, Twitter), because I don't find +them useful for handling bug reports. + +Some important things to remember when reporting bugs: + +* **Paste the full text of the command that triggered the error, along with any + error messages printed to the console** and relevant sections of the klipper + logs if appropriate (and please [format this text as code](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code), + otherwise Github will format it like a ransom note). +* **Attach your config to the bug report.** There's generally no way to diagnose + anything without the configs. +* **Verify that your issue reproduces on the current, stock installation of + Klipper and klipper-macros.** Non-stock configurations and outdated versions + make diagnosis nearly impossible. +* Please don't treat bug reports as a substitute for following the installation + and troubleshooting instructions. +* Please direct feature requests to the [Github Ideas Discussion]( + https://github.com/jschuh/klipper-macros/discussions/categories/ideas). + +> **Note:** Reports that do not follow the above guidelines _**will likely be +> closed without any other action taken.**_ + +# Contributing + +I'm happy to accept bugfix PRs. I'm also potentially open to accepting new +features or additions. However, I may decline the PR if it's something I'm not +interested in or just looks like it would be a hassle for me to maintain. + +## Formatting + +There's no standard style for Klipper macros, so please just try to follow the +style in the files. That stated, here are a few rules to remember: + + * Wrap at 80 characters if at all possible + * Indent 2 spaces, and in line with the logical block when wrapping (no tabs) + * Prefix internal macros with `_` or `_km_` + * Prefix any sort of global state with `_KM_` (e.g. `_KM_SAVE_GCODE_STATE`) + +## Commit Messages + +These are the rules for commit messages, but you can also just look at the +commit log and follow the observed pattern: + + * Use the 50/72 rule for commit messages: No more than 50 characters in the + title and break lines in the description at 72 characters. + * Begin the title with the module name (usually the main file being modified, + minus any extension) followed by a colon. + * Title-only commit messages are fine for simple commits, but be sure to + include a blank line after the title. + * Squash multiple commits if what you're working on makes more sense as a + single logical commit. _This might require you to do a force push on an open + PR._ + +# Installation + +To install the macros, first clone this repository inside of your +`printer_data/config` directory with the following command. + +``` +git clone https://github.com/jschuh/klipper-macros.git +``` + +Then paste the below sections into your `printer.cfg` to get started. Or even +better, paste all of it into a seperate file in the same path as your config, +and include that file. That will make it easier if you want to remove these +macros in the future. + +You may need to customize some settings for your own config. All configurable +settings are in [globals.cfg](globals.cfg#L5), and can be overridden by creating +a corresponding variable with a new value in your `[gcode_macro _km_options]` +section. _**Do not directly modify the variable declarations in globals.cfg.**_ +The macro initialization assumes certain default values, and direct +modifications are likely to break things in very unexpected ways. + +> **Note:** The paths in this README follow [Moonraker's data folder structure. +> ](https://moonraker.readthedocs.io/en/latest/installation/#data-folder-structure) +> You may need to change them if you are using a different structure. + +> **Note:** Make sure you don't currently have any macros that provide the same +> basic function as the macros in this repository (e.g. the default +> [Mainsail](https://docs.mainsail.xyz/configuration#macros) or +> [fluidd](https://docs.fluidd.xyz/configuration/initial_setup#macros) macros). +> As a rule, you should avoid using multiple sets of macros that override the +> same base macro (unless you really know what you're doing) because conflicting +> macros can cause all sorts of weird and frustrating problems. + +> **Note:** If you have a `[homing_override]` section you will need to update +> any `G28` commands in the gcode part to use `G28.6245197` instead (which is +> the renamed version of Klipper's built-in `G28`). Failure to do this will +> cause `G28` commands to error out with the message ***Macro G28 called +> recursively***. + +# Klipper Setup + +``` +# All customizations are documented in globals.cfg. Just copy a variable from +# there into the section below, and change the value to meet your needs. + +[gcode_macro _km_options] +# These are examples of some likely customizations: +# Any sheets in the below list will be available with a configurable offset. +#variable_bed_surfaces: ['smooth_1','texture_1'] +# Length (in mm) of filament to load (bowden tubes will be longer). +#variable_load_length: 90.0 +# Hide the Octoprint LCD menu since I don't use it. +#variable_menu_show_octoprint: False +# Customize the filament menus (up to 10 entries). +#variable_menu_temperature: [ +# {'name' : 'PLA', 'extruder' : 200.0, 'bed' : 60.0}, +# {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0}, +# {'name' : 'ABS', 'extruder' : 245.0, 'bed' : 110.0, 'chamber' : 60}] +# Length of filament (in millimeters) to purge at print start. +#variable_start_purge_length: 30 # This value works for most setups. +gcode: # This line is required by Klipper. +# Any code you put here will run at klipper startup, after the initialization +# for these macros. For example, you could uncomment the following line to +# automatically adjust your bed surface offsets to account for any changes made +# to your Z endstop or probe offset. +# ADJUST_SURFACE_OFFSETS + +# This line includes all the standard macros. +[include klipper-macros/*.cfg] +# Uncomment to include features that require specific hardware support. +# LCD menu support for features like bed surface selection and pause next layer. +#[include klipper-macros/optional/lcd_menus.cfg] +# Optimized bed leveling +#[include klipper-macros/optional/bed_mesh.cfg] + +# The sections below here are required for the macros to work. If your config +# already has some of these sections you should merge the duplicates into one +# (or if they are identical just remove one of them). +[idle_timeout] +gcode: + _KM_IDLE_TIMEOUT # This line must be in your idle_timeout section. + +[pause_resume] + +[respond] + +[save_variables] +filename: ~/printer_data/variables.cfg # UPDATE THIS FOR YOUR PATH!!! + +[virtual_sdcard] +path: ~/gcode_files # UPDATE THIS FOR YOUR PATH!!! +on_error_gcode: CANCEL_PRINT + +[display_status] +``` + +## Slicer Configuration + +### PrusaSlicer / SuperSlicer + +PrusaSlicer and its variants are fairly easy to configure. Just open **Printer +Settings → Custom G-code** for your Klipper printer and paste the below text +into the relevant sections. + +#### Start G-code + +``` +M190 S0 ; Remove this if autoemit_temperature_commands is off in Prusa Slicer 2.6 and later +M109 S0 ; Remove this if autoemit_temperature_commands is off in Prusa Slicer 2.6 and later +_PRINT_START_PHASE_INIT EXTRUDER={first_layer_temperature[initial_tool]} BED=[first_layer_bed_temperature] MESH_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} MESH_MAX={first_layer_print_max[0]},{first_layer_print_max[1]} LAYERS={total_layer_count} NOZZLE_SIZE={nozzle_diameter[0]} +; Insert custom gcode here. +_PRINT_START_PHASE_PREHEAT +; Insert custom gcode here. +_PRINT_START_PHASE_PROBING +; Insert custom gcode here. +_PRINT_START_PHASE_EXTRUDER +; Insert custom gcode here. +_PRINT_START_PHASE_PURGE + +; This is the place to put slicer purge lines if you haven't set a non-zero +; variable_start_purge_length to have START_PRINT automatically calculate and +; perform the purge (e.g. if using a Mosaic Palette, which requires the slicer +; to generate the purge). +``` + +#### Additional SuperSlicer Start G-code + +If you're using SuperSlicer you can add the following immediately before the +`PRINT_START` line from above. This will perform some added bounds checking and +will allow you to use the random print relocation feature without requiring +`exclude_object` entries in the print file. + +``` +PRINT_START_SET MODEL_MIN={bounding_box[0]},{bounding_box[1]} MODEL_MAX={bounding_box[3]},{bounding_box[4]} +``` + +#### End G-code + +``` +PRINT_END +``` + +#### Before layer change G-code + +``` +;BEFORE_LAYER_CHANGE +;[layer_z] +BEFORE_LAYER_CHANGE HEIGHT=[layer_z] LAYER=[layer_num] +``` + +#### After layer change G-code + +``` +;AFTER_LAYER_CHANGE +;[layer_z] +AFTER_LAYER_CHANGE +``` + +### Ultimaker Cura + +Cura is a bit more difficult to configure, and it comes with the following known +issues: + +- Cura doesn't have proper placeholders for before and after layer changes, so + the before triggers all fire and are followed immediately by the after + triggers, all of which happens inside the layer change. This probably doesn't + matter, but it does mean that you can't use the before and after triggers to + avoid running code in the layer change. +- Cura doesn't provide the Z-height of the current layer, so it's inferred from + the current nozzle position, which will include the Z-hop if the nozzle is + currently raised. This means height based gcode triggers may fire earlier than + expected. +- Cura's **Insert at layer change** fires the `After` trigger and then the + `Before` trigger (i.e before or after the *layer*, versus before or after the + *layer change*). These macros and PrusaSlicer do the opposite, which is + something to keep in mind if you're used to how Cura does it. Note that these + macros do use an **Insert at layer change** script to force `LAYER` comment + generation, but that doesn't affect the trigger ordering. +- Cura does not provide the first layer bounding rectangle, only the model + bounding volume. This means the XY bounding box used to speed up mesh probing + may be larger than it needs to be, resulting in bed probing that's not as fast + as it could be. + +Accepting the caveats, the macros work quite well with Cura if you follow the +configuration steps listed below. + +#### Start G-code + +``` +M190 S0 +M109 S0 +_PRINT_START_PHASE_INIT EXTRUDER={material_print_temperature_layer_0} BED={material_bed_temperature_layer_0} NOZZLE_SIZE={machine_nozzle_size} +; Insert custom gcode here. +_PRINT_START_PHASE_PREHEAT +; Insert custom gcode here. +_PRINT_START_PHASE_PROBING +; Insert custom gcode here. +_PRINT_START_PHASE_EXTRUDER +; Insert custom gcode here. +_PRINT_START_PHASE_PURGE + +; This is the place to put slicer purge lines if you haven't set a non-zero +; variable_start_purge_length to have START_PRINT automatically calculate and +; perform the purge (e.g. if using a Mosaic Palette, which requires the slicer +; to generate the purge). +``` + +#### End G-code + +``` +PRINT_END +``` + +#### Post Processing Plugin + +Use the menu item for **Extensions → Post Processing → Modify G-Code** to +open the **Post Processing Plugin** and add the following four scripts. *The +scripts must be run in the order listed below and be sure to copy the strings +exactly, with no leading or trailing spaces.* + +##### Search and Replace + +- Search: `(\n;(MIN|MAX)X:([^\n]+)\n;\2Y:([^\n]+))` +- Replace: `\1\nPRINT_START_SET MESH_\2=\3,\4` +- Use Regular Expressions: ☑️ + +##### Search and Replace + +- Search: `(\n;LAYER_COUNT:([^\n]+))` +- Replace: `\1\nINIT_LAYER_GCODE LAYERS=\2\nPRINT_START_SET LAYERS=\2` +- Use Regular Expressions: ☑️ + +##### Insert at layer change + +- When to insert: `Before` +- G-code to insert: `;BEFORE_LAYER_CHANGE` + +##### Search and Replace + +- Search: `(\n;LAYER:([^\n]+))` +- Replace: `\1\nBEFORE_LAYER_CHANGE LAYER=\2\nAFTER_LAYER_CHANGE` +- Use Regular Expressions: ☑️ + +## Moonraker Configuration + +Once you have the macros working and are comfortable using them, you can have +Moonraker keep them up to date by adding the following into your +`moonraker.conf`. + +``` +[update_manager klipper-macros] +type: git_repo +origin: https://github.com/jschuh/klipper-macros.git +path: ~/printer_data/config/klipper-macros # UPDATE THIS FOR YOUR PATH!!! +primary_branch: main +is_system_service: False +managed_services: klipper +``` + +> **Note:** I'd advise against adding the auto-update entries to Moonraker until +> you have everything working well, because it can make uninstallation a bit +> harder due to Moonraker's autoupdate behavior. + +## Removal + +If you choose to uninstall these macros you basically need to reverse the +installation steps. However, the most critical parts are listed below. + +### Klipper Configuration Removal + +Ensure that you remove the following from your Klipper config (and any included +configs): + +* The full `[gcode_macro _km_options]` section +* Any `include` sections with `klipper-macros` in the path +* `_KM_IDLE_TIMEOUT` in the `[idle_timeout]` section + +If you do not have Moonraker autoupdates configured you can delete the +`klipper-macros` directory with something like the following command (adjusted +for your own paths): + +``` +rm -rf ~/printer_data/config/klipper-macros +``` + +### Slicer Configuration Removal + +If you do not want to change your slicer config, you should be able to leave +it as is, because it generates only a small amount of additional gcode, and the +basic parameters should work with any other `PRINT_START` macros. + +## Moonraker Configuration Removal + +If you've configured Moonraker auto-updates you will need to remove the entire +`[update_manager klipper-macros]` section and restart moonraker prior to +deleting the `klipper-macros` directory, otherwise Moonraker may attempt to +recreate it. You may also find that it takes a few Moonraker update checks and +restarts before the klipper-macros section disappears from the UI. + +# Command Reference + +## Customization + +All features are configured by setting `variable_` values in the +`[gcode_macro _km_options]` section. All available variables and their purpose +are listed in [globals.cfg](globals.cfg#L5). + +> **Note:** `PRINT_START` specific customizations are [covered in more detail + below](#print-start-and-end). + +### Bed Mesh Improvements + +`BED_MESH_CALIBRATE_FAST` + +Wraps the Klipper `BED_MESH_CALIBRATE` command to scale and redistribute the +probe points so that only the appropriate area in `MESH_MIN` and `MESH_MAX` is +probed. This can dramatically reduce probing times for anything that doesn't +fill the first layer of the bed. If the `MESH_MIN` and `MESH_MAX` arguments +are provided to `PRINT_START` it will automatically use this for bed mesh +calibration (so long as a `[bed_mesh]` section is detected in your config). + +The following additional configuration options are available from +[globals.cfg](globals.cfg#L5). + +* `variable_probe_mesh_padding` - Extra padding around the rectangle defined by + `MESH_MIN` and `MESH_MAX`. +* `variable_probe_min_count` - Minimum number of probes for partial probing of a + bed mesh. +* `variable_probe_count_scale` - Scaling factor to increase probe count for + partial bed probes. + +> **Note:** See the [optional section](#bed-mesh) for additional macros. + +> **Note:** The bed mesh optimizations are silently disabled for delta printers. + +> **Note:** If the `bed_mesh` config includes a [`relative_reference_index` + ](https://www.klipper3d.org/Bed_Mesh.html#the-relative-reference-index) then + the index point selected in the optimized mesh will be the point closest to + the index point in the mesh from the config. However, if a + `RELATIVE_REFERENCE_INDEX` parameter is supplied directly to this macro it + will be used unmodified. + +`BED_MESH_CHECK` + +* `ABORT` - Set to a non-zero value to abort macro processing on an error. +* `MESH_MIN` - See Klipper documentation for `BED_MESH_CALIBRATE`. +* `MESH_MAX` - See Klipper documentation for `BED_MESH_CALIBRATE`. + +Checks the `[bed_mesh]` config and optionally supplied parameters. Will warn +(or optionally abort) if `mesh_min` or `mesh_max` could allow a move out of +range during `BED_MESH_CALIBRATE`. This is run implictily at Klipper startup +and as part of `BED_MESH_CALIBRATE_FAST`. + +### Bed Surface + +Provides a set of macros for selecting different bed surfaces with +corresponding Z offset adjustments to compensate for their thickness. All +available surfaces must be listed in the `variable_bed_surfaces` array. +Corresponding LCD menus for sheet selection and babystepping will be added to +*Setup* and *Tune* if [`lcd_menus.cfg`](#lcd-menus) is included. Any Z offset +adjustments made in the LCD menus, console, or other clients (e.g. Mainsail, +Fluidd) will be applied to the current sheet and persisted across restarts. + +#### `ADJUST_SURFACE_OFFSETS` + +Adjusts surface offsets to account for changes in the Z endstop position or +probe Z offset. A message to invoke this command will be shown in the console +when a relevant change is made to `printer.cfg`. + +* `IGNORE` - Set to 1 to reset the saved offsets without adjusting the surfaces. + +#### `LOAD_SURFACE_MESH` + +Attempts to load a mesh associated with the specified surface. + +* `SURFACE` *(default: current surface)* - Bed surface. + +#### `MAKE_SURFACE_MESH` + +Generates a mesh associated with the specified surface. If +`variable_start_try_saved_surface_mesh` is true then `START_PRINT` will load +this mesh when the surface is selected (and skip the mesh leveling step if it +was specified). + +* `BED` - *(default: 70)* Bed temperature when probing the bed. +* `EXTRUDER` - *(default: `variable_start_extruder_probing_temp`)* Extruder + temperature when probing the bed. +* `SURFACE` *(default: current surface)* - Bed surface. +* `MESH_MULTIPLIER` *(default: 2)* - Increases the mesh density by the specified + integer value while preserving the existing mesh points and relative reference + index. A value of `1` leaves the mesh unmodified, `2` doubles the density, `3` + triples it, etc. (I.e. if `bed_mesh` specifies `probe_count: 5,5` and + `MESH_MULTIPLIER=2` then this macro will generate a 9x9 grid, whereas + `MESH_MULTIPLIER=3` will generate a 13x13 grid.) +* *See Klipper `BED_MESH_CALIBRATE` documentation for additional arguments.* + +#### `SET_SURFACE_ACTIVE` + +Sets the provided surface active (from one listed in listed in +`variable_bed_surfaces`) and adjusts the current Z offset to match the +offset for the surface. If no `SURFACE` argument is provided the available +surfaces are listed, with active surface preceded by a `*`. + +* `SURFACE` - Bed surface with an associated offset. + +#### `SET_SURFACE_OFFSET` + +Directly sets the the Z offset of `SURFACE` to the value of `OFFSET`. If no +argument for `SURFACE` is provided the current active surface is used. If no +argument for `OFFSET` is provided the current offset is displayed. + +* `OFFSET` - New Z offset for the given surface. +* `SURFACE` *(default: current surface)* - Bed surface. + +> **Note:** The `SET_GCODE_OFFSET` macro is overridden to update the +> offset for the active surface. This makes the bed surface work with Z offset +> adjustments made via any interface or client. + +### Beep + +Implements the M300 command (if a corresponding `pwm_cycle_time beeper` or +`[output_pin beeper]` section is present). This command causes the speaker to +emit an audible tone. + +#### `M300` + +Emits an audible tone. + +* `P` *(default: `100`)* - Duration of tone (in milliseconds). +* `S` *(default: `1000`)* - Frequency of tone. + +### Draw + +Provides convenience methods for extruding along a path and drawing purge lines. + +> **Note:** The drawing macros require every `extruder` config(s) to have +> correct `nozzle_diameter` and `filament_diameter` settings. + +#### DRAW_LINE_TO + +Extrudes a line of filament at the specified height and width from the current +coordinate to the supplied XY coordinate (using the currently active extruder). + +* `X` *(default: current X position)* - Absolute X coordinate to draw to. +* `Y` *(default: current Y position)* - Absolute Y coordinate to draw to. +* `HEIGHT` *(default: set via `SET_DRAW_PARAMS`)* - Height (in mm) used to + calculate extrusion volume. +* `WIDTH` *(default: set via `SET_DRAW_PARAMS`)* - Extrusion width in mm. +* `FEEDRATE` *(default: set via `SET_DRAW_PARAMS`)* - Drawing feedrate in mm/m. + +> **Note:** The Z axis position must be set prior to caling this macro. The +> `HEIGHT` parameter is used only to calculate the extrusion volume. + +#### SET_DRAW_PARAMS + +Sets the default parameters used by DRAW_LINE_TO. This is helpful in reducing +`DRAW_LINE_TO` command line lengths (particluarly important when debugging in +the console). + +* `HEIGHT` *(optional; 0.2mm at startup)* - Height (in mm) used to + calculate extrusion volume. +* `WIDTH` *(optional; nozzle diameter at startup)* - Extrusion width in mm. +* `FEEDRATE` *(optional; 1200mm/m at startup)* - Drawing feedrate in mm/m. + +#### DRAW_PURGE_LINE + +Moves to a position at the front edge of the first print layer and purges the +specified length of filament as a line (or rows of lines) in front of the +supplied print area. If no print area is specified the purge lines are drawn at +the front edge of the maximum printable area. If no printable area is set it +defaults to the respective axis limits. + +* `PRINT_MIN` *(default: `variable_print_min`)* - Upper boundary of print. +* `PRINT_MAX` *(default: `variable_print_max`)* - Lower boundary of print. +* `HEIGHT` *(default: 62.5% of nozzle diameter)* - Extrusion height in mm. +* `WIDTH` *(default: 125% of nozzle diameter)* - Extrusion width in mm. +* `LENGTH` *(default: `variable_start_purge_length`)* - Length of filament + to purge. *The default in `variable_start_purge_length` is also the amount + that is automatically purged at print start.* + +> **Note:** You must set `variable_print_min` and `variable_print_max` if the +> X and Y axis limits in your config allow your toolhead to move outside the +> printable area (e.g. for dockable probes or purge buckets). + +> **Note:** If your print touches the front edge of the bed it will overlap with +> with the extrusions from `DRAW_PURGE_LINE`. + +### Fans + +Implements scaling parameters that alter the behavior of the M106 command. Once +set, these parameters apply to any fan speed until they are cleared (by default +this happens at the start and end of the print). + +#### `SET_FAN_SCALING` + +Sets scaling parameters for the extruder fan. + +* `BOOST` *(default: `0`)* - Added to the fan speed. +* `SCALE` *(default: `1.0`)* - The `BOOST` value is added an then the fan + speed is multiplied by `SCALE`. +* `MAXIMUM` *(default: `255`)* - The fan speed is clamped to no larger + than `MAXIMUM`. +* `MINIMUM` *(default: `0`)* - The fan speed is clamped to no less + than `MINIMUM`; if this is a non-zero value the fan can be stopped only via + the M107 command. +* `SPEED` *(optional)* - This specifies a new speed target, otherwise any new + adjustments will be applied to the unadjusted value of the last set fan speed. + +#### `RESET_FAN_SCALING` + +* Clears all existing fan scaling factors. + +### Filament + +#### `LOAD_FILAMENT` / `UNLOAD_FILAMENT` + +Loads or unloads filament to the nozzle. + +* `LENGTH` *(default: `variable_load_length`)* - The length of filament to load + or unload. +* `SPEED` *(default: `variable_load_speed`)* - Speed (in mm/m) to feed the + filament. +* `MINIMUM` *(default: `variable_load_min_temp`)* - Ensures the extruder is heated + to at least the specified temperature. + +#### Marlin Compatibility + +* The `M701` and `M702` commands are implemented with a default filament length + of `variable_load_length`. + +### Heaters + +Adds scaling parameters that can alter the behavior of the specified heater. +Once set, these parameters apply to any temperature target on that heater until +the scalaing parameters are cleared. A zero target temperature will turn the +heater off regardless of scaling parameters. + +#### `SET_HEATER_SCALING` + +Sets scaling parameters for the specified heater. If run without any arguments +any currently scaled heaters and thier scaling parameters will be listed. By +default the scaling is cleared at the start and end of a print. + +* `HEATER` - The name of the heater to scale. +* `BOOST` *(default: `0.0`)* - Added to a non-zero target temperature. +* `SCALE` *(default: `1.0`)* - Multiplied with the boosted target + temperature. +* `MAXIMUM` *(default: `max_temp`)* - The target temperature is clamped + to no larger than `MAXIMUM`. This value must be between `min_temp` and + `min_temp`, inclusive. +* `MINIMUM` *(default: `min_temp`)* - A non-zero target temperature is + clamped to no less than `MINIMUM`. This value must be between `min_temp` and + `min_temp`, inclusive. +* `TARGET` *(optional)* - This specifies a new target temperature, otherwise any + new adjustments will be applied to the unadjusted value of the last set target + temperature. + +> **Note:** a zero target temperature will turn the heater off regardless of +> scaling parameters. + +#### `RESET_HEATER_SCALING` + +Clears current heater scaling. + +* `HEATER` *(optional)* - The name of the heater to reset. + +> **Note:** if no HEATER argument is specified scaling parameters will be reset +> for all heaters. + +#### `SET_HEATER_TEMPERATURE_SCALED` + +The scaled version of Klipper's `SET_HEATER_TEMPERATURE`. All arguments are the +same and the function is identical, except that scaling values are applied. + +#### `TEMPERATURE_WAIT_SCALED` + +The scaled version of Klipper's `TEMPERATURE_WAIT`. All arguments are the +same and the function is identical, except that scaling values are applied. + +#### Marlin Compatibility + +* The chamber heating commands `M141` and `M191` are implemented if a + corresponding `[heater_generic chamber]` section is defined in the config. +* The `R` temperature parameter from Marlin is implemented for the `M109` and + `M190` commands. This parameter will cause a wait until the target temperature + stabilizes (i.e. the normal Klipper behavior for `S`). +* The `S` parameter for the `M109` and `M190` commands is altered to behave as + it does in Marlin. Rather than causing a wait until the temperature + stabilizes, the wait will complete as soon as the temperature target is + exceeded. +* The `M109`, `M190`, `M191`, `M104`, `M140`, and `M141` are all overridden to + implement the heater scaling described above. + +> **Note:** Both `SET_HEATER_TEMPERATURE` and `TEMPERATURE_WAIT` are **not** +> overriden and will not scale values. This means that heater scaling +> adjustments made in clients like Mainsail and Fluidd will not be scaled +> (because that seemed like the clearest behavior). The +> [custom LCD menus](#lcd-menus) will also replace the temperature controls +> with non-scaling versions. If you use the stock menus you'll get scaled +> values. + +### Kinematics + +#### `G28` + +Extends the `G28` command to add lazy homing by not re-homing already homed axes +when the `O` argument is included (equivalent to the same argument in Marlin). +See Klipper `G28` documentation for general information and detail on the other +arguments. + +* `O` - Omits already homed axes from the homing procedure. + +> **Note:** If you have a `[homing_override]` section you will need to update +> any `G28` commands in the gcode part to use `G28.6245197` instead (which is +> the renamed version of Klipper's built-in `G28`). Failure to do this will +> cause `G28` commands to error out with the message ***Macro G28 called +> recursively***. + +#### `LAZY_HOME` + +Homes the specified axes; by default omits any axes that are already homed. + +* `AXES` *(default: XYZ)* - List of axes to home. +* `LAZY` *(default: 1)* - Omits already homed axes from the homing procedure. + +### Layer Triggers + +Provides the capability to run user-specified g-code commands at arbitrary layer +changes. + +#### `GCODE_AT_LAYER` + +Runs abritrary, user-provided g-code commands at the user-specified layer or +height. If no arguments are specified it will display all currently scheduled +g-code commands along with their associated layer or height. + +* `HEIGHT` - Z height (in mm) to run the command. Exactly one of `HEIGHT` or + `LAYER` must be specified. +* `LAYER` - Layer number (zero indexed) to run the command. Exactly one of + `HEIGHT` or `LAYER` must be specified. The special value `next` may be + specified run the command at the next layer change. +* `COMMAND` - The command to run at layer change. Take care to properly quote + spaces and escape any special characters. +* `CANCEL` *(default: `0`)* - Cancel the commands previously scheduled at the + given layer or height. If no `COMMAND` argument is provided all commands at + the specified `LAYER` or `HEIGHT` are cancelled. + +#### `CANCEL_ALL_LAYER_GCODE` + +Cancels all g-code commands previously scheduled at any layer or height. + +#### Convenient Layer Change Macros + +* `PAUSE_NEXT_LAYER ...` + * Schedules the current print to pause at the next layer change. See + [`PAUSE`](#pause) macro for additional arguments. +* `PAUSE_AT_LAYER { HEIGHT= | LAYER= } ...` + * Schedules the current print to pause at the specified layer change. + See [`PAUSE`](#pause) for additional arguments. +* `SPEED_AT_LAYER { HEIGHT= | LAYER= } SPEED=` + * Schedules a feedrate adjustment at the specified layer change. (`SPEED` + parameter behaves the same as the `M220` `S` parameter.) +* `FLOW_AT_LAYER { HEIGHT= | LAYER= } FLOW=` + * Schedules a flow-rate adjustment at the specified layer change. (`FLOW` + parameter behaves the same as the `M221` `S` parameter.) +* `FAN_AT_LAYER { HEIGHT= | LAYER= } ...` + * Schedules a fan adjustment at the specified layer change. See + [`SET_FAN_SCALING`](#set_fan_scaling) for additional arguments. +* `HEATER_AT_LAYER { HEIGHT= | LAYER= } ...` + * Schedules a heater adjustment at the specified layer change. See + [`SET_HEATER_SCALING`](#set_heater_scaling) for additional arguments. + +> **Note:** If any triggers cause an exception the current print will +> abort. The convenience macros above validate their arguments as much as is +> possible to reduce the chances of an aborted print, but they cannot entirely +> eliminate the risk of a macro doing something that aborts the print. + +### Park + +Implements toolhead parking. + +#### `PARK` + +Parks the toolhead. + +* `P` *(default: `2`)* - Parking mode + * `P=0` - If current Z-pos is lower than Z-park then the nozzle will be raised + to reach Z-park height + * `P=1` - No matter the current Z-pos, the nozzle will be raised/lowered to + reach Z-park height. + * `P=2` - The nozzle height will be raised by Z-park amount but never going + over the machine’s Z height limit. +* `X` *(default: `variable_park_x`)* - Absolute X parking coordinate. +* `Y` *(default: `variable_park_y`)* - Absolute Y parking coordinate. +* `Z` *(default: `variable_park_z`)* - Z parking coordinate applied according + to the `P` parameter. +* `LAZY` *(default: 1)* - Will home any unhomed axes if needed and will not + move any axis if already homed and parked (even if `P=2`). + +> **Note:** If a print is in progress the larger of the tallest printed layer or +> the current Z position will be used as the current Z position, to avoid +> collisions with already printed objects during a sequential print. + +#### Marlin Compatibility + +* The `G27` command is implemented with a default `P0` argument. + +### Pause, Resume, Cancel + +#### `PAUSE` + +Pauses the current print. + +* `X` *(default: `variable_park_x`)* - Absolute X parking coordinate. +* `Y` *(default: `variable_park_y`)* - Absolute Y parking coordinate. +* `Z` *(default: `variable_park_z`)* - Relative Z parking coordinate +* `E` *(default: `5`)* - Retraction length to prevent ooze. +* `B` *(default: `10`)* - Number of beeps to emit (if `M300` is enabled). + +#### `RESUME` + +* `E` *(default: `5`)* - Retraction length to prevent ooze. + +#### `CANCEL_PRINT` + +Cancels the print and performs all the same functions as `PRINT_END`. + +#### Marlin Compatibility + +* The `M24`, `M25`, `M600`, `M601`, and `M602` commands are all implemented by + wrapping the above commands. + + +### Print Start and End + +#### `PRINT_START` + +Sets up the printer prior to starting a print (called from the slicer's print +start g-code). A target `CHAMBER` temperature may be provided if a +`[heater_generic chamber]` section is present in the klipper config. +If `MESH_MIN` and `MESH_MAX` are provided, then `BED_MESH_CALIBRATE` will probe +only the area within the specified rectangle, and will scale the number of +probes to the appropriate density (this can dramatically reduce probe times for +smaller prints). + +* `BED` - Bed heater starting temperature. +* `EXTRUDER` - Extruder heater starting temperature. +* `CHAMBER` *(optional)* - Chamber heater starting temperature. +* `MESH_MIN` *(optional)* - Minimum x,y coordinate of the first layer. +* `MESH_MAX` *(optional)* - Maximum x,y coordinate of the first layer. +* `NOZZLE_SIZE` *(default: nozzle_diameter)* - Nozzle diameter of the primary + extruder. +* `LAYERS` *(optional)* - Total number of layers in the print. + +These are the customization options you can add to your +`[gcode_macro _km_options]` section to alter `PRINT_START` behavior: + +* `variable_start_bed_heat_delay` *(default: 2000)* - This delay (in + microseconds) is used to allow the bed to stabilize after it reaches it's + target temperature. This is present to account for the fact that the + temperature sensors for most beds are located close to the heating element, + and thus will register as being at the target temperature before the surface + of the bed is. For larger or thicker beds you may want to increase this value. + For smaller or thinner beds you may want to disable this entirely by setting + it to `0`. + +* `variable_start_bed_heat_overshoot` *(default: 2.0)* - This value (in degrees + Celsius) is added to the supplied target bed temperature and use as the + initial target temperature when preheating the bed. After the bed preheats to + this target it there is a brief delay before the final target is set. This + allows the bed to stabilize at it's final temperature more quickly. For + smaller or thinner beds you may want to reduce this value or disable it + entirely by setting it to `0.0`. + +* `variable_start_end_park_y` *(default: `max`)* - The final Y position of the + toolhead in the `PRINT_END` macro, to ensure that the toolhead is out of the + way when the bed is presented for print removal. This can be set to a Y + coordinate (e.g. `0.0`), `max` to use `stepper_y.position_max`, or `min` to + use `stepper_y.position_min`. + +* `variable_start_extruder_preheat_scale` *(default: 0.5)* - This value is + multiplied by the target extruder temperature and the result is used as the + preheat value for the extruder while the bed is heating. This is done to + reduce oozing from the extruder while the bed is heating or being probed. Set + to `1.0` to preheat the extruder to the full target temperature, or to `0.0` + to not preheat the extruder at all until the bed reaches temperature. + +* `variable_start_extruder_probing_temp` *(default: 0)* - If set to a non-zero + value the extruder will be stabilized at the supplied temperature prior to bed + probing. This is useful for [Voron TAP]( + https://github.com/VoronDesign/Voron-Tap), load cells, and other forms of + probing that use the nozzle directly. When this value is provided + `variable_start_extruder_preheat_scale` is ignored. + +* `variable_start_level_bed_at_temp` *(default: True if `bed_mesh` configured + )* - If true the `PRINT_START` macro will run [`BED_MESH_CALIBRATE_FAST`]( + #bed-mesh-improvements) after the bed has stabilized at its target + temperature. + +* `variable_start_home_z_at_temp` *(default: True if `probe:z_virtual_endstop` + configured)* - Rehomes the Z axis once the bed reaches its target temperature, + to account for movement during heating. + +* `variable_start_clear_adjustments_at_end` *(default: True)* - Clears temporary + adjustments after the print completes or is cancelled (e.g. feedrate, + flow percentage). + +* `variable_start_purge_clearance` *(default: 5.0)* - Distance (in millimeters) + between the purge lines and the print area (if a `start_purge_length` is + provided). + +* `variable_start_purge_length` *(default: 0.0)* - Length of filament (in + millimeters) to purge after the extruder finishes heating and prior to + starting the print. For most setups `30` is a good starting point. + +* `variable_start_purge_prime_length` *(default: 10.0)* - Length of filament (in + millimeters) to prime the extruder before drawing the purge lines. + +* `variable_start_quad_gantry_level_at_temp` *(default: True if + `quad_gantry_level` configured)* - If true the `PRINT_START` macro will run + `QUAD_GANTRY_LEVEL` after the bed has stabilized at its target temperature. + +* `variable_start_random_placement_max` *(default: 0)* - A positive value + specifies the +/- distance in the XY axes that the print can be randomly + relocated (assuming the bed has sufficient space). This can help reduce bed + wear from repeatedly printing in the same spot. Note that this feature + requires additional information to determine the proper bounds of the + relocated print. As such, `START_PRINT` must have valid `MESH_MIN`/`MESH_MAX` + parameters, and either `MODEL_MIN`/`MODEL_MAX` must be set or the print file + must include `EXCLUDE_OBJECT_DEFINE` statements with `POLYGON` lists that + define the bounds of the objects ([see `exclude_object` for more information]( + https://www.klipper3d.org/Exclude_Object.html)). + +* `variable_start_random_placement_padding` *(default: 10.0)* - The minimum + distance the relocated print will be placed from the printable edge of the + bed. + +* `variable_start_try_saved_surface_mesh` *(default: False)* - If enabled and + `bed_mesh.profiles` contains a matching mesh for the currently select bed + surface, then the mesh will be loaded from the saved profile (and + [`BED_MESH_CALIBRATE_FAST`](#bed-mesh-improvements) will be skipped if + it would have been run otherwise). + +* `variable_start_z_tilt_adjust_at_temp` *(default: True if `z_tilt` + configured)* - If true the `PRINT_START` macro will run `Z_TILT_ADJUST` after + the bed has stabilized at its target temperature. + +You can further customize the `PRINT_START` macro by declaring your own override +wrapper. This can be useful for things like loading mesh/skew profiles, or any +other setup that may need to be performed prior to printing. + +Here's a skeleton of a `PRINT_START` override wrapper: + +``` +[gcode_macro PRINT_START] +rename_existing: KM_PRINT_START +gcode: + + # Put macro code here to run before PRINT_START. + + KM_PRINT_START {rawparams} + + # Put macro code here to run after PRINT_START but before the print gcode +``` + +> **Note:** You can use this same pattern to wrap other macros in order to + account for customizations specific to your printer. E.g. If you have a + dockable probe you may choose to wrap `BED_MESH_CALIBRATE` with the + appropriate docking/undocking commands. + +#### `PRINT_START` Phases + +The recommended slicer start gcode breaks `PRINT_START` into the phases below. +This approach allows for pausing or cancelling, and inserting custom gcode +between the phases (e.g. to set status LEDs, deploy/dock probes, load filament). +The phases are described in order below: + +* `_PRINT_START_PHASE_INIT` - Initializes the `PRINT_START` settings, and begins + heating the bed and chamber. +* `_PRINT_START_PHASE_PREHEAT` - Stabilizes the bed and (if applicable) chamber + at the target temperatures. Also homes the axes while heating is in progress. +* `_PRINT_START_PHASE_PROBING` - Performs probing operations, including mesh + bed calibration, quad gantry leveling, etc. +* `_PRINT_START_PHASE_EXTRUDER` - Stabilizes the extruder at the target + temperature. +* `_PRINT_START_PHASE_PURGE` - Extrudes a purge line in front of the print area. + +#### `PRINT_END` + +Parks the printhead, shuts down heaters, fans, etc, and performs general state +housekeeping at the end of the print (called from the slicer's print end +g-code). + +### Print Status Events + +> **Note:** This is a brand new feature that will likely evolve in the near +> future. Statuses will probably be added and/or removed as I get a better sense +> of how they're being used. _**Keep that in mind as you integrate this into +> your own setup.**_ + +The following events are fired during during the printing process, and the +`GCODE_ON_PRINT_STATUS` command associates custom gcode with these events. This +custom gcode can be used to set LEDs, emit beeps, or perform any other +operations you may want to run at a given status in the printing process. + +* `ready` - Printer is ready to receive a job +* `filament_load` - Loading filament +* `filament_unload` - Unloading filament +* `bed_heating` - Waiting for the bed to reach target +* `chamber_heating` - Waiting for the chamber to reach target +* `homing` - Homing any axis +* `leveling_gantry` - Performing quad gantry-leveling +* `calibrating_z` - Performing z-tilt adjustment +* `meshing` - Calibrating a bed mesh +* `extruder_heating` - Waiting for the extruder to reach target +* `purging` - Printing purge line +* `printing` - Actively printing +* `pausing` - Print is paused +* `cancelling` - Print is being cancelled +* `completing` - Print completing (does not fire on a cancelled print) + +#### `GCODE_ON_PRINT_STATUS` + +Associates a gcode command with a specific status and sets the parameters for +when and how the status event fires. + +* `STATUS` - A comma seperated list of status events this command is associated + with. Passing the value `all` will associate the gcode with all statuses. +* `COMMAND` - The text of the command. +* `ARGS` *(default: `0`)* - Set to `1` to enable passing the following status + arguments to the macro: `TYPE`, `WHEN`, `LAST_STATUS`, and `NEXT_STATUS`. + This is useful if calling a custom macro that determines its behavior based + on the exact details of the state transition. +* `FILTER_ENTER` - An optional list of statuses that, if provided, will prevent + the command from firing unless the last status matches a status in the list. +* `FILTER_LEAVE` - An optional list of statuses that, if provided, will prevent + the command from firing unless the next status matches a status in the list. +* `TYPE` *(default: `ENTER`)* - If set to `ENTER` the command is run when + entering the specified status. If set to `LEAVE` the command is run when + leaving the specified status. If set to `BOTH` the command is run when + entering and leaving. The `LEAVE` commands are processed first, followed by + the `ENTER` commands, all in the order they were originally set. +* `WHEN` *(default: `PRINTING`)* - Set to `PRINTING` to fire the status event + only when printing, `IDLE` when not printing, and `ALWAYS` for both. + +#### Print Status Event Example + +Below is a simple example of how to set up a status event config. The calls to +`GCODE_ON_PRINT_STATUS` are placed in the `gcode` of the +`[gcode_macro _km_options]` config section, so that they will be run once at +printer start. When the printer enters the `ready` state at startup the command +will echo *` TYPE=LEAVE WHEN=IDLE LAST_STATUS=none NEXT_STATUS=ready`* to the +console, and when it leaves the `ready` state to begin printing it will echo +*`TYPE=ENTER WHEN=PRINTING LAST_STATUS=ready NEXT_STATUS=homing`*. + +``` +[gcode_macro _km_options] +# Any options variables declared here +gcode: + GCODE_ON_PRINT_STATUS STATUS=ready COMMAND="STATUS_TEST" ARGS=1 WHEN=ALWAYS TYPE=BOTH + +[gcode_macro status_test] +variable_extruder: 0 +gcode: + M118 STATUS_TEST {rawparams} +``` + +### Velocity + +These are some basic wrappers for Klipper's analogs to some of Marlin's velocity +related commands, such as accelleration, jerk, and linear advance. + +#### Marlin Compatibility + +* The `M201`, `M203`, `M204`, and `M205` commands are implemented by calling + Klipper's `SET_VELOCITY_LIMIT` command. +* The `M900` command is implemented by calling Klipper's `SET_PRESSURE_ADVANCE` + command. The `K` factor is scaled by `variable_pressure_advance_scale` + *(default: `-1.0`)*. If the scaling value is negative the `M900` command has no + effect. + +## Optional Configs + +### Bed Mesh + +`BED_MESH_CALIBRATE` and `G29` + +Overrides the default `BED_MESH_CALIBRATE` to use `BED_MESH_CALIBRATE_FAST` +instead, and adds the `G29` command. + +***Configuration:*** + +``` +[include klipper-macros/optional/bed_mesh.cfg] +``` + +***Requirements:** A properly configured `bed_mesh` section.* + +### LCD Menus + +Adds relevant menu items to an LCD display and improves some existing +functionality. See the [customization](#customization) section above for more +information on how to configure specific behaviors. + +* Confirmation added for cancelling the print or disabling steppers during a + print. +* Several temperature menu changes: + * Up to 10 filaments and their corresponding temperatures can be set via + `variable_menu_temperature`. + * Per filament chamber temperature controls are available if a + `[heater_generic chamber]` section is configured. + * The cooldown commands are moved to the top level temperature menu. +* The filament loading commands are replaced with macros that use the lengths + and speeds specified in `variable_load_length` and `variable_load_speed`, + which includes a priming phase at the end of the load (controlled via + `variable_load_priming_length` and `variable_load_priming_speed`). +* [Bed surface](#bed-surface) management is integrated into the setup and tuning + menus. +* The SD card menu has been streamlined for printing and non-printing modes. +* The setup menu includes host shutdown, host restart, speed, and flow controls. +* You can hide the Octoprint or SD card menus if you don't use them + (via `variable_menu_show_octoprint` and `variable_menu_show_sdcard`, + respectively). + +***Configuration:*** + +``` +[include klipper-macros/optional/lcd_menus.cfg] +``` + +***Requirements:** A properly configured `display` section.* diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/bed_mesh_fast.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/bed_mesh_fast.cfg new file mode 100644 index 0000000..02b9178 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/bed_mesh_fast.cfg @@ -0,0 +1,226 @@ +# Copyright (C) 2023 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. +# +# Credit to original inspiration: +# https://gist.github.com/ChipCE/95fdbd3c2f3a064397f9610f915f7d02 + +[gcode_macro bed_mesh_calibrate_fast] +description: Wraps BED_MESH_CALIBRATE, scaling probe count to specified area. + Usage: See Klipper documentation. +gcode: + # Abort on a bad config. + BED_MESH_CHECK ABORT=1 + + # Find the real bed_mesh_calibrate command. + {% set calibrate_cmd = + (printer["gcode_macro list_macros"].macros.bed_mesh_calibrate| + default(["bed_mesh_calibrate"],True))[-1] %} + + {% set km = printer["gcode_macro _km_globals"] %} + {% set probe_mesh_padding = km.probe_mesh_padding %} + {% set probe_min_count = km.probe_min_count %} + {% set probe_count_scale = km.probe_count_scale %} + {% set bed_mesh = printer.configfile.settings.bed_mesh %} + + # TODO: Handle the math for a delta bed. + {%if "mesh_radius" not in bed_mesh and + "MESH_RADIUS" not in params %} + {% set safe_min_x = bed_mesh.mesh_min[0] %} + {% set safe_min_y = bed_mesh.mesh_min[1] %} + {% set safe_max_x = bed_mesh.mesh_max[0] %} + {% set safe_max_y = bed_mesh.mesh_max[1] %} + + # Always bound MESH_MIN and MESH_MAX. + {% if "MESH_MIN" in params %} + {% set mesh_min_x = (params.MESH_MIN.split(",")[0]|float - + probe_mesh_padding, safe_min_x)|max %} + {% set mesh_min_y = (params.MESH_MIN.split(",")[1]|float - + probe_mesh_padding, safe_min_y)|max %} + {% else %} + {% set mesh_min_x = safe_min_x %} + {% set mesh_min_y = safe_min_y %} + {% endif %} + {% if "MESH_MAX" in params %} + {% set mesh_max_x = (params.MESH_MAX.split(",")[0]|float + + probe_mesh_padding, safe_max_x)|min %} + {% set mesh_max_y = (params.MESH_MAX.split(",")[1]|float + + probe_mesh_padding, safe_max_y)|min %} + {% else %} + {% set mesh_max_x = safe_max_x %} + {% set mesh_max_y = safe_max_y %} + {% endif %} + + {% set probe_count = bed_mesh.probe_count if not params.PROBE_COUNT else + params.PROBE_COUNT.split(",")|map('int')|list %} + # Don't scale the probe count if one was explicitly provided. + {% if "PROBE_COUNT" not in params %} + {% set max_x_probes = probe_count[0] %} + {% set max_y_probes = probe_count[-1] %} + + {% set x_probes = (max_x_probes * (mesh_max_x - mesh_min_x) / + (safe_max_x - safe_min_x) * probe_count_scale) + | round(0) | int %} + {% set x_probes = ((x_probes, probe_min_count)|max, max_x_probes)|min %} + + {% set y_probes = (max_y_probes * (mesh_max_y - mesh_min_y ) / + (safe_max_y - safe_min_y) * probe_count_scale ) + | round(0) | int %} + {% set y_probes = ((y_probes, probe_min_count)|max, max_y_probes)|min %} + # Add probes for bicubic if one axis has too many probes for lagrange. + {% if x_probes > 6 and y_probes < 4 %} + {% set y_probes = 4 %} + {% elif y_probes > 6 and x_probes < 4 %} + {% set x_probes = 4 %} + {% endif %} + {% set probe_count = [x_probes,y_probes] %} + {% elif probe_count|length == 1 %} + {% set dummy = probe_count.append(probe_count[0]) %} + {% endif %} + + # If the config includes a relative_reference_index then we need to find the + # point in the new mesh that's closest to the index point in the mesh that + # the config would have generated. + # TODO: Could also adjust the mesh parameters in here to ensure it includes + # the original index point, but that would be extra work and would cause + # slower probes if the mesh needs to be expanded to include the point. + {% if "relative_reference_index" in bed_mesh %} + {% set row = (bed_mesh.relative_reference_index / bed_mesh.probe_count[0] + )|int%} + {% set rrf_x = (((safe_max_x - safe_min_x) / + (bed_mesh.probe_count[0] - 1))|round(2, 'floor')) * + (bed_mesh.relative_reference_index % + bed_mesh.probe_count[-1]) %} + {% if row % 2 %} + {% set rrf_x = safe_max_x - rrf_x %} + {% else %} + {% set rrf_x = safe_min_x + rrf_x %} + {% endif %} + {% set rrf_y = (((safe_max_y - safe_min_y) / + (bed_mesh.probe_count[-1] - 1))|round(2, 'floor')) * + row + safe_min_x %} + {% set x_dist = (mesh_max_x - mesh_min_x) / (probe_count[0] - 1) %} + {% set y_dist = (mesh_max_y - mesh_min_y) / (probe_count[1] - 1) %} + {% set rrf = {'x':0, 'y':0, 'dist':safe_max_x**2+safe_max_y**2,'pos':0} %} + {% for row in range(probe_count[1])%} + {% for col in range(probe_count[0])%} + {% if row % 2 %} + {% set x = mesh_max_x - col * x_dist %} + {% else %} + {% set x = mesh_min_x + col * x_dist %} + {% endif %} + {% set y = mesh_min_y + row * y_dist %} + {% set dist = ((x - rrf_x)**2 + (y - rrf_y)**2)**0.5 %} + {% if dist < rrf.dist %} + {% set dummy = rrf.__setitem__("dist", dist) %} + {% set dummy = rrf.__setitem__("x", x) %} + {% set dummy = rrf.__setitem__("y", y) %} + {% set dummy = rrf.__setitem__("pos", row * probe_count[1] + col) %} + {% endif %} + {% endfor %} + {% endfor %} + {% if rrf.x != rrf_x or rrf.y != rrf_y %} + {action_respond_info("relative_reference_index remapped to" + " %d (%.2f,%.2f) from %d (%.2f,%.2f)" % + (rrf.pos, rrf.x, rrf.y, + bed_mesh.relative_reference_index, rrf_x, rrf_y))} + {% endif %} + {% set dummy = params.__setitem__("RELATIVE_REFERENCE_INDEX", rrf.pos) %} + {% endif %} + + {% set dummy = params.__setitem__("MESH_MIN", mesh_min_x~","~mesh_min_y) %} + {% set dummy = params.__setitem__("MESH_MAX", mesh_max_x~","~mesh_max_y) %} + {% set dummy = params.__setitem__("PROBE_COUNT", probe_count|join(',')) %} + # Force bicubic if we've exceeded the max for lagrange. + {% if probe_count[0] > 6 or probe_count[1]|default(0) > 6 %} + {% set dummy = params.__setitem__("ALGORITHM", "bicubic") %} + {% endif %} + # Warn on bad parameters that were fixed. + {% if "MESH_MIN" in params or "MESH_MAX" in params %} + BED_MESH_CHECK {rawparams} + {% endif %} + {% else %} + # Mesh limits may be out of bounds, so strip them from the fallback path. + {% set dummy = params.__delitem__("MESH_MIN") %} + {% set dummy = params.__delitem__("MESH_MAX") %} + {% endif %} + # Abort on bad parameters. + {% if "MESH_MIN" in params or "MESH_MAX" in params %} + BED_MESH_CHECK ABORT=1{%for k in params%}{' '~k~'="'~params[k]~'"'}{% + endfor%} + {% endif %} + _KM_PRINT_STATUS ACTION=PUSH_STATUS + _KM_PRINT_STATUS ACTION=CHANGE STATUS=meshing + {calibrate_cmd}{%for k in params%}{' '~k~'="'~params[k]~'"'}{%endfor%} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=pop_status + +[gcode_macro bed_mesh_check] +description: Warns if bed_mesh config may generate an invalid mesh. + Usage: BED_MESH_CHECK [MESH_MIN=] [MESH_MAX=] [ABORT=<0|1>] +gcode: + {% if printer.bed_mesh is defined %} + {% set action = action_respond_info if params.ABORT|default(0)|int == 0 else + action_raise_error %} + {% set settings = printer.configfile.settings %} + {% set x_min = settings.stepper_x.position_min %} + {% set y_min = settings.stepper_y.position_min %} + {% set x_max = settings.stepper_x.position_max %} + {% set y_max = settings.stepper_y.position_max %} + + {% set label = "[bed_mesh] config" %} + {% if "MESH_MIN" in params %} + {% set label = "BED_MESH_CALIBRATE params" %} + {% set mesh_min_x = params.MESH_MIN.split(",")[0]|float %} + {% set mesh_min_y = params.MESH_MIN.split(",")[1]|float %} + {% else %} + {% set mesh_min_x = settings.bed_mesh.mesh_min[0] %} + {% set mesh_min_y = settings.bed_mesh.mesh_min[1] %} + {% endif %} + {% if "MESH_MAX" in params %} + {% set label = "BED_MESH_CALIBRATE params" %} + {% set mesh_max_x = params.MESH_MAX.split(",")[0]|float %} + {% set mesh_max_y = params.MESH_MAX.split(",")[1]|float %} + {% else %} + {% set mesh_max_x = settings.bed_mesh.mesh_max[0] %} + {% set mesh_max_y = settings.bed_mesh.mesh_max[1] %} + {% endif %} + + {% if "bltouch" in settings %} + {% set x_offset = settings.bltouch.x_offset %} + {% set y_offset = settings.bltouch.y_offset %} + {% set probe = "bltouch" %} + {% elif "probe" in settings %} + {% set x_offset = settings.probe.x_offset %} + {% set y_offset = settings.probe.y_offset %} + {% set probe = "probe" %} + {% else %} + {% set x_offset = 0.0 %} + {% set y_offset = 0.0 %} + {% endif %} + + {% set output = [] %} + {% set warn = + "* mesh_%s (%f, %f) adjusted by " ~ probe ~ + ".%s_offset (%f) can move out of range for " + "stepper_%s.position_%s (%f)." %} + {% if x_offset > 0 and (mesh_min_x - x_offset) < x_min %} + {% set dummy = output.append(warn % ('min', mesh_min_x, mesh_min_y, + 'x', x_offset, 'x', 'min', x_min)) %} + {% elif x_offset < 0 and (mesh_max_x - x_offset) > x_max %} + {% set dummy = output.append(warn % ('max', mesh_max_x, mesh_max_y, + 'x', x_offset, 'x', 'max', x_max)) %} + {% endif %} + {% if y_offset > 0 and (mesh_min_y - y_offset) < y_min %} + {% set dummy = output.append(warn % ('min', mesh_min_x, mesh_min_y, + 'y', y_offset, 'y', 'min', y_min)) %} + {% elif y_offset < 0 and (mesh_max_y - y_offset) > y_max %} + {% set dummy = output.append(warn % ('max', mesh_max_x, mesh_max_y, + 'y', y_offset, 'y', 'max', y_max)) %} + {% endif %} + + {% if output %} + { action( + "Warning: The following issue(s) were detected in your " ~ label ~ + ":\n" ~ output|join("\n")) } + {% endif %} + {% endif %} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/bed_surface.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/bed_surface.cfg new file mode 100644 index 0000000..8e73d69 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/bed_surface.cfg @@ -0,0 +1,287 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. +# +# Credit to original inspiration: +# https://klipper.discourse.group/t/saving-and-adjusting-per-build-surface-z-offsets/696 + +[gcode_macro _apply_bed_surface_offset] +gcode: + {% set surfaces = printer.save_variables.variables.bed_surfaces %} + {% if surfaces.active %} + SET_SURFACE_ACTIVE SURFACE={surfaces.active} + {% endif %} + +[gcode_macro _init_surfaces] +gcode: + {% set km = printer["gcode_macro _km_globals"] %} + {% if "bed_surfaces" in printer.save_variables.variables %} + {% set old_surfaces = printer.save_variables.variables.bed_surfaces %} + {% else %} + {% set old_surfaces = { 'active' : '', 'available' : {} } %} + {% endif %} + {% set settings = printer.configfile.settings %} + {% set new_probe_z = (settings.probe | default(settings.bltouch) | + default(settings.smart_effector) | default({}) + ).z_offset|default(0.0)|float %} + {% set new_endstop_z = (settings.stepper_z | default({})).position_endstop | + default(0.0)|float %} + {% if 'endstop_z' not in old_surfaces %} + {% set dummy = old_surfaces.__setitem__('endstop_z', new_endstop_z) %} + {% endif %} + {% if 'probe_z' not in old_surfaces %} + {% set dummy = old_surfaces.__setitem__('probe_z', new_probe_z) %} + {% endif %} + {% set surfaces = { 'active' : '', 'available' : {}, + 'endstop_z' : old_surfaces.endstop_z, + 'probe_z' : old_surfaces.probe_z } %} + {% for s in km.bed_surfaces %} + {% set s = s.split()|join(' ')|lower %} + {% if s|length > km.bed_surface_max_name_length or + s|list|select("in", " \r\n\"\'")|list %} + {action_raise_error('Invalid surface name "%s". Name must be %d or fewer ' + 'characters and must not include space or quotation characters' + | format(s, km.bed_surface_max_name_length))} + {% endif %} + {% if s in old_surfaces.available %} + {% set dummy = surfaces.available.__setitem__(s, + old_surfaces.available[s]) %} + {% else %} + {% set dummy = surfaces.available.__setitem__(s, {'offset' : 0.0}) %} + {% endif %} + {% endfor %} + {% if old_surfaces.active in surfaces.available %} + {% set dummy = surfaces.__setitem__('active', old_surfaces.active) %} + {% elif km.bed_surfaces %} + {% set dummy = surfaces.__setitem__('active', km.bed_surfaces[0]|lower) %} + {% endif %} + SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}" + _APPLY_BED_SURFACE_OFFSET + {% if new_probe_z != surfaces.probe_z or + new_endstop_z != surfaces.endstop_z %} + { action_respond_info( + 'Z probe offset or endstop position changed. Run ADJUST_SURFACE_OFFSETS ' + 'to adjust the offset for all saved surfaces by the change differential, ' + 'or run ADJUST_SURFACE_OFFSETS IGNORE=1 to hide this message without ' + 'making changes.') } + {% endif %} + +[gcode_macro adjust_surface_offsets] +description: Adjusts surface offsets to account for changes in the Z endstop + position or probe Z offset. + Usage: ADJUST_SURFACE_OFFSETS [IGNORE] +gcode: + {% set surfaces = printer.save_variables.variables.bed_surfaces %} + {% set settings = printer.configfile.settings %} + {% set new_probe_z = (settings.probe | default(settings.bltouch) | + default(settings.smart_effector) | default({}) + ).z_offset|default(0.0)|float %} + {% set new_endstop_z = (settings.stepper_z | default({})).position_endstop | + default(0.0)|float %} + {% set diff = (surfaces.probe_z - new_probe_z + + surfaces.endstop_z - new_endstop_z)|round(6) %} + {% if not params.IGNORE|default(0)|int %} + {% for s in surfaces.available %} + {% set offset = (surfaces.available[s].offset - diff)|round(6) %} + {% set dummy = surfaces.available.__setitem__(s, {'offset' : offset}) %} + {% endfor %} + { action_respond_info("All bed surfaces now adjusted by %1.4f"| + format(diff))} + {% elif diff != 0 %} + { action_respond_info("Status cleared without adjustment") } + {% endif %} + {% set dummy = surfaces.__setitem__('endstop_z', new_endstop_z| round(6)) %} + {% set dummy = surfaces.__setitem__('probe_z', new_probe_z|round(6)) %} + SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}" + +[gcode_macro set_surface_offset] +description: Sets the offset for a surface and moves the toolhead (if homed). + Usage: SET_SURFACE_OFFSET [OFFSET=] [SURFACE=] +gcode: + {% set surfaces = printer.save_variables.variables.bed_surfaces %} + {% set SURFACE = params.SURFACE|default(surfaces.active)|lower %} + {% if SURFACE not in surfaces.available %} + { action_raise_error("Bed surface %s does not exist." | format(SURFACE)) } + {% endif %} + {% set active = surfaces.available[SURFACE] %} + # If no offset is provided just print out the current offset. + {% set OFFSET = params.OFFSET|default(active.offset)|float %} + {% if OFFSET != active.offset %} + {% set dummy = surfaces.available[SURFACE].__setitem__("offset", OFFSET) %} + SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}" + {% if SURFACE == surfaces.active %} + _km_set_gcode_offset_base Z="{OFFSET}" MOVE={ + 1 if printer.toolhead.homed_axes == 'xyz' else 0} + {% endif %} + {% endif %} + { action_respond_info("Bed surface: %s Offset: %.3f" + | format(SURFACE, OFFSET)) } + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.SURFACE|default(active surface) %} + {% set dummy = params.OFFSET|default(none)|float %} + " %} # End argument block for Mainsail + +[gcode_macro set_surface_active] +description: Sets the active bed surface and moves the toolhead (if homed). If + no SURFACE argument is present the available surfaces are listed and the + active one is preceded by a "*". + Usage: SET_SURFACE_ACTIVE [SURFACE=] +gcode: + {% set surfaces = printer.save_variables.variables.bed_surfaces %} + {% if "SURFACE" in params %} + {% set SURFACE = params.SURFACE|lower %} + {% if SURFACE not in surfaces.available %} + { action_raise_error("Bed surface %s does not exist." | format(SURFACE)) } + {% endif %} + {% if SURFACE != surfaces.active %} + {% set dummy = surfaces.__setitem__("active", SURFACE) %} + SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}" + {% endif %} + {% if surfaces.available[SURFACE].offset != + printer.gcode_move.homing_origin.z %} + _km_set_gcode_offset_base Z="{surfaces.available[SURFACE].offset + }" MOVE={1 if printer.toolhead.homed_axes == 'xyz' else 0} + {% endif %} + {action_respond_info("Active bed surface: %s; offset: %.3f" + | format(SURFACE, surfaces.available[SURFACE].offset))} + {% else %} + {% set output = [] %} + {% for s in surfaces.available|list|sort %} + {% set dummy = output.append("%s %s - offset: %.3f" + | format("*" if s == surfaces.active else " ", + s, surfaces.available[s].offset)) %} + {% endfor %} + {action_respond_info(output|join('\n'))} + {% endif %} + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.SURFACE|default(none) %} + " %} # End argument block for Mainsail + +[gcode_macro set_gcode_offset] +description: Wraps SET_GCODE_OFFSET to update the current bed sheet offset. + Usage: SET_GCODE_OFFSET [X=|X_ADJUST=] + [Y=|Y_ADJUST=] + [Z=|Z_ADJUST=] + [MOVE=1 [MOVE_SPEED=]] +rename_existing: _KM_SET_GCODE_OFFSET_BASE +gcode: + {% set surfaces = printer.save_variables.variables.bed_surfaces %} + {% if surfaces.active and + not printer["gcode_macro _km_save_state"].is_ephemeral %} + {% set Z = params.Z|default(0.0)|float|round(6) %} + {% set Z_ADJUST = params.Z_ADJUST|default(0.0)|float %} + {% if 'Z' in params and + Z != surfaces.available[surfaces.active].offset %} + {% set dummy = surfaces.available[surfaces.active].__setitem__("offset", + Z) %} + SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}" + {% elif Z_ADJUST != 0.0 %} + {% set dummy = surfaces.available[surfaces.active].__setitem__( + "offset", (Z_ADJUST + printer.gcode_move.homing_origin.z)|round(6)) %} + SAVE_VARIABLE VARIABLE=bed_surfaces VALUE="{surfaces}" + {% endif %} + {% endif %} + _km_set_gcode_offset_base{% for k in params%}{' '~k~'="'~params[k]~'"' + }{% endfor %} + +[gcode_macro make_surface_mesh] +description: Generates and saves a mesh to automatically load in PRINT_START. + Usage: MAKE_SURFACE_MESH [SURFACE=] [BED=] + [EXTRUDER=] + [MESH_MULTIPLIER=] + [bed_mesh_calibrate parameters] +gcode: + {% set surfaces = printer.save_variables.variables.bed_surfaces %} + {% set SURFACE = params.SURFACE|default(surfaces.active)|lower %} + {% if SURFACE not in surfaces.available %} + { action_raise_error("Bed surface %s does not exist." | format(SURFACE)) } + {% endif %} + {% set dummy = params.__setitem__('PROFILE', SURFACE) %} + {% set BED = params.BED|default(70) | int %} + {% set km = printer["gcode_macro _km_globals"] %} + {% set EXTRUDER = params.EXTRUDER|default(km.start_extruder_probing_temp) | + int %} + {% set MESH_MULTIPLIER = (params.MESH_MULTIPLIER|default(2)|int, 1)|max %} + + M104 S{EXTRUDER} + M140 S{BED} + G28 + + # Adjust offset before running mesh + {% if surfaces.available[SURFACE].offset != + printer.gcode_move.homing_origin.z %} + _km_set_gcode_offset_base Z="{surfaces.available[SURFACE].offset + }" MOVE=1 + {% endif %} + + # If no offset is provided just print out the current offset. + {% if BED > 0 %} + {action_respond_info("Stabilizing bed at %iC" | format(BED,))} + _KM_PARK_IF_NEEDED HEATER=heater_bed RANGE=0.5 + {% if BED < (printer.heater_bed.temperature - 0.2) %} + M190 R{BED} + G4 P{((km.start_bed_heat_delay * 10, 30000)|min, + km.start_bed_heat_delay)|max} + {% else %} + G4 P{km.start_bed_heat_delay} + {% endif %} + M190 R{BED} + {% endif %} + + {% if EXTRUDER > 0 %} + _KM_PARK_IF_NEEDED HEATER={printer.toolhead.extruder} RANGE=2 + M109 R{km.start_extruder_probing_temp} + {% endif %} + + {% if km.start_home_z_at_temp and not bed_at_target %} + G28 Z # Re-home only the Z axis now that the bed has stabilized. + {% endif %} + + # Scale the mesh grid size while preserving the original points and relative + # reference index. + {% set probe_count = printer.configfile.settings.bed_mesh.probe_count + if not params.PROBE_COUNT else + params.PROBE_COUNT.split(",")|map('int')|list %} + {% set dummy = params.__setitem__('PROBE_COUNT',( + MESH_MULTIPLIER * (probe_count[0] - 1) + 1, + MESH_MULTIPLIER * (probe_count[-1] - 1) + 1,)|join(',')) %} + + BED_MESH_CLEAR + BED_MESH_CALIBRATE_FAST {% + for k in params|reject('in',['BED','SURFACE'])|list %}{ + ' ' ~ k ~ '=' ~ params[k] }{% endfor %} + SAVE_CONFIG + + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.MESH_MULTIPLIER|default(2) %} + {% set dummy = params.SURFACE|default(active surface) %} + " %} # End argument block for Mainsail + +[gcode_macro load_surface_mesh] +description: Attempts to load a mesh associated with the specified surface. + Usage: LOAD_SURFACE_MESH [SURFACE=] +gcode: + {% set surfaces = printer.save_variables.variables.bed_surfaces %} + {% set SURFACE = params.SURFACE|default(surfaces.active)|lower %} + {% if SURFACE != surfaces.active %} + SET_SURFACE_ACTIVE SURFACE={SURFACE} + {% endif %} + + {% if SURFACE in printer.bed_mesh.profiles %} + {% set mesh = printer.bed_mesh.profiles[SURFACE].mesh_params %} + {% set default = printer.configfile.settings.bed_mesh %} + # Ensure the saved mesh has at least the resolution of the default. + {% if mesh.min_x <= (default.mesh_min[0] + 0.5) and + mesh.min_y <= (default.mesh_min[1] + 0.5) and + mesh.max_x >= (default.mesh_max[0] - 0.5) and + mesh.max_y >= (default.mesh_max[1] - 0.5) and + mesh.x_count >= default.probe_count[0] and + mesh.y_count >= default.probe_count[-1] %} + # Skip the bed level if we have a good profile. + BED_MESH_PROFILE LOAD={SURFACE} + {action_respond_info("Loaded mesh: %s" | format(SURFACE,))} + {% endif %} + {% endif %} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/beep.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/beep.cfg new file mode 100644 index 0000000..fe4112d --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/beep.cfg @@ -0,0 +1,30 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. +[gcode_macro m300] +description: Emits and audible beep. + Usage: M300 [P] [S] +gcode: + {% set settings = printer.configfile.settings %} + {% if "output_pin beeper" in printer or "pwm_cycle_time beeper" in printer %} + {% set P = (params.P|default(100)|int, 0)|max %} + {% set S = (params.S|default(1000)|int, 1)|max %} + SET_PIN PIN=beeper VALUE={% if "output_pin beeper" in settings %}1{%else%}{ + settings["pwm_cycle_time beeper"].scale|default(1.0) * 0.5 + } CYCLE_TIME={ 1.0 / S }{% endif %} + G4 P{P} + SET_PIN PIN=beeper VALUE=0 + {% else %} + {action_respond_info( + "M300 is disabled. To enable create an [pwm_cycle_time beeper] config.")} + {% endif %} + +[gcode_macro _km_beep_if_available] +description: Wraps beeper to avoid console spam +gcode: + {% if "output_pin beeper" in printer or "pwm_cycle_time beeper" in printer %} + {% for i in range(params.BEEPS|int) %} + M300 P100 + G4 P200 + {% endfor %} + {% endif %} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/draw.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/draw.cfg new file mode 100644 index 0000000..91f46b5 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/draw.cfg @@ -0,0 +1,130 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro set_draw_params] +description: Sets the default parameters used by DRAW_LINE_TO. + Usage: SET_DRAW_PARAMS [HEIGHT=] [WIDTH=] [FEEDRATE=] +variable_height: 0.2 +variable_width: 0.0 # Set to nozzle_diameter at startup +variable_feedrate: 1200 +gcode: + {% set dparams = printer["gcode_macro set_draw_params"] %} + {% for k in params %} + {% set kl = k|lower %} + {% if kl in dparams %} + {% if dparams[kl] is float %} + {% set v = params[k]|float %} + {% elif dparams[kl] is integer %} + {% set v = params[k]|int %} + {% endif %} + SET_GCODE_VARIABLE MACRO=set_draw_params VARIABLE={kl} VALUE="{v}" + {% endif %} + {% endfor %} + +[gcode_macro draw_line_to] +description: Extrudes a line of filament at the specified height and width from + the current coordinate to the supplied XY coordinate. (The height is used only + to calculate the extrusion volume.) + Usage: DRAW_LINE_TO [X=] [Y=] [HEIGHT=] [WIDTH=] + [FEEDRATE=] +gcode: + {% set dparams = printer["gcode_macro set_draw_params"] %} + {% set position = printer.gcode_move.gcode_position %} + {% set X = params.X|default(position.x)|float %} + {% set Y = params.Y|default(position.y)|float %} + {% set HEIGHT = params.HEIGHT|default(dparams.height)|float %} + {% set WIDTH = params.WIDTH|default(dparams.width)|float %} + {% set FEEDRATE = params.FEEDRATE|default(dparams.feedrate)|int %} + + {% set distance = ((X - position.x) ** 2 + (Y - position.y) ** 2) ** 0.5 %} + + {% set filament_area = 3.14159 * + (printer.configfile.settings[ + printer.toolhead.extruder].filament_diameter ** 2) / 4 %} + {% set E = distance * ((WIDTH * HEIGHT) / filament_area) %} + + # Use the base state call here so offset adjustments get persisted. + _KM_SAVE_GCODE_STATE NAME=_KM_PURGE + G90 + G92 E0.0 + G1 X{"%.3f" % X} Y{"%.3f" % Y} E{"%.5f" % E} F{FEEDRATE} + _KM_RESTORE_GCODE_STATE NAME=_KM_PURGE MOVE=0 + +[gcode_macro draw_purge_line] +description: Purges the specified length of filament as a line (or rows of + lines) in front of the supplied print area. If no print area is specified the + purge lines are drawn at the front edge of the maximum printable area. If no + printable area is set it defaults to the XY axis limits. + Usage: DRAW_PURGE_LINE [PRINT_MIN=] [PRINT_MAX=] [HEIGHT=] + [WIDTH=] [LENGTH=] +gcode: + # TODO: Make this work for delta printers. + {% set km = printer["gcode_macro _km_globals"] %} + {% set origin = printer.gcode_move.homing_origin %} + {% set dummy = km.__setitem__('print_min', (km.print_min[0] - origin.x, + km.print_min[1] - origin.y)) %} + {% set dummy = km.__setitem__('print_max', (km.print_max[0] - origin.x, + km.print_max[1] - origin.y)) %} + + {% if "PRINT_MIN" in params %} + {% set PRINT_MIN = ( + (params.PRINT_MIN.split(",")[0]|float, km.print_min[0])|max, + (params.PRINT_MIN.split(",")[1]|float, km.print_min[1])|max + ) %} + {% else %} + {% set PRINT_MIN = km.print_min %} + {% endif %} + {% if "PRINT_MAX" in params %} + {% set PRINT_MAX = ( + (params.PRINT_MAX.split(",")[0]|float, km.print_max[0])|min, + (params.PRINT_MAX.split(",")[1]|float, km.print_max[1])|min + ) %} + {% else %} + {% set PRINT_MAX = km.print_max %} + {% endif %} + {% set extruder = printer.toolhead.extruder|string %} + {% set HEIGHT = params.HEIGHT|default( + printer.configfile.settings[extruder].nozzle_diameter * 0.625)|float %} + {% set WIDTH = params.WIDTH|default( + printer.configfile.settings[extruder].nozzle_diameter * 1.25)|float %} + {% set LENGTH = params.LENGTH|default(km.start_purge_length)|float %} + + {% set dparams = printer["gcode_macro set_draw_params"] %} + {% set filament_area = 3.14159 * + (printer.configfile.settings[extruder].filament_diameter ** 2) / 4 %} + {% set purge_length = (LENGTH * filament_area) / (WIDTH * HEIGHT) %} + {% set printable_length = PRINT_MAX[0] - PRINT_MIN[0] %} + {% set purge_rows = (purge_length / printable_length)|round(0,'ceil')|int %} + {% set printable_inset = (printable_length - purge_length / purge_rows) / 2 %} + {% set PRINT_MIN = (PRINT_MIN[0] + printable_inset, PRINT_MIN[1]) %} + {% set PRINT_MAX = (PRINT_MAX[0] - printable_inset, PRINT_MAX[1]) %} + # This will purge into the print area when the bed is filled to the front. + {% set y_start = (km.print_min[1], PRINT_MIN[1] - km.start_purge_clearance - + (purge_rows + 0.5) * WIDTH )|max %} + G90 + # Jog to the front left corner to get strings out of the print area. + G1 X{"%.3f" % (PRINT_MIN[0] - 30, km.print_min[0])|max} Y{ + "%.3f" % (y_start - 10, km.print_min[1])|max} F{km.travel_speed_xy} + # Move to the starting corner. + G1 X{"%.3f" % (PRINT_MIN[0] - km.start_purge_prime_length / WIDTH, + km.print_min[0])|max} Y{"%.3f" % y_start} Z{ + "%.4f" % HEIGHT} F{km.travel_speed_xy} + # Prime the extruder before beginning the purge lines. + G92 E0.0 + # Move slowly during priming to prevent excessive blobbing + G1 X{"%.3f" % PRINT_MIN[0]} E{"%.3f" % km.start_purge_prime_length + } F{km.load_priming_speed} + G92 E0.0 + # Purge. + {% for n in range(purge_rows - 1) %} + {% set x_pos = PRINT_MIN[0] if n % 2 else PRINT_MAX[0] %} + DRAW_LINE_TO HEIGHT="{HEIGHT}" WIDTH="{WIDTH}" X="{x_pos}" Y="{ + WIDTH * n + y_start}" + DRAW_LINE_TO HEIGHT="{HEIGHT}" WIDTH="{WIDTH}" X="{x_pos}" Y="{ + WIDTH * (n + 1) + y_start}" + {% endfor %} + {% set x_pos = PRINT_MAX[0] if purge_rows % 2 else PRINT_MIN[0] %} + DRAW_LINE_TO HEIGHT="{HEIGHT}" WIDTH="{WIDTH}" X="{x_pos}" Y="{ + WIDTH * (purge_rows - 1) + y_start}" + G92 E0.0 diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/fans.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/fans.cfg new file mode 100644 index 0000000..363c7ae --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/fans.cfg @@ -0,0 +1,86 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro _check_fan_params] +gcode: + {% set MAXIMUM = params.MAXIMUM|default( + printer["gcode_macro set_fan_scaling"].maximum)|int %} + {% set MINIMUM = params.MINIMUM|default( + printer["gcode_macro set_fan_scaling"].minimum)|int %} + + {% if params.SCALE and params.SCALE|float <= 0 %} + { action_raise_error("SCALE must be a positive value.") } + {% elif MINIMUM < 0 or MINIMUM > 255 %} + { action_raise_error("MINIMUM must be between 0 and 255.") } + {% elif MAXIMUM < 0 or MAXIMUM > 255 %} + { action_raise_error("MAXIMUM must be between 0 and 255.") } + {% elif params.SPEED and (params.SPEED|int < 0 or params.SPEED|int > 255) %} + { action_raise_error("SPEED must be between 0 and 255.") } + {% elif params.BOOST and (params.BOOST|int < 0 or params.BOOST|int > 255) %} + { action_raise_error("BOOST must be between 0 and 255.") } + {% elif MINIMUM > MAXIMUM %} + { action_raise_error("MINIMUM must be less than or equal to MAXIMUM.") } + {% endif %} + +# Sets optional scaling factor, minimum, and maximum applied to M106 commmand. +# If a MINIMUM greater than 0 is specified the fan will not stop unless an +# M107 command is issued. SET_FAN_SCALING always displays the current paramaters +# if scaling is active. SET_FAN_SCALING without any arguments will display the +# current scaling parameters without changing them. +[gcode_macro set_fan_scaling] +description: Sets fan scaling factors applied to M106 command. If a speed is + provided it will be adjusted according to the scaling parameters. + Usage: SET_FAN_SCALING [SCALE=] [BOOST=] [MAXIMUM=] + [MINIMUM=] [SPEED=] +variable_scale: 1.0 +variable_boost: 0 +variable_minimum: 0 +variable_maximum: 255 +variable_real_speed: 0 +gcode: + _CHECK_FAN_PARAMS{% for k in params %}{' '~k~'='~params[k]}{% endfor %} + {% set SCALE = params.SCALE|default(scale)|float %} + {% set BOOST = params.BOOST|default(boost)|float %} + {% set MAXIMUM = params.MAXIMUM|default(maximum)|int %} + {% set MINIMUM = params.MINIMUM|default(minimum)|int %} + {% set SPEED = params.SPEED|default(real_speed)|int %} + + {% if SCALE != 1.0 or BOOST != 0 or MAXIMUM != 255 or MINIMUM != 0 %} + {action_respond_info("Fan: Scale: %.2f Minimum:%i Maximum: %i Speed: %i"| + format(SCALE, MINIMUM, MAXIMUM, SPEED))} + {% endif %} + + # Update parameters on change. + {% if params|length > 0 %} + SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=scale VALUE="{SCALE}" + SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=boost VALUE="{BOOST}" + SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=minimum VALUE="{MINIMUM}" + SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=maximum VALUE="{MAXIMUM}" + # Run fan at adusted speed + M106 S{SPEED} + {% endif %} + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.SCALE|default(1.0)|float %} + {% set dummy = params.BUMP|default(0)|int %} + {% set dummy = params.MAXIMUM|default(255)|int %} + {% set dummy = params.MINIMUM|default(0)|int %} + {% set dummy = params.SPEED|default(current speed)|int %} + " %} # End argument block for Mainsail + +[gcode_macro reset_fan_scaling] +description: Clears all fan scaling factors. + Usage: RESET_FAN_SCALING +gcode: + SET_FAN_SCALING SCALE=1.0 BOOST=0 MAXIMUM=255 MINIMUM=0 + +[gcode_macro m106] +description: Wraps M106 to implement scaling overrides. +rename_existing: M106.6245197 +gcode: + {% set S = params.S|default(255)|int %} + {% set scale = printer["gcode_macro set_fan_scaling"] %} + SET_GCODE_VARIABLE MACRO=set_fan_scaling VARIABLE=real_speed VALUE="{S}" + M106.6245197 S{((((S + scale.boost) * scale.scale) | round | int, + scale.minimum) | max, scale.maximum) | min} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/filament.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/filament.cfg new file mode 100644 index 0000000..fbfd713 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/filament.cfg @@ -0,0 +1,167 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro _load_unload] +gcode: + {% set saved_extruder = printer.toolhead.extruder %} + {% set EXTRUDER = params.EXTRUDER|default(saved_extruder)|lower %} + {% set km = printer["gcode_macro _km_globals"] %} + # Use the global min as default if provided, else use per extruder min + 5. + {% set default_minimum = km.load_min_temp if km.load_min_temp else + (printer.configfile.settings[EXTRUDER].min_extrude_temp + 5) %} + {% if 'MINIMUM' in params %} + {% set MINIMUM = params.MINIMUM|int %} + # This is the special case for a filament change after an idle timeout. + {% elif printer.pause_resume.is_paused and printer[EXTRUDER].target == 0 and + printer["gcode_macro resume"].saved_extruder_temp %} + {% set MINIMUM = printer["gcode_macro resume"].saved_extruder_temp %} + # Use the target temp if higher than the default. + {% elif printer[EXTRUDER].target > default_minimum %} + {% set MINIMUM = printer[EXTRUDER].target %} + {% else %} + {% set MINIMUM = default_minimum %} + {% endif %} + {% if MINIMUM < printer.configfile.settings[EXTRUDER].min_extrude_temp %} + { action_raise_error("Extrude below minimum temp.") } + {% elif printer.pause_resume.is_paused %} + # Clear the saved E if we're (un-)loading while paused. + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_e VALUE="{0.0}" + {% endif %} + {% set SPEED = params.SPEED|default(km.load_speed)|int %} + {% set priming_length = km.load_priming_length %} + {% set LENGTH = params.LENGTH|default(km.load_length)|float - priming_length%} + {% if LENGTH < 0 %} + {% set priming_length = (priming_length + LENGTH, 0)|max %} + {% set LENGTH = 0 %} + {% endif %} + SAVE_GCODE_STATE NAME=_KM_LOAD_UNLOAD + {% if EXTRUDER != saved_extruder%} + ACTIVATE_EXTRUDER EXTRUDER={EXTRUDER} + {% endif %} + _KM_PRINT_STATUS ACTION=PUSH_STATUS + {% if not printer.extruder.can_extrude or + printer[EXTRUDER].target < default_minimum %} + {action_respond_info("Preheating %s to %d" | format(EXTRUDER, MINIMUM))} + M109 S{MINIMUM} + {% endif %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS={"filament_load" + if params.LOAD|int else "filament_unload"} + M83 + {% set priming_speed = (km.load_priming_speed, SPEED)|min %} + {% if params.LOAD|int %} + G0 E{LENGTH} F{SPEED} + G0 E{priming_length} F{priming_speed} + G0 E{'%.4f' % -printer["gcode_macro resume"].saved_e} F{km.load_speed} + {% else %} + {% set pre_prime_distance = 5.0 %} + {% set shaping_moves = 5 %} + {% set shaping_distance = (shaping_moves * (1 + shaping_moves)/20) %} + # Push forward to heat up, then retract to the edge of the meltzone. + G0 E{pre_prime_distance} F{SPEED} + G4 P500 + G0 E{'%.4f' % -(priming_length - shaping_distance)} F{SPEED} + # Shape the tip with a pairs of short extrusions and retractions, where + # the retractions get increasingly longer than the extrusion. + {% for i in range(1, shaping_moves + 1) %} + G0 E2 F{priming_speed} + G0 E-{2 + (0.1 * i)} F{priming_speed} + {% endfor %} + # Retract the rest of the length. + G0 E{'%.4f' % -(LENGTH + pre_prime_distance)} F{SPEED} + {% endif %} + RESTORE_GCODE_STATE NAME=_KM_LOAD_UNLOAD + + # Beep on completion + _KM_BEEP_IF_AVAILABLE BEEPS={params.BEEPS|default(8)} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=pop_status + +# TODO: Fix casing after front-ends get fixed +[gcode_macro LOAD_FILAMENT] +description: Loads filament to the extruder. + Usage: LOAD_FILAMENT [LENGTH=] [SPEED=] + [EXTRUDER=] [MINIMUM=] + [BEEPS=] +gcode: + _LOAD_UNLOAD LOAD=1{% for k in params + %}{' '~k~'="'~params[k]~'"'}{% endfor %} + + # Dummy argument block for Mainsail + {% set dummy = None if True else " + M109 + {% set dummy = params.LENGTH|default(variable_load_length)|float %} + {% set dummy = params.SPEED|default(variable_load_speed)|float %} + {% set dummy = params.EXTRUDER|default(current extruder) %} + {% set dummy = params.MINIMUM|default(min_extrude_temp)|int %} + {% set dummy = params.BEEPS|default(10)|int %} + " %} # End argument block for Mainsail + +# TODO: Fix casing after front-ends get fixed +[gcode_macro UNLOAD_FILAMENT] +description: Unloads filament from the extruder. + Usage: UNLOAD_FILAMENT [LENGTH=] [SPEED=] + [EXTRUDER=] [MINIMUM=] + [BEEPS=] +gcode: + _LOAD_UNLOAD LOAD=0{% for k in params + %}{' '~k~'="'~params[k]~'"'}{% endfor %} + + # Dummy argument block for Mainsail + {% set dummy = None if True else " + M109 + {% set dummy = params.LENGTH|default(variable_load_length)|float %} + {% set dummy = params.SPEED|default(variable_load_speed)|float %} + {% set dummy = params.EXTRUDER|default(default extruder) %} + {% set dummy = params.MINIMUM|default(min_extrude_temp)|int %} + {% set dummy = params.BEEPS|default(10)|int %} + " %} # End argument block for Mainsail + +[gcode_macro _pause_inner_m700] +gcode: + {% set extruder = "extruder" ~ params.T|replace('0', '') + if "T" in params else printer.toolhead.extruder %} + {% if extruder != printer.toolhead.extruder%} + ACTIVATE_EXTRUDER EXTRUDER={extruder} + {% endif %} + + {% set z_param = (' Z="%f"' % params.Z) if 'Z' in params else "" %} + + {% if printer.idle_timeout.state|string == "Printing" %} + PAUSE B="{0}" P=2{z_param} + {% elif not printer.pause_resume.is_paused%} + PARK B="{0}" P=2{z_param} + {% endif %} + +[gcode_macro m701] +description: Pauses/parks the toolhead then loads filament to the extruder. + Usage: M701 [L] [Z] [T] +gcode: + {% if 'U' in params %} + {% if not 'L' in params %} + RESPOND TYPE=error MSG="Argument \"U\" substituted for missing \"L\"." + {% set dummy = params.__setitem__("L", params.U) %} + {% else %} + RESPOND TYPE=error MSG="Invalid argument \"U\" ignored." + {% endif %} + {% endif %} + + _PAUSE_INNER_M700 {% for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %} + LOAD_FILAMENT BEEPS="{10}" LENGTH={ + params.L|default(printer["gcode_macro _km_globals"].load_length)|float} + +[gcode_macro m702] +description: Pauses/parks the toolhead then unloads filament from the extruder. + Usage: M702 [U] [Z] [T] +gcode: + {% if 'L' in params %} + {% if not 'U' in params %} + RESPOND TYPE=error MSG="Argument \"L\" substituted for missing \"U\"." + {% set dummy = params.__setitem__("U", params.L) %} + {% else %} + RESPOND TYPE=error MSG="Invalid argument \"L\" ignored." + {% endif %} + {% endif %} + + _PAUSE_INNER_M700 {% for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %} + UNLOAD_FILAMENT BEEPS="{10}" LENGTH={ + params.U|default(printer["gcode_macro _km_globals"].load_length)|float} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/globals.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/globals.cfg new file mode 100644 index 0000000..39f59b8 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/globals.cfg @@ -0,0 +1,466 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +################################################################################ +# +# Declare any of the below variables in your own [gcode_macro _km_options] to +# to override the values here. +# +# DO NOT CHANGE ANYTHING IN THIS FILE!!! +# +# This file handles the initialization for all the macros, and difficult to +# diagnose errors will result from unexpected values or code changes. +# +################################################################################ +[gcode_macro _km_globals] +# Available bed surfaces for offset adjustments. +variable_bed_surface_max_name_length: 10 +# Available bed surfaces for offset adjustments. +variable_bed_surfaces: ['default'] +# Total length (in mm) of filament to load (bowden tubes will be much longer). +variable_load_length: 90.0 +# Global minimum extruder temp for loading (default: min_extrude_temp + 5). +variable_load_min_temp: 0 +# Length (in mm) of the extruder meltzone (feeds at priming speed). +variable_load_priming_length: 20.0 +# Filament priming speed (in mm/m). +variable_load_priming_speed: 200 +# Filament loading speed (in mm/m). +variable_load_speed: 1200 +# Set to False to hide the Octoprint LCD menus. +variable_menu_show_octoprint: True +# Set to False to hide the SD Card LCD menus. +variable_menu_show_sdcard: True +# List up to 10 pre-heat settings in order for the LCD "Temperature" menu +variable_menu_temperature: [ + {'name' : 'PLA', 'extruder' : 200, 'bed' : 60}, + {'name' : 'PETG', 'extruder' : 230, 'bed' : 85}, + {'name' : 'ABS', 'extruder' : 245, 'bed' : 110}] +# X position to park toolhead (set "max" or "min" to infer from stepper config). +variable_park_x: 0.0 +# Y position to park toolhead (set "max" or "min" to infer from stepper config). +variable_park_y: 0.0 +# Z position to park toolhead (set "max" or "min" to infer from stepper config). +variable_park_z: 20.0 +# Minimum printable XY coordinate. Defaults to X and Y position_min. +variable_print_min: () # example: (0, 0) +# Maximum printable XY coordinate. Defaults to X and Y position_max. +variable_print_max: () # example: (220, 220) +# Scaling factor for M900 command (negative values make M900 a no-op). +variable_pressure_advance_scale: -1.0 +# Additional padding around the specified print area for a bed mesh. +variable_probe_mesh_padding : 5.0 +# Minimum number of probes per axis for partial probing of a bed mesh. +variable_probe_min_count: 3 +# Scaling factor to increase probe count for partial bed probes. +variable_probe_count_scale: 1.0 +# Additional delay (in ms) during bed heating, to allow the bed to stabilize. +variable_start_bed_heat_delay: 2000 +# Amount (in degrees C) to overshoot bed target temp before stabilizing. +variable_start_bed_heat_overshoot: 2.0 +# Set to clear adjustments (e.g. feedrate, extrusion, heater) at end of print. +variable_start_clear_adjustments_at_end: True +# PRINT_END Y park position (set "max" or "min" to infer from stepper config). +variable_start_end_park_y: 0.0 # Defaults to print_max Y. +# Extruder scale factor during pre-warmup in PRINT_START. +variable_start_extruder_preheat_scale: 0.5 +# If non-zero the extruder will stabilize at this temp before probing the bed. +variable_start_extruder_probing_temp: 0 +# Set to rehome Z in PRINT_START after bed temp stabilizes; False to disable. +variable_start_home_z_at_temp: True +# Set to level bed in PRINT_START after bed temp stabilizes; False to disable. +variable_start_level_bed_at_temp: True +# Distance (in millimeters) between the purge lines and the print area. +variable_start_purge_clearance: 2.0 +# Length of filament (in millimeters) to purge at print start. +variable_start_purge_length: 0.0 # 30 is a good starting point. +# Length of filament (in millimeters) to prime before drawing purge lines. +variable_start_purge_prime_length: 12.0 +# Level gantry in PRINT_START after bed temp stabilizes; False to disable. +variable_start_quad_gantry_level_at_temp: True +# Maximum distance to relocate print in random XY location to reduce bed wear. +variable_start_random_placement_max: 0 +# The relocation will be at least this far from the printable edge of the bed. +variable_start_random_placement_padding: 10.0 +# Skip level and load saved mesh for current sheet (if found); False to disable. +variable_start_try_saved_surface_mesh: False +# Adjust Z tilt in PRINT_START after bed temp stabilizes; False to disable. +variable_start_z_tilt_adjust_at_temp: True +# X and Y travel speed (in mm/m) for movement macros. +variable_travel_speed_xy: 3000 +# Z travel speed in (mm/m) for movement macros. +variable_travel_speed_z: 600 +################################################################################ +description: Initializes our globals, including any _km_options overrides. +gcode: + # Doing a shutdown here is a bit aggressive, but if we're missing required + # sections then a lot of things could go very bad later. + # To minimize the annoyance we try to identify all the fatal errors at once. + # format is: + # key = required config section + # value[0] = required field in section + # value[1] = required string in field + # A "None" value means there's no required field + {% set required_sections = {"heater_bed" : None, + "extruder" : None, + "gcode_macro _km_options" : None, + "idle_timeout" : ("gcode", "_KM_IDLE_TIMEOUT"), + "pause_resume" : None, + "respond" : None, + "save_variables" : None, + "virtual_sdcard" : + ("on_error_gcode", "CANCEL_PRINT") + } %} + {% set warn_removed = { + "start_extruder_set_target_before_level" : + "The start_extruder_set_target_before_level option has been removed. " + "Use the start_extruder_probing_temp option instead to set a fixed " + "probing temperature.", + "start_gcode_before_print" : + "The start_gcode_before_print option has been removed. The same effect " + "can now be achieved by inserting custom gcode before the " + "_PRINT_START_PHASE_PURGE line in your slicer's start gcode, or by " + "wrapping the _PRINT_START_PHASE_PURGE macro. See the Slicer " + "Configuration section in the readme for more information.", + "velocity_decel_scale" : + "The velocity_decel_scale option has been removed. Klipper's input " + "shaping provides a superior mechanism for improving print quality " + "at higher speeds.", + } %} + {% set output = [] %} + {% for s in required_sections %} + {% set f = required_sections[s][0] if required_sections[s] else None %} + {% set v = required_sections[s][1] if required_sections[s] else None %} + {% if s not in printer.configfile.config %} + {% set dummy = output.append("Missing [%s] section.\n" | format(s)) %} + {% elif f and + (v not in printer.configfile.config[s][f]|default("")|upper) %} + {% set dummy = output.append("Missing %s in %s for [%s] section.\n" + | format(v, f, s)) %} + {% endif %} + {% endfor %} + {% if output %} + { action_emergency_stop(( + "required printer.cfg section(s) missing:\n" + ~ output | join("\n")) ~ + "See readme: https://github.com/jschuh/klipper-macros\x23klipper-setup") + } + {% endif %} + + # These are all set to their defaults based on config options: + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_level_bed_at_temp VALUE="{ + 1 if printer.bed_mesh is defined else 0}" + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_quad_gantry_level_at_temp VALUE="{ + 1 if printer.quad_gantry_level is defined else 0}" + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_z_tilt_adjust_at_temp VALUE="{ + 1 if printer.z_tilt is defined else 0}" + {% set toolhead = printer.toolhead %} + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=print_min VALUE="{ + (toolhead.axis_minimum.x, toolhead.axis_minimum.y)}" + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=print_max VALUE="{ + (toolhead.axis_maximum.x, toolhead.axis_maximum.y)}" + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_end_park_y VALUE="{ + toolhead.axis_maximum.y}" + {% set settings = printer.configfile.settings %} + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE=start_home_z_at_temp VALUE="{ + 1 if ("stepper_z" in settings and + settings.stepper_z.endstop_pin.split()|join("")|lower == + "probe:z_virtual_endstop") else 0}" + + {% set options = printer["gcode_macro _km_options"] %} + {% set km = printer["gcode_macro _km_globals"] %} + + # Allow placeholders for parking positions. + {% if options.park_x|default("")|string|lower == "min" %} + {% set dummy = options.__setitem__("park_x", + printer.configfile.settings.stepper_x.position_min) %} + {% elif options.park_x|default("")|string|lower == "max" %} + {% set dummy = options.__setitem__("park_x", + printer.configfile.settings.stepper_x.position_max) %} + {% endif %} + {% if options.park_y|default("")|string|lower == "min" %} + {% set dummy = options.__setitem__("park_y", + printer.configfile.settings.stepper_y.position_min) %} + {% elif options.park_y|default("")|string|lower == "max" %} + {% set dummy = options.__setitem__("park_y", + printer.configfile.settings.stepper_y.position_max) %} + {% endif %} + {% if options.start_end_park_y|default("")|string|lower == "min" %} + {% set dummy = options.__setitem__("start_end_park_y", + printer.configfile.settings.stepper_y.position_min) %} + {% elif options.start_end_park_y|default("")|string|lower == "max" %} + {% set dummy = options.__setitem__("start_end_park_y", + printer.configfile.settings.stepper_y.position_max) %} + {% endif %} + {% if options.park_z|default("")|string|lower == "min" %} + {% set dummy = options.__setitem__("park_z", + printer.configfile.settings.stepper_z.position_min) %} + {% elif options.park_z|default("")|string|lower == "max" %} + {% set dummy = options.__setitem__("park_z", + printer.configfile.settings.stepper_z.position_max) %} + {% endif %} + + # Force overrides to use the original types in _KM_GLOBALS. + {% for k in options %} + {% if k not in km %} + {% if k in warn_removed %} + {action_respond_info(warn_removed[k])} + {% else %} + {% set dummy = output.append("%s is not valid for _KM_OPTIONS." | + format(k)) %} + {% endif %} + {% elif km[k] is string %} + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k + } VALUE="'{options[k]|replace('\\','\\\\')|replace('\'','\\\'') + |replace('\"','\\\"')}'" + {% elif km[k] is float %} + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k + } VALUE="{options[k]|float}" + {% elif km[k] is integer or km[k] is boolean %} + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k} VALUE="{options[k]|int}" + {% elif km[k] is mapping %} + {% if options[k] is not mapping %} + {% set dummy = output.append("%s requires a mapping type." | + format(k)) %} + {% endif %} + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k + } VALUE="{options[k]|replace('\"','\\\"')}" + {% elif km[k] is sequence %} + {% if options[k] is not sequence %} + {% set dummy = output.append("%s requires a sequence type." | + format(k)) %} + {% endif %} + SET_GCODE_VARIABLE MACRO=_km_globals VARIABLE={k + } VALUE="{options[k]|replace('\"','\\\"')}" + {% else %} + {% set dummy = output.append("%s is not a valid type for _KM_OPTIONS." | + format(k)) %} + {% endif %} + {% endfor %} + + {% if "homing_override" in printer.configfile.config %} + {% for l in printer.configfile.config.homing_override.gcode.split("\n") %} + {% if " g28 " in (" " ~ l.split("\x23")[0].split(";")[0]|lower ~ " ") %} + {% set dummy = output.append( + "G28 in [homing_override] gcode. Replace with G28.6245197 to " + "fix recursive macro call.\n" + "See readme: https://github.com/jschuh/klipper-macros\x23g28") %} + {% endif %} + {% endfor %} + {% endif %} + SET_GCODE_VARIABLE MACRO=check_km_config VARIABLE=load_errors VALUE="{ + output|replace('\"','\\\"')}" + M400 + +[delayed_gcode INIT_GLOBALS] +# This runs once at startup and initializes all macros. +initial_duration: 1 +gcode: + LIST_MACROS SILENT=1 # Build the macro cache. + _KM_GLOBALS + # This needs to be its own macro so it gets evaluated after _KM_GLOBALS runs. + CHECK_KM_CONFIG + _INIT_SURFACES + BED_MESH_CHECK + # Sets the default drawing parameters. + SET_DRAW_PARAMS WIDTH="{printer.configfile.settings.extruder.nozzle_diameter}" + # This is any end-user gcode that need to run after macro initialization. + _KM_OPTIONS + _KM_PRINT_STATUS ACTION=CHANGE STATUS=ready + +[gcode_macro check_km_config] +variable_load_errors: [] +description: Checks global variables and throws an error on any invalid values. + Does nothing if the config has no errors. +gcode: + {% set km = printer["gcode_macro _km_globals"] %} + {% set toolhead = printer.toolhead %} + {% set output = load_errors %} + {% if km.park_x > toolhead.axis_maximum.x or + km.park_x < toolhead.axis_minimum.x %} + {% set dummy = output.append("park_x is invalid.") %} + {% endif %} + {% if km.park_y > toolhead.axis_maximum.y or + km.park_y < toolhead.axis_minimum.y %} + {% set dummy = output.append("park_y is invalid.") %} + {% endif %} + {% if km.park_z > toolhead.axis_maximum.z or + km.park_z < toolhead.axis_minimum.z %} + {% set dummy = output.append("park_z is invalid.") %} + {% endif %} + {% if km.print_max[0] > toolhead.axis_maximum.x or + km.print_max[1] > toolhead.axis_maximum.y %} + {% set dummy = output.append("print_max is invalid.") %} + {% endif %} + {% if km.print_min[0] < toolhead.axis_minimum.x or + km.print_min[1] < toolhead.axis_minimum.y %} + {% set dummy = output.append("print_min is invalid.") %} + {% endif %} + {% if km.start_extruder_preheat_scale > 1.0 or + km.start_extruder_preheat_scale < 0.0 %} + {% set dummy = output.append("extruder_preheat_scale is invalid.") %} + {% endif %} + {% if km.load_length > + printer.configfile.settings["extruder"].max_extrude_only_distance %} + {% set dummy = output.append( + "load_length exceeds max_extrude_only_distance.") %} + {% endif %} + {% if km.load_length < km.load_priming_length %} + {% set dummy = output.append( + "load_length is shorter than load_priming_length.") %} + {% endif %} + {% if km.load_length < 0.0 %} + {% set dummy = output.append("load_length is negative.") %} + {% endif %} + {% if km.load_priming_length < 0.0 %} + {% set dummy = output.append("load_priming_length is negative.") %} + {% endif %} + + # Emit all the config errors. + {% if output %} + { action_raise_error(output|sort|join('\nError: ')) } + {% endif %} + M400 + +[gcode_macro kmvars] +description: Lists global variables used by klipper-macros. + Usage: KMVARS [SEARCH=] +gcode: + {% set SEARCH = params.SEARCH|default(params.S|default(""))|lower %} + {% set km = printer["gcode_macro _km_globals"] %} + {% set output = [] %} + {% for k in km %} + {% if SEARCH in k %} + {% set dummy = output.append(k ~ ": " ~ km[k]) %} + {% endif %} + {% endfor %} + { action_respond_info(output|sort|join('\n')) } + +[gcode_macro check_macro_docs] +description: Lists macros lacking proper documentation. + Usage: CHECK_MACRO_DOCS [USAGE=<0|1>] [HIDDEN=<1|0>] [RENAMED=<1|0>] +gcode: + {% set USAGE = params.USAGE|default(0)|int %} + {% set HIDDEN = params.HIDDEN|default(0)|int %} + {% set RENAMED = params.RENAMED|default(0)|int %} + {% set output = [] %} + {%set config = printer.configfile.config %} + {% for k in config|sort %} + {% if k.startswith("gcode_macro") %} + {% set name = k.split()[1] %} + {% set desc = config[k].description|default("") %} + {% set is_renamed = config[k].rename_existing|default("") %} + {% if (not desc or (USAGE and not "Usage: "~name.upper() in desc)) and + (HIDDEN or not name.startswith('_')) and (RENAMED or is_renamed) %} + {% set dummy = output.append("%s %s: missing %s." + | format("*" if is_renamed else " ", name, + "description" if not desc else "usage")) %} + {% endif %} + {% endif %} + {% endfor %} + {action_respond_info(output|join("\n"))} + +# The below macro is a lightly edited version of the one found here: +# https://klipper.discourse.group/t/example-search-printer-objects/164 +[gcode_macro listvars] +description: Lists per-macro variables with a name containing SEARCH. This is + useful for debugging macros by allowing you to probe printer state. Be very + careful, however, as an overly broad SEARCH parameter can take a long time + to process and potentially hang or crash klipper. + Usage: LISTVARS SEARCH= +gcode: + + {% if 'SEARCH' not in params and 'S' not in params %} + { action_raise_error("Must provide a SEARCH parameter.") } + {% endif %} + {% set SEARCH = params.SEARCH|default(params.S)|lower %} + {% set ns = namespace() %} + {% set output = [] %} + {% for item in printer %} + {% if item is not string %} + {% set ns.path = ['printer', "[%s]" % (item|string), ''] %} + {% elif ' ' in item %} + {% set ns.path = ['printer', "['%s']" % (item), ''] %} + {% else %} + {% set ns.path = ['printer.', item, ''] %} + {% endif %} + + {% if SEARCH in ns.path|lower %} + {% set dummy = output.append(ns.path|join) %} + {% endif %} + + {% if printer[item].items() %} + {% for childkey, child in printer[item].items() recursive %} + {% set ns.path = ns.path[:loop.depth|int + 1] %} + {% if childkey is not string %} + {% set null = ns.path.append("[%s]" % (childkey|string)) %} + {% elif ' ' in childkey %} + {% set null = ns.path.append("['%s']" % (childkey)) %} + {% else %} + {% set null = ns.path.append(".%s" % (childkey)) %} + {% endif %} + + {% if child is mapping %} + {loop(child.items())} + {% else %} + {% if SEARCH in ns.path|lower %} + {% set dummy = output.append("%s : %s" % (ns.path|join, child)) %} + {% endif %} + {% endif %} + {% endfor %} + {% endif %} + {% endfor %} + { action_respond_info(output|join("\n")) } + +[gcode_macro list_macros] +description: Lists registered macros (and optionally show variable state). + Usage: LISTVARS SEARCH= VARS=<0|1> SILENT=<0|1> +variable_macros: {} +gcode: + # Load the config state once and save it. + {% if not macros %} + {% set renames = {} %} + {% for k in printer.configfile.config %} + {% if k.lower().startswith("gcode_macro") and + printer.configfile.config[k].rename_existing %} + {% set name = k.split(None, 1)[1] | lower %} + {% set dummy = renames.__setitem__(name, + [printer.configfile.config[k].rename_existing|lower] + + renames[name]|default([])) %} + {% endif %} + {% endfor %} + {% for k in printer %} + {% if k.lower().startswith("gcode_macro") %} + {% set name = k.split(None, 1)[1] | lower %} + {% set dummy = macros.__setitem__(name, renames[name]|default([])) %} + {% endif %} + {% endfor %} + {% endif %} + + {% if params.SILENT|default(0)|int == 0 %} + _LIST_MACROS_DISPLAY {rawparams} + {% endif %} + +[gcode_macro _list_macros_display] +gcode: + {% set SEARCH = params.SEARCH | default(params.S) | default("") | lower %} + {% set VARS = params.VARS | default(params.V) | default(0) | int != 0 %} + + {% set macros = printer["gcode_macro list_macros"].macros %} + {% set output = [] %} + {% for k in macros %} + {% if SEARCH in k | lower %} + {% set line = k ~ ((" (renames: %s)" % (macros[k]|join(","))) if macros[k] + else "") %} + {% set outvars = [] %} + {% if VARS %} + {% for v in printer["gcode_macro " ~ k] | sort %} + {% set dummy = outvars.append("\n* %s: %s" % + (v, printer["gcode_macro " ~ k][v]|string)) %} + {% endfor %} + {% endif %} + {% set dummy = output.append(line + outvars | join("")) %} + {% endif %} + {% endfor %} + { action_respond_info(output | sort | join("\n")) } diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/heaters.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/heaters.cfg new file mode 100644 index 0000000..5a96ac5 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/heaters.cfg @@ -0,0 +1,245 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro set_heater_temperature_scaled] +gcode: + {% set HEATER = params.HEATER.lower() %} + {% set TARGET = params.TARGET|default(0.0)|float %} + {% set scaled_heaters = + printer["gcode_macro set_heater_scaling"].scaled_heaters %} + {% if HEATER in scaled_heaters %} + {% set scales = scaled_heaters[HEATER] %} + {% set dummy = scales.__setitem__("real_target", TARGET) %} + {%if TARGET > 0.0 %} + {% set TARGET = (((TARGET + scales.bump) * scales.scale, scales.minimum) + | max, scales.maximum)|min %} + {% endif %} + {% endif %} + SET_HEATER_TEMPERATURE HEATER="{HEATER}" TARGET={TARGET} + +[gcode_macro temperature_wait_scaled] +gcode: + {% set SENSOR = params.SENSOR.lower() %} + {% set heater = SENSOR if not SENSOR.startswith("heater_generic") else + SENSOR.split()[1] %} + {% set scaled_heaters = + printer["gcode_macro set_heater_scaling"].scaled_heaters %} + {% if heater in scaled_heaters %} + {% set scales = scaled_heaters[heater] %} + {% if "MINIMUM" in params and MINIMUM > 0.0 %} + {% set MINIMUM = (((MINIMUM + scales.bump) * scales.scale, scales.minimum) + | max, scales.maximum)|min %} + {% endif %} + {% if "MAXIMUM" in params and MAXIMUM > 0.0 %} + {% set MAXIMUM = (((MAXIMUM + scales.bump) * scales.scale, scales.minimum) + | max, scales.maximum)|min %} + {% endif %} + {% else %} + {% set settings = printer.configfile.settings[SENSOR] %} + {% set MINIMUM = params.MINIMUM|default(settings.min_temp) %} + {% set MAXIMUM = params.MAXIMUM|default(settings.max_temp) %} + {% endif %} + {% if printer[sensor].temperature < MINIMUM or + printer[sensor].temperature > MAXIMUM %} + TEMPERATURE_WAIT SENSOR="{SENSOR}" MINIMUM={MINIMUM} MAXIMUM={MAXIMUM} + {% endif %} + +[gcode_macro _gcode_wait_wrapper_inner] +gcode: + # Macro variables are evaluated at instantiation, so this inner macro is what + # gets us a scaled target value. + {% set sensor = params.HEATER if params.HEATER in + printer.heaters.available_heaters + else ("heater_generic " ~ params.HEATER) %} + {% set target = printer[sensor].target %} + {% if 'R' in params and target > 0.0 %} + {% set T = params.T|default("") %} + M{params.M}.6245197 S{target} { (" T"~T) if T else "" } + {% elif printer[sensor].temperature < target %} + TEMPERATURE_WAIT SENSOR="{sensor}" MINIMUM={target} + {% endif %} + +[gcode_macro _gcode_wait_wrapper] +gcode: + {% set target = params.S | default(params.R | default(0))| float %} + SET_HEATER_TEMPERATURE_SCALED HEATER="{params.HEATER}" TARGET={target} + _GCODE_WAIT_WRAPPER_INNER{% + for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %} + +[gcode_macro m109] +rename_existing: M109.6245197 +gcode: + {% set extruder = "extruder" ~ params.T|replace('0', '') + if "T" in params else printer.toolhead.extruder %} + _KM_PRINT_STATUS ACTION=PUSH_STATUS + _KM_PRINT_STATUS ACTION=CHANGE STATUS=extruder_heating + _GCODE_WAIT_WRAPPER HEATER={extruder}{% + for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=pop_status + +[gcode_macro m190] +rename_existing: M190.6245197 +gcode: + _KM_PRINT_STATUS ACTION=PUSH_STATUS + _KM_PRINT_STATUS ACTION=CHANGE STATUS=bed_heating + _GCODE_WAIT_WRAPPER HEATER=heater_bed {% + for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=pop_status + +[gcode_macro m191] +description: Sets chamber temperature (with wait for heating). + Usage: M191 [S] +gcode: + # Just fake the R parameter for the chamber. + {% if "R" in params %} + {% set dummy = params.__setitem__("S", params.R) %} + {% endif %} + _KM_PRINT_STATUS ACTION=PUSH_STATUS + _KM_PRINT_STATUS ACTION=CHANGE STATUS=chamber_heating + _GCODE_WAIT_WRAPPER HEATER=chamber {% + for k in params %}{' '~k~'="'~params[k]~'"'}{% endfor %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=pop_status + +[gcode_macro m104] +rename_existing: M104.6245197 +gcode: + {% set extruder = "extruder" ~ params.T|replace('0', '') + if "T" in params else printer.toolhead.extruder %} + SET_HEATER_TEMPERATURE_SCALED HEATER={extruder} TARGET={params.S|default(0)} + +[gcode_macro m140] +rename_existing: M140.6245197 +gcode: + SET_HEATER_TEMPERATURE_SCALED HEATER=heater_bed TARGET={params.S|default(0)} + +[gcode_macro m141] +description: Sets chamber temperature. + Usage: M141 [S] +gcode: + SET_HEATER_TEMPERATURE_SCALED HEATER=chamber TARGET={params.S|default(0)} + +[gcode_macro _check_heater_params] +gcode: + {% set HEATER = params.HEATER|lower %} + {% set sensor = params.HEATER %} + {% if HEATER not in printer.heaters.available_heaters %} + {% set sensor = "heater_generic " ~ HEATER %} + {% if sensor not in printer.heaters.available_heaters %} + { action_raise_error("The value '%s' is not valid for HEATER" + | format(HEATER)) } + {% endif %} + {% endif %} + {% set settings = printer.configfile.settings[sensor] %} + {% set scaled_heaters = + printer["gcode_macro set_heater_scaling"].scaled_heaters %} + {% if HEATER is in scaled_heaters %} + {% set scales = scaled_heaters[HEATER] %} + {% else %} + {% set scales = { "scale": 1.0, "bump": 0.0, "minimum": settings.min_temp, + "maximum": settings.max_temp, + "real_target": printer[sensor].target} %} + {% endif %} + {% set SCALE = params.SCALE|default(scales.scale)|float %} + {% set BUMP = params.BUMP|default(scales.bump)|float %} + {% set MINIMUM = params.MINIMUM|default(scales.minimum)|float %} + {% set MAXIMUM = params.MAXIMUM|default(scales.maximum)|float %} + + {% if SCALE <= 0 %} + { action_raise_error("SCALE must be a positive value.") } + {% elif MINIMUM < settings.min_temp or MINIMUM > settings.max_temp %} + { action_raise_error("MINIMUM must be between %.1f and %.1f" | + format(settings.min_temp, settings.max_temp)) } + {% elif MAXIMUM < settings.min_temp or MAXIMUM > settings.max_temp %} + { action_raise_error("MAXIMUM must be between %.1f and %.1f" | + format(settings.min_temp, settings.max_temp)) } + {% elif MINIMUM >= MAXIMUM %} + { action_raise_error("MINIMUM must be less than MAXIMUM.") } + {% elif "TARGET" in params and (params.TARGET|float < MINIMUM or + params.TARGET|float > MAXIMUM) %} + { action_raise_error("TARGET must be between %.1f and %.1f" | + format(settings.min_temp, settings.max_temp)) } + {% endif %} + +[gcode_macro set_heater_scaling] +description: Sets scaling parameters for heater. If a new target temperature is + passed it will be adjusted to the scaling parameters. + Usage: SET_HEATER_SCALING [HEATER=] [SCALE=] + [BUMP=] [MAXIMUM=] + [MINIMUM=] [TARGET=] +variable_scaled_heaters: {} +gcode: + # If no heater is supplied just list out all the scaled heaters. + {% if "HEATER" is not in params %} + {% set output = [] %} + {% for h in scaled_heaters %} + {% set dummy = output.append( + "%s: Scale: %.2f Bump: %.1f Minimum:%.1f Maximum: %.1f" + | format(h, scaled_heaters[h].scale, scaled_heaters[h].bump, + scaled_heaters[h].minimum, scaled_heaters[h].maximum)) %} + {% endfor %} + {% if output %}}{action_respond_info(output|join('\n'))}{% endif %} + {% else %} + # See if we need a new scaling entry for this heater. + {% set HEATER = params.HEATER.lower() %} + {% set settings = printer.configfile.settings[HEATER] %} + {% if HEATER is not in scaled_heaters %} + {% set dummy = scaled_heaters.__setitem__(HEATER, {"scale": 1.0, + "bump": 0.0, "minimum": settings.min_temp, + "maximum": settings.max_temp, + "real_target": printer[HEATER].target}) %} + {% endif %} + _CHECK_HEATER_PARAMS{% for k in params %}{' '~k~'='~params[k]}{% endfor %} + {% set scales = scaled_heaters[HEATER] %} + {% set SCALE = params.SCALE|default(scales.scale)|float %} + {% set BUMP = params.BUMP|default(scales.bump)|float %} + {% set MAXIMUM = params.MAXIMUM|default(scales.maximum)|float %} + {% set MINIMUM = params.MINIMUM|default(scales.minimum)|float %} + {% set TARGET = params.TARGET|default(scales.real_target)|float %} + {% set dummy = scales.__setitem__("scale", SCALE) %} + {% set dummy = scales.__setitem__("bump", BUMP) %} + {% set dummy = scales.__setitem__("maximum", MAXIMUM) %} + {% set dummy = scales.__setitem__("minimum", MINIMUM) %} + {% set dummy = scales.__setitem__("real_target", TARGET) %} + + {% set settings = printer.configfile.settings[HEATER] %} + {% if SCALE != 1.0 or BUMP != 0.0 or MINIMUM != settings.min_temp or + MAXIMUM != settings.max_temp %} + {% set dummy = scaled_heaters.__setitem__(HEATER, scales) %} + {% else %} # Remove a redundant scaling entry. + {% set dummy = scaled_heaters.__delitem__(HEATER) %} + {% endif %} + SET_HEATER_TEMPERATURE_SCALED HEATER={HEATER} TARGET={TARGET} + {action_respond_info( + "%s: Scale: %.2f Bump: %.1f Minimum:%.1f Maximum: %.1f Target: %.1f" + | format(HEATER, SCALE, BUMP, MINIMUM, MAXIMUM, TARGET))} + {% endif %} + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.HEATER|default(e.g. extruder) %} + {% set dummy = params.SCALE|default(1.0)|float %} + {% set dummy = params.BUMP|default(0.0)|float %} + {% set dummy = params.MAXIMUM|default(max_temp)|float %} + {% set dummy = params.MINIMUM|default(min_temp)|float %} + {% set dummy = params.TARGET|default(current target)|float %} + " %} # End argument block for Mainsail + +[gcode_macro reset_heater_scaling] +description: Clears scaling for heater (or all heaters if none specified). + Usage: RESET_HEATER_SCALING [HEATER=] +gcode: + {% if "HEATER" in params %} + {% set HEATER = params.HEATER.lower() %} + {% if HEATER not in printer.heaters.available_heaters %} + { action_raise_error("The value '%s' is not valid for HEATER" + | format(HEATER)) } + {% endif %} + {% set settings = printer.configfile.settings[HEATER] %} + SET_HEATER_SCALING HEATER={HEATER + } SCALE=1.0 BUMP=0.0 MINIMUM={settings.min_temp + } MAXIMUM={settings.max_temp} + {% else %} + # Clear everything if no heater was provided. + SET_GCODE_VARIABLE MACRO=set_heater_scaling VARIABLE=scaled_heaters VALUE={ + "{}"} + {% endif %} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/idle.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/idle.cfg new file mode 100644 index 0000000..388ae34 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/idle.cfg @@ -0,0 +1,17 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro _km_idle_timeout] +gcode: + {% if printer.pause_resume.is_paused %} + {action_respond_info("Extruder powered down on idle timeout.")} + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_extruder_temp VALUE="{ + printer[printer.toolhead.extruder].target}" + M104; Turn off extruder but leave the bed on. + {% else %} + TURN_OFF_HEATERS + M107; turn off fan + M84 + _KM_PRINT_STATUS ACTION=CHANGE STATUS=ready + {% endif %} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/kinematics.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/kinematics.cfg new file mode 100644 index 0000000..b0cd346 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/kinematics.cfg @@ -0,0 +1,67 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro _check_kinematic_limits] +gcode: + {% set toolhead = printer.toolhead %} + {% if params.X and (params.X|float < toolhead.axis_minimum.x or + params.X|float > toolhead.axis_maximum.x) %} + {action_raise_error("X[%.3f] must be between %.3f and %.3f." + | format(params.X|float, toolhead.axis_minimum.x, + toolhead.axis_maximum.x))} + {% elif params.Y and (params.Y|float < toolhead.axis_minimum.y or + params.Y|float > toolhead.axis_maximum.y) %} + {action_raise_error("Y[%.3f] must be between %.3f and %.3f." + | format(params.Y|float, toolhead.axis_minimum.y, + toolhead.axis_maximum.y))} + {% elif params.Z and (params.Z|float < toolhead.axis_minimum.z or + params.Z|float > toolhead.axis_maximum.z) %} + {action_raise_error("Z[%.3f] must be between %.3f and %.3f." + | format(params.Z|float, toolhead.axis_minimum.z, + toolhead.axis_maximum.z))} + {% elif params.E and (params.E|float|abs > printer.configfile.settings[ + "extruder"].max_extrude_only_distance) %} + {action_raise_error("E[%.4f] exceeds max_extrude_only_distance[%.4f]." + | format(params.E|float|abs, printer.configfile.settings[ + "extruder"].max_extrude_only_distance))} + {% endif %} + +[gcode_macro lazy_home] +description: Homes the specified axes. If lazy is true, already homed axes + are skipped. + Usage: LAZY_HOME [LAZY=<1|0>] [AXES=] +gcode: + # This is split apart so we can force the macro rename cache to be ready. + LIST_MACROS SILENT=1 + _LAZY_HOME_INNER {rawparams} + +[gcode_macro _lazy_home_inner] +gcode: + # Find the real g28 command. + {% set G28 = (printer["gcode_macro list_macros"].macros.g28| + default(["g28"],True))[-1] %} + {% set axes = 'XYZ'|select('in', params.AXES|default("XYZ")|upper|list) %} + {% if not axes %} # No axes means home everything. + {% set axes = 'XYZ' %} + {% endif %} + {% if params.LAZY|default(1)|int %} # Prune out the already homed axes. + {% set axes = axes|reject('in', printer.toolhead.homed_axes|upper)|join() %} + {% endif %} + + {% if axes %} + _KM_PRINT_STATUS ACTION=PUSH_STATUS + _KM_PRINT_STATUS ACTION=CHANGE STATUS=homing + {G28}{% for k in axes %}{' ' ~ k}{% endfor %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=pop_status + {% endif %} + +[gcode_macro g28] +description: Wraps the G28 command to add the Marlin "O" parameter so that + already homed axes will not be homed again. See the Klipper documentation on + G28 for the behavior of the other parameters. + Usage: G28 [O] ... +rename_existing: G28.6245197 +gcode: + {% set axes = 'XYZ'|select('in', params)|join() %} + LAZY_HOME LAZY={('O' in params)|int}{%if axes%} AXES={axes}{%endif%} \ No newline at end of file diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/layers.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/layers.cfg new file mode 100644 index 0000000..feb0228 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/layers.cfg @@ -0,0 +1,411 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro before_layer_change] +description: Add this to the "before layer change" input box in the slicer. + Usage: BEFORE_LAYER_CHANGE HEIGHT= LAYER= +gcode: + {% set height = params.HEIGHT|default(printer.toolhead.position.z)|float %} + {% set layer = params.LAYER|default(-1)|int + 1 %} + {% if height >= 0.0 and layer >= 0 %} + SET_PRINT_STATS_INFO CURRENT_LAYER="{layer}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=cur_height VALUE="{height}" + {% if printer["gcode_macro _km_layer_run"].clearance_z < height %} + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=clearance_z VALUE="{ + height}" + {% endif %} + {% endif %} + +[gcode_macro after_layer_change] +description: Add this to the "after layer change" input box in the slicer. + Usage: AFTER_LAYER_CHANGE +gcode: + _KM_LAYER_RUN + +[gcode_macro gcode_at_layer] +description: Schedules the specified g-code command to be run at the specified + layer. LAYER=next will cause the command to run at the next layer change. + Usage: GCODE_AT_LAYER { HEIGHT= | LAYER= } COMMAND= + [CANCEL=<0|1>] +gcode: + {% set tot_layers = printer.print_stats.info.total_layer %} + {% if params|length > 0 %} + _KM_CHECK_IS_PRINTING + + {% set CANCEL = params.CANCEL|default(0)|int != 0 %} + {% set COMMAND = params.COMMAND|default(None) %} + {% if COMMAND %} # This makes it easier to match commands for cancellation. + {% set COMMAND = COMMAND.lstrip().split(None, 1) %} + {% set COMMAND = " ".join([COMMAND[0]|upper] + COMMAND[1:]) %} + {% endif %} + + {% if "LAYER" in params %} + {% set cmd_container = "commands_layer" %} + {% set cur_layer = printer.print_stats.info.current_layer|int %} + {% if "HEIGHT" in params %} + {action_raise_error("Conflicting HEIGHT and LAYER arguments provided.")} + {% elif params.LAYER|string|lower == "next" %} + {% set LAYER = cur_layer + 1 %} + {% else %} + {% set LAYER = params.LAYER|int %} + {% endif %} + {% if LAYER <= cur_layer %} + {action_raise_error("LAYER[%i] must be above current print layer[%i]." + | format(LAYER, cur_layer))} + {% elif tot_layers and LAYER > tot_layers %} + {action_raise_error("LAYER[%i] must not be above top layer[%i]." + | format(LAYER, tot_layers))} + {% endif %} + {% set key = LAYER %} + + {% elif "HEIGHT" in params %} + {% set cmd_container = "commands_height" %} + {% set HEIGHT = params.HEIGHT|float %} + {% set cur_height = printer["gcode_macro _km_layer_run"].cur_height %} + {% if HEIGHT <= cur_height %} + {action_raise_error( + "HEIGHT[%.3f] must be above current print height[%.3f].") + | format(HEIGHT, cur_height)} + {% elif HEIGHT >= printer.toolhead.axis_maximum.z %} + {action_raise_error( + "HEIGHT[%.3f] must be below maximum Z height[%.3f].") + | format(HEIGHT, printer.toolhead.axis_maximum.z)} + {% endif %} + {% set key = HEIGHT %} + + {% else %} + {action_raise_error("No HEIGHT or LAYER argument provided.")} + {% endif %} + + {% set commands = printer["gcode_macro _km_layer_run"][cmd_container] %} + {% if key not in commands and not CANCEL %} + {% set dummy = commands.__setitem__(key, []) %} + {% endif %} + + {% if CANCEL %} + {% if key in commands %} + {% set pos = ("%i"|format(key)) if key is integer else + ("%.3fmm"|format(key)) %} + {% if COMMAND %} + {% set dummy = commands[key].remove(COMMAND) %} + {% if commands[key]|length == 0 %} + {% set dummy = commands.__delitem__(key) %} + {% endif %} + {action_respond_info("Cancelled %s %s:\n* %s" | + format("layer" if k is integer else "height", + pos, COMMAND))} + {% else %} + {% set dummy = commands.__delitem__(key) %} + {action_respond_info("Cancelled all commands at %s %s." | + format("layer" if k is integer else "height", + pos))} + {% endif %} + {% endif %} + {% elif not COMMAND %} + {action_raise_error("No COMMAND argument provided.")} + {% elif COMMAND in commands[key] %} + {action_raise_error("Duplicate command previously scheduled.")} + {% else %} + {% set dummy = commands[key].append(COMMAND) %} + {% set pos = ("%i"|format(key)) if key is integer else + ("%.3fmm"|format(key)) %} + {action_respond_info("%s %s:\n* %s" | + format("layer" if key is integer else "height", + pos, COMMAND))} + {% endif %} + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE={cmd_container} VALUE="{ + commands|replace('\"','\\\"')}" + _UPDATE_LAYER_COMPAT + + # No arguments means just list all the triggers. + {% else %} + {% set output = [] %} + {% set commands = printer["gcode_macro _km_layer_run"].commands_layer %} + {% for key in commands|list|sort %} + {% set dummy = output.append("layer %i:" | format(key)) %} + {% for c in commands[key] %} + {% set dummy = output.append("* %s" | format(c)) %} + {% endfor %} + {% endfor %} + {% set commands = printer["gcode_macro _km_layer_run"].commands_height %} + {% for key in commands|list|sort %} + {% set dummy = output.append("height %.3fmm:" | format(key)) %} + {% for c in commands[key] %} + {% set dummy = output.append("* %s" | format(c)) %} + {% endfor %} + {% endfor %} + {action_respond_info(output|join('\n'))} + {% endif %} + +[gcode_macro _km_layer_run] +description: Runs pending commands for the current layer change. + Usage: _KM_LAYER_RUN +variable_cur_height: 0.0 +variable_clearance_z: 0.0 +variable_commands_layer: {} +variable_commands_height: {} +gcode: + {% set cur_layer = printer.print_stats.info.current_layer %} + {% for key in commands_layer | select("<=", cur_layer) | sort %} + {action_respond_info("Executing scheduled commands at layer %d:\n%s" | + format(key, commands_layer[key]|join('\n')))} + {% for c in commands_layer[key] %} + {c} + {% endfor %} + {% set dummy = commands_layer.__delitem__(key) %} + {% endfor %} + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands_layer VALUE="{ + commands_layer|replace('\"','\\\"')}" + {% for key in commands_height | select("<=", cur_height) | sort %} + {action_respond_info("Executing scheduled commands at height %.3f:\n%s" | + format(key, commands_height[key]|join('\n')))} + {% for c in commands_height[key] %} + {c} + {% endfor %} + {% set dummy = commands_height.__delitem__(key) %} + {% endfor %} + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands_height VALUE="{ + commands_height|replace('\"','\\\"')}" + _UPDATE_LAYER_COMPAT + +[gcode_macro init_layer_gcode] +description: Clears scheduled gcode commands and state for all layers. + Usage: INIT_LAYER_GCODE LAYERS= +gcode: + SET_PRINT_STATS_INFO TOTAL_LAYER="{params.LAYERS|int + 1}" CURRENT_LAYER="{0}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=cur_height VALUE="{0.0}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=clearance_z VALUE="{0.0}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands_layer VALUE="{{}}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands_height VALUE="{{}}" + _UPDATE_LAYER_COMPAT + +[gcode_macro _reset_layer_gcode] +description: Clears scheduled gcode commands and state for all layers. + Usage: _RESET_LAYER_GCODE +gcode: + SET_PRINT_STATS_INFO TOTAL_LAYER="{0}" CURRENT_LAYER="{0}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=cur_height VALUE="{0.0}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=clearance_z VALUE="{0.0}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands_layer VALUE="{{}}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands_height VALUE="{{}}" + _UPDATE_LAYER_COMPAT + +[gcode_macro cancel_all_layer_gcode] +description: Clears all scheduled gcode commands. + Usage: CANCEL_ALL_LAYER_GCODE +gcode: + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands_layer VALUE="{{}}" + SET_GCODE_VARIABLE MACRO=_km_layer_run VARIABLE=commands_height VALUE="{{}}" + _UPDATE_LAYER_COMPAT + +# +# Begin Mainsail/Fluidd compat +# + +[gcode_macro SET_PAUSE_NEXT_LAYER] +description: Enable a pause if the next layer is reached +gcode: + _KM_CHECK_IS_PRINTING + {% set pause_next_layer = + printer['gcode_macro SET_PRINT_STATS_INFO'].pause_next_layer %} + {% set ENABLE = params.ENABLE | default(1) | int != 0 %} + {% set MACRO = params.MACRO | default(pause_next_layer.call, True) %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VALUE="{ + { 'enable': False, 'call': MACRO }}" VARIABLE=pause_next_layer + GCODE_AT_LAYER COMMAND="{MACRO|replace('\"','\\\"') + }" CANCEL="{0 if ENABLE else 1}" LAYER="next" + +[gcode_macro SET_PAUSE_AT_LAYER] +description: Enable/disable a pause if a given layer number is reached +gcode: + _KM_CHECK_IS_PRINTING + {% set pause_at_layer = + printer['gcode_macro SET_PRINT_STATS_INFO'].pause_at_layer %} + # This enable logic is copied directly from Fluidd/Mainsail. + {% set ENABLE = params.ENABLE | int != 0 if params.ENABLE is defined else + params.LAYER is defined %} + {% set LAYER = params.LAYER | + default((pause_at_layer.layer|int, + printer.print_stats.info.current_layer|int + 1)|max)%} + {% set MACRO = params.MACRO | default(pause_at_layer.call, True) %} + + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{ + { 'enable': False, 'layer': 0, 'call': MACRO }}" + {% if ENABLE and pause_at_layer.enable %} + # Remove the previously scheduled command if we're replacing it. + GCODE_AT_LAYER COMMAND="{pause_at_layer.call|replace('\"','\\\"') + }" CANCEL="{1}" LAYER="{pause_at_layer.layer}" + {% endif %} + # Add the new command. + GCODE_AT_LAYER COMMAND="{MACRO|replace('\"','\\\"') + }" CANCEL="{0 if ENABLE else 1}" LAYER="{LAYER}" + +[gcode_macro SET_PRINT_STATS_INFO] +rename_existing: _KM_SET_PRINT_STATS_INFO +description: Overwrite, to get pause_next_layer and pause_at_layer feature +variable_pause_next_layer: { 'enable': False, 'call': "PAUSE" } +variable_pause_at_layer : { 'enable': False, 'layer': 0, 'call': "PAUSE" } +gcode: + _KM_SET_PRINT_STATS_INFO {rawparams} + +[gcode_macro _update_layer_compat] +gcode: + {% set next_layer = printer.print_stats.info.current_layer|int + 1 %} + {% set commands_layer = printer["gcode_macro _km_layer_run"].commands_layer %} + {% set keys = commands_layer | sort(reverse=True) %} + + {% set pause_next_layer = {'enable': False, 'call': + printer['gcode_macro SET_PRINT_STATS_INFO'].pause_next_layer.call} %} + {% if pause_next_layer.call in commands_layer[next_layer] | default([]) %} + {% set dummy = pause_next_layer.__setitem__('enable', True) %} + {% endif %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{ + pause_next_layer|replace('\"','\\\"') }" + + # Don't just make pause_at_layer a copy of pause_next_layer. + {% set pause_at_layer = {'enable': False, 'layer': 0, 'call': + printer['gcode_macro SET_PRINT_STATS_INFO'].pause_at_layer.call} %} + {% if pause_next_layer.enable and + pause_next_layer.call == pause_at_layer.call %} + {% set keys = keys | reject("==", next_layer) %} + {% endif %} + + # We iterate through the entire reverse sorted key list because Jinja2 doesn't + # have a filter for dict values. It's ugly, but there should be only a few + # items in the dict. + {% for key in keys %} + {% if pause_at_layer.call in commands_layer[key] %} + {% set dummy = pause_at_layer.__setitem__('enable', True) %} + {% set dummy = pause_at_layer.__setitem__('layer', key) %} + {% endif %} + {% endfor %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{ + pause_at_layer|replace('\"','\\\"') }" + +# +# End Mainsail/Fluidd compat +# + +[gcode_macro pause_next_layer] +description: Convenience macro to schedule the current print to pause at the + next layer change. See PAUSE for additional arguments. + Usage: PAUSE_NEXT_LAYER ... +gcode: + _CHECK_KINEMATIC_LIMITS{% for k in params%}{' ' ~k~ '=' ~ params[k] + }{% endfor %} + GCODE_AT_LAYER LAYER=NEXT COMMAND="PAUSE{% for k in params %}{ + ' ' ~ k ~ '=' ~ params[k]}{% endfor %}" + +[gcode_macro pause_at_layer] +description: Convenience macro to schedule the current print to pause at the + specified layer change. LAYER=next will cause the command to run at the next + layer change. See PAUSE for additional arguments. + Usage: PAUSE_AT_LAYER { HEIGHT= | LAYER= } ... +gcode: + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.LAYER|default(layer number)|float %} + {% set dummy = params.HEIGHT|default(Z height)|int %} + " %} # End argument block for Mainsail + {% set filtered_params = params|reject('in',['HEIGHT','LAYER'])|list|sort %} + _CHECK_KINEMATIC_LIMITS{% for k in filtered_params%}{' ' ~k~ '=' ~ params[k] + }{% endfor %} + GCODE_AT_LAYER {% for k in params|select('in',['HEIGHT','LAYER'])|list %}{ + ' ' ~ k ~ '=' ~ params[k] }{% endfor + %} COMMAND="PAUSE{% for k in filtered_params %}{ + ' ' ~ k ~ '=' ~ params[k]}{% endfor %}" + +[gcode_macro speed_at_layer] +description: Convenience macro to schedule a feedrate adjustment at the + specified layer change. LAYER=next will cause the command to run at the next + layer change. (SPEED parameter behaves the same as the M220 S parameter.) + Usage: SPEED_AT_LAYER { HEIGHT= | LAYER= } SPEED= +gcode: + {% set SPEED = params.SPEED|default(0)|int %} + {% if SPEED < 1 or SPEED > 500 %} + {action_raise_error("SPEED[%i] parameter between 1 and 500 is required." + % SPEED)} + {% endif %} + GCODE_AT_LAYER {% for k in params|select('in',['HEIGHT','LAYER'])|list %}{ + ' ' ~ k ~ '=' ~ params[k] }{% endfor %} COMMAND="M220 S{SPEED|int}" + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.LAYER|default(layer number)|float %} + {% set dummy = params.HEIGHT|default(Z height)|int %} + {% set dummy = params.SPEED|default(percentage)|int %} + " %} # End argument block for Mainsail + +[gcode_macro flow_at_layer] +description: Convenience macro to schedule a flow percentage adjustment at the + specified layer change. LAYER=next will cause the command to run at the next + layer change. (FLOW parameter behaves the same as the M221 S parameter.) + Usage: FLOW_AT_LAYER { HEIGHT= | LAYER= } FLOW= +gcode: + {% set FLOW = params.FLOW|default(0)|int %} + {% if FLOW < 1 or FLOW > 500 %} + {action_raise_error("FLOW[%i] parameter between 1 and 500 is required." + % FLOW)} + {% endif %} + GCODE_AT_LAYER {% for k in params|select('in',['HEIGHT','LAYER'])|list %}{ + ' ' ~ k ~ '=' ~ params[k] }{% endfor %} COMMAND="M221 S{FLOW|int}" + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.LAYER|default(layer number)|float %} + {% set dummy = params.HEIGHT|default(Z height)|int %} + {% set dummy = params.FLOW|default(percentage)|int %} + " %} # End argument block for Mainsail + +[gcode_macro fan_at_layer] +description: Convenience macro to schedule a fan adjustment at the specified + layer change. LAYER=next will cause the command to run at the next layer + change. See SET_FAN_SCALING for additional arguments. + Usage: FAN_AT_LAYER { HEIGHT= | LAYER= } ... +gcode: + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.LAYER|default(layer number)|float %} + {% set dummy = params.HEIGHT|default(Z height)|int %} + {% set dummy = params.SCALE|default(1.0)|float %} + {% set dummy = params.BUMP|default(0)|int %} + {% set dummy = params.MAXIMUM|default(0)|int %} + {% set dummy = params.MINIMUM|default(255)|int %} + {% set dummy = params.SPEED|default(current speed)|int %} + " %} # End argument block for Mainsail + {% set filtered_params = params|reject('in',['HEIGHT','LAYER'])|list|sort %} + {% if filtered_params|length == 0 %} + {action_raise_error("No fan parameters provided.")} + {% endif %} + _CHECK_FAN_PARAMS{% for k in filtered_params %}{' '~k~'='~params[k] + }{% endfor %} + GCODE_AT_LAYER {% for k in params|select('in',['HEIGHT','LAYER'])|list %}{ + ' ' ~ k ~ '=' ~ params[k] }{% endfor + %} COMMAND="SET_FAN_SCALING{% for k in filtered_params %}{ + ' ' ~ k ~ '=' ~ params[k]}{% endfor %}" + +[gcode_macro heater_at_layer] +description: Convenience macro to schedule a heater adjustment at the specified + layer change. LAYER=next will cause the command to run at the next layer + change. See SET_HEATER_SCALING for additional arguments. + Usage: HEATER_AT_LAYER { HEIGHT= | LAYER= } ... +gcode: + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.LAYER|default(layer number)|float %} + {% set dummy = params.HEIGHT|default(Z height)|int %} + {% set dummy = params.HEATER|default(e.g. extruder) %} + {% set dummy = params.SCALE|default(1.0)|float %} + {% set dummy = params.BUMP|default(0.0)|float %} + {% set dummy = params.MAXIMUM|default(max_temp)|float %} + {% set dummy = params.MINIMUM|default(min_temp)|float %} + {% set dummy = params.TARGET|default(current target)|float %} + " %} # End argument block for Mainsail + {% set filtered_params = params|reject('in',['HEIGHT','LAYER'])|list|sort %} + _CHECK_HEATER_PARAMS{% for k in filtered_params%}{' ' ~ k ~ '=' ~ params[k] + }{% endfor %} + GCODE_AT_LAYER{% for k in params|select('in',['HEIGHT','LAYER'])|list %}{ + ' ' ~ k ~ '=' ~ params[k] }{% endfor + %} COMMAND="SET_HEATER_SCALING{% for k in filtered_params %}{ + ' ' ~ k ~ '=\\\"' ~ params[k]|replace('\\','\\\\')|replace('\'','\\\'') + |replace('\"','\\\"') ~ '\\\"' + }{% endfor %}" diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/optional/bed_mesh.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/optional/bed_mesh.cfg new file mode 100644 index 0000000..d32fbbb --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/optional/bed_mesh.cfg @@ -0,0 +1,14 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro bed_mesh_calibrate] +rename_existing: _KM_BED_MESH_CALIBRATE_BASE +description: Wraps BED_MESH_CALIBRATE, scaling probe count to specified area. + Usage: See Klipper documentation. +gcode: + BED_MESH_CALIBRATE_FAST{%for k in params%}{' '~k~'="'~params[k]~'"'}{%endfor%} + +[gcode_macro g29] +gcode: + BED_MESH_CALIBRATE diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/optional/lcd_menus.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/optional/lcd_menus.cfg new file mode 100644 index 0000000..c25aa90 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/optional/lcd_menus.cfg @@ -0,0 +1,976 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +################################################################################ +# Existing menu refinements. +################################################################################ + +# Hide unused menus + +[menu __main __octoprint] +type: list +name: OctoPrint +enable: {printer["gcode_macro _km_globals"].menu_show_octoprint} + + +# Get the file list out of the SD card menu while printing. +[menu __main __sdcard] +type: list +enable: {'virtual_sdcard' in printer and + printer["gcode_macro _km_globals"].menu_show_sdcard} +name: SD Card + +[menu __main __sdcard __start] +type: command +enable: {printer.virtual_sdcard.file_path and + not printer.virtual_sdcard.is_active and + printer.print_stats.state != "printing" and + printer.print_stats.state != "paused"} +name: Print: {printer.virtual_sdcard.file_path.split('/')|last} +gcode: + M24 + {menu.back()} + +[menu __main __sdcard __select] +type: vsdlist +enable: {not printer.virtual_sdcard.is_active and + printer.print_stats.state != "printing" and + printer.print_stats.state != "paused"} +name: Select file +index: 1 + +[menu __main __sdcard __select __start] +type: command +enable: {printer.virtual_sdcard.file_path and + not printer.virtual_sdcard.is_active} +name: Print: {printer.virtual_sdcard.file_path.split('/')|last} +gcode: + M24 + {menu.back()} + +[menu __main __setup __calib __delta_calib_auto] +type: command +enable: {'delta_calibrate' in printer.configfile.settings and + not printer.idle_timeout.state == "Printing"} +name: Delta cal. auto +gcode: + G28 + DELTA_CALIBRATE + +[menu __main __setup __calib __delta_calib_man] +type: list +enable: {'delta_calibrate' in printer.configfile.settings and + not printer.idle_timeout.state == "Printing"} +name: Delta cal. man + +# Require confirmation for anything that would abort an in-progress print. + +# Steppers off +[menu __main __control __disable] +type: command +name: Steppers off +enable: {printer.idle_timeout.state != "Printing"} +gcode: + M84 + M18 + +[menu __main __control __disable_printing] +type: list +index: 3 +enable: {printer.idle_timeout.state == "Printing"} +name: Steppers off + +[menu __main __control __disable_printing __confirm] +type: command +name: Confirm steppers off +gcode: + M84 + M18 + {menu.back()} + +# Add a park menu item. +[menu __main __control __park] +type: command +name: Park toolhead +enable: {printer.idle_timeout.state != "Printing" or + printer.pause_resume.is_paused} +index: 1 +gcode: + PARK LAZY=1 + +# Octoprint abort +[menu __main __octoprint __abort] +type: list +enable: {printer.idle_timeout.state == "Printing"} +name: Abort printing + +[menu __main __octoprint __abort __confirm] +type: command +name: Confirm abort printing +gcode: + {action_respond_info('action:cancel')} + {menu.back()} + +# SD card cancel +[menu __main __sdcard __cancel] +type: list +enable: {('virtual_sdcard' in printer) and + (printer.print_stats.state == "printing" or + printer.print_stats.state == "paused")} +name: Cancel printing + +[menu __main __sdcard __cancel __confirm] +type: command +name: Confirm cancel printing +gcode: + {% if 'pause_resume' in printer %} + CANCEL_PRINT + {% else %} + M25 + M27 + M26 S0 + TURN_OFF_HEATERS + G91 + G0 Z{(printer.toolhead.position.z, printer.toolhead.axis_maximum.z - 5)|min + } F1000 + G90 + {% endif %} + {menu.back()} + +# Extra setup menu options + +# Shutdown and reboot +[menu __main __setup __restart] +type: list +name: Host Control + +[menu __main __setup __restart __reboot] +type: command +name: Reboot host +gcode: + M117 Rebooting host + M118 Rebooting host + {menu.exit()} + G4 S2 ; Let the user see the console message. + {action_call_remote_method("reboot_machine")} ; Try Moonraker. + G4 S1 ; give Moonraker a chance to finish. + {action_respond_info('action:poweroff')} ; Try Octoprint. + +[menu __main __setup __restart __shutdown] +type: command +name: Shutdown host +gcode: + M117 Shutting down + M118 Shutting down + {menu.exit()} + G4 S2 ; Let the user see the console message. + {action_call_remote_method("shutdown_machine")} ; Try Moonraker. + G4 S1 ; give Moonraker a chance to finish. + {action_respond_info('action:poweroff')} ; Try Octoprint. + +# Speed and flow +[menu __main __setup __speed] +type: input +name: Speed: {'%3d' % (menu.input*100)}% +input: {printer.gcode_move.speed_factor} +input_min: 0.01 +input_max: 5 +input_step: 0.01 +realtime: True +index: 4 +gcode: + M220 S{'%d' % (menu.input*100)} + +[menu __main __setup __flow] +type: input +name: Flow: {'%3d' % (menu.input*100)}% +input: {printer.gcode_move.extrude_factor} +input_min: 0.01 +input_max: 2 +input_step: 0.01 +realtime: True +index: 5 +gcode: + M221 S{'%d' % (menu.input*100)} + +################################################################################ +# Replace filament loading with our own macros. +################################################################################ + +[menu __main __filament] +type: list +name: Filament +enable: {printer.idle_timeout.state != "Printing" or + printer.pause_resume.is_paused} + +# Hide the old load/unload commands. +[menu __main __filament __loadf] +type: command +name: Load Fil. fast +enable: False + +[menu __main __filament __loads] +type: command +name: Load Fil. slow +enable: False + +[menu __main __filament __unloadf] +type: command +name: Unload Fil.fast +enable: False + +[menu __main __filament __unloads] +type: command +name: Unload Fil.slow +enable: False + +# Add new load/unload using our macros. +[menu __main __filament __load] +type: command +index: 1 +name: Load Filament +gcode: + LOAD_FILAMENT + +[menu __main __filament __unload] +type: command +index: 2 +name: Unload Filament +gcode: + UNLOAD_FILAMENT + +[menu __main __filament __feed] +type: input +name: Feed: {'%.1f' % menu.input} +input: 0.0 +input_min: -50.0 +input_max: 50.0 +input_step: 1.0 +gcode: + SAVE_GCODE_STATE NAME=_KM_FILAMENT_LOAD + M83 + G1 E{'%.1f' % menu.input + } F{printer["gcode_macro _km_globals"].load_priming_speed} + RESTORE_GCODE_STATE NAME=_KM_FILAMENT_LOAD + +################################################################################ +# Layer triggers. +################################################################################ + +[menu __main __sdcard __pause_layer] +type: input +index: 4 +enable: {('virtual_sdcard' in printer) and + printer.print_stats.state == "printing"} +name: Pause {% set layer = printer.print_stats.info.current_layer %}{% + if layer >= menu.input|int %}layer{% + elif layer + 1 == menu.input|int %}at: next{% + else %}at: {menu.input|int}{% endif %} +input: {printer.print_stats.info.current_layer} +input_min: {printer.print_stats.info.current_layer} +input_max: {printer.print_stats.info.total_layer} +input_step: 1 +gcode: + {% if menu.input|int > printer.print_stats.info.current_layer %} + PAUSE_AT_LAYER LAYER={menu.input} + {% endif %} + +[menu __main __octoprint __pause_layer] +type: input +index: 1 +enable: {printer.idle_timeout.state == "Printing"} +name: Pause {% set layer = printer.print_stats.info.current_layer %}{% + if layer >= menu.input|int %}layer{% + elif layer + 1 == menu.input|int + 1 %}at: next{% + else %}at: {menu.input|int}{% endif %} +input: {printer.print_stats.info.current_layer} +input_min: {printer.print_stats.info.current_layer} +input_max: {printer.print_stats.info.total_layer} +input_step: 1 +gcode: + {% if menu.input|int > printer.print_stats.info.current_layer %} + GCODE_AT_LAYER LAYER={menu.input|int + } COMMAND="RESPOND TYPE=command MSG=action:pause" + {% endif %} + +################################################################################ +# Bed surface. +################################################################################ + +[menu __main __setup __bed_surface] +type: input +name: Bed: {(printer.save_variables.variables.bed_surfaces.available + | list | sort)[menu.input|int]} +input: {% set surfaces = printer.save_variables.variables.bed_surfaces + %}{(surfaces.available | list | sort).index(surfaces.active) | int} +input_min: 0 +input_max: {((printer.save_variables.variables.bed_surfaces.available + | length) - 1)} +input_step: 1 +index: 4 +gcode: + SET_SURFACE_ACTIVE SURFACE={ + (printer.save_variables.variables.bed_surfaces.available + | list | sort)[menu.input|int]} + +[menu __main __setup __offsetz] +type: input +name: Offset Z:{ '%05.3f' % menu.input } +input: {% set surfaces = printer.save_variables.variables.bed_surfaces + %}{ surfaces.available[surfaces.active].offset | float } +input_min: -5 +input_max: 5 +input_step: 0.005 +index: 5 +realtime: True +gcode: + SET_SURFACE_OFFSET OFFSET={menu.input} + +[menu __main __tune __offsetz] +type: input +name: Offset Z:{ '%05.3f' % menu.input } +input: { printer.gcode_move.homing_origin.z } +input_min: -5 +input_max: 5 +input_step: 0.005 +realtime: True +gcode: + SET_SURFACE_OFFSET OFFSET={menu.input} + +################################################################################ +# Heater overrides. +################################################################################ + +### menu temperature ### + +# Hide the original menu +[menu __main __temp] +type: list +name: Temperature +enable: False + +[menu __main __temp_km] +type: list +name: Temperature +index: 4 + +[menu __main __temp_km __hotend0_target] +type: input +enable: {'extruder' in printer} +name: {"Ex0:%3.0f (%4.0f)" % (menu.input, printer.extruder.temperature)} +input: {printer.extruder.target} +input_min: 0 +input_max: {printer.configfile.config.extruder.max_temp} +input_step: 1 +gcode: SET_HEATER_TEMPERATURE HEATER=extruder TARGET={'%.0f' % menu.input} + +[menu __main __temp_km __hotend1_target] +type: input +enable: {'extruder1' in printer} +name: {"Ex1:%3.0f (%4.0f)" % (menu.input, printer.extruder1.temperature)} +input: {printer.extruder1.target} +input_min: 0 +input_max: {printer.configfile.config.extruder1.max_temp} +input_step: 1 +gcode: SET_HEATER_TEMPERATURE HEATER=extruder1 TARGET={'%.0f' % menu.input} + +[menu __main __temp_km __hotbed_target] +type: input +enable: {'heater_bed' in printer} +name: {"Bed:%3.0f (%4.0f)" % (menu.input, printer.heater_bed.temperature)} +input: {printer.heater_bed.target} +input_min: 0 +input_max: {printer.configfile.config.heater_bed.max_temp} +input_step: 1 +gcode: SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={'%.0f' % menu.input} + +# We just create 10 preheat placeholders below, and dynamically enable and fill +# them in from the dictionary in variable_menu_temperature. + +## Pre-heat [0] ## +[menu __main __temp_km __preheat_0] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[0].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 0} + +[menu __main __temp_km __preheat_0 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[0] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[0] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_0 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[0]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[0].extruder} + +[menu __main __temp_km __preheat_0 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[0]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[0].bed} + +[menu __main __temp_km __preheat_0 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[0]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[0].chamber} + +## Pre-heat [1] ## +[menu __main __temp_km __preheat_1] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[1].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 1} + +[menu __main __temp_km __preheat_1 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[1] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[1] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_1 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[1]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[1].extruder} + +[menu __main __temp_km __preheat_1 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[1]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[1].bed} + +[menu __main __temp_km __preheat_1 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[1]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[1].chamber} + +## Pre-heat [2] ## +[menu __main __temp_km __preheat_2] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[2].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 2} + +[menu __main __temp_km __preheat_2 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[2] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[2] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_2 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[2]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[2].extruder} + +[menu __main __temp_km __preheat_2 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[2]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[2].bed} + +[menu __main __temp_km __preheat_2 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[2]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[2].chamber} + +## Pre-heat [3] ## +[menu __main __temp_km __preheat_3] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[3].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 3} + +[menu __main __temp_km __preheat_3 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[3] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[3] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_3 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[3]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[3].extruder} + +[menu __main __temp_km __preheat_3 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[3]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[3].bed} + +[menu __main __temp_km __preheat_3 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[3]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[3].chamber} + +## Pre-heat [4] ## +[menu __main __temp_km __preheat_4] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[4].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 4} + +[menu __main __temp_km __preheat_4 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[4] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[4] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_4 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[4]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[4].extruder} + +[menu __main __temp_km __preheat_4 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[4]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[4].bed} + +[menu __main __temp_km __preheat_4 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[4]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[4].chamber} + +## Pre-heat [5] ## +[menu __main __temp_km __preheat_5] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[5].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 5} + +[menu __main __temp_km __preheat_5 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[5] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[5] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_5 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[5]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[5].extruder} + +[menu __main __temp_km __preheat_5 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[5]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[5].bed} + +[menu __main __temp_km __preheat_5 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[5]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[5].chamber} + +## Pre-heat [6] ## +[menu __main __temp_km __preheat_6] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[6].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 6} + +[menu __main __temp_km __preheat_6 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[6] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[6] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_6 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[6]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[6].extruder} + +[menu __main __temp_km __preheat_6 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[6]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[6].bed} + +[menu __main __temp_km __preheat_6 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[6]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[6].chamber} + +## Pre-heat [7] ## +[menu __main __temp_km __preheat_7] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[7].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 7} + +[menu __main __temp_km __preheat_7 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[7] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[7] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_7 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[7]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[7].extruder} + +[menu __main __temp_km __preheat_7 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[7]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[7].bed} + +[menu __main __temp_km __preheat_7 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[7]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[7].chamber} + +## Pre-heat [8] ## +[menu __main __temp_km __preheat_8] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[8].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 8} + +[menu __main __temp_km __preheat_8 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[8] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[8] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_8 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[8]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[8].extruder} + +[menu __main __temp_km __preheat_8 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[8]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[8].bed} + +[menu __main __temp_km __preheat_8 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[8]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[8].chamber} + +## Pre-heat [9] ## +[menu __main __temp_km __preheat_9] +type: list +name: Preheat {printer["gcode_macro _km_globals"].menu_temperature[9].name} +enable: {printer.idle_timeout.state != "Printing" and + printer["gcode_macro _km_globals"].menu_temperature|length > 9} + +[menu __main __temp_km __preheat_9 __all] +type: command +enable: {printer["gcode_macro _km_globals"].menu_temperature[9] | list | + select('in', ['extruder', 'bed', 'chamber']) | list | length > 1 and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Preheat all +gcode: + {% set targets = printer["gcode_macro _km_globals"].menu_temperature[9] %} + {% if 'chamber' in targets and + 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={targets.chamber} + {% endif %} + {% if 'bed' in targets and 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={targets.bed} + {% endif %} + {% if 'extruder' in targets and 'extruder' in printer %} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + targets.extruder} + {% endif %} + +[menu __main __temp_km __preheat_9 __hotend] +type: command +enable: {'extruder' in printer and + 'extruder' in printer["gcode_macro _km_globals"].menu_temperature[9]} +name: Preheat hotend +gcode: + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[9].extruder} + +[menu __main __temp_km __preheat_9 __hotbed] +type: command +enable: {'heater_bed' in printer and + 'bed' in printer["gcode_macro _km_globals"].menu_temperature[9]} +name: Preheat bed +gcode: + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[9].bed} + +[menu __main __temp_km __preheat_9 __chamber] +type: command +enable: {'heater_generic chamber' in printer.heaters.available_heaters and + 'chamber' in printer["gcode_macro _km_globals"].menu_temperature[9]} +name: Preheat chamber +gcode: + SET_HEATER_TEMPERATURE HEATER=chamber TARGET={ + printer["gcode_macro _km_globals"].menu_temperature[9].chamber} + +## Cooldown ## +[menu __main __temp_km __cooldown_all] +type: command +enable: {printer.idle_timeout.state != "Printing" and + (('extruder' in printer) + ('heater_bed' in printer) + + ('heater_generic chamber' in printer.heaters.available_heaters)) > 1} +name: Cooldown all +gcode: + {% if 'heater_generic chamber' in printer.heaters.available_heaters %} + SET_HEATER_TEMPERATURE HEATER=chamber TARGET=0 + {% endif %} + {% if 'heater_bed' in printer %} + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET=0 + {% endif %} + {% if 'extruder' in printer%} + SET_HEATER_TEMPERATURE HEATER={printer.toolhead.extruder} TARGET=0 + {% endif %} + +[menu __main __temp_km __cooldown_hotend] +type: command +enable: {printer.idle_timeout.state != "Printing" and 'extruder' in printer} +name: Cooldown hotend +gcode: M104 S0 + +[menu __main __temp_km __cooldown_hotbed] +type: command +enable: {printer.idle_timeout.state != "Printing" and 'heater_bed' in printer} +name: Cooldown bed +gcode: M140 S0 + +[menu __main __temp_km __cooldown_chamber] +type: command +enable: {printer.idle_timeout.state != "Printing" and + 'heater_generic chamber' in printer.heaters.available_heaters} +name: Cooldown chamber +gcode: M141 S0 diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/park.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/park.cfg new file mode 100644 index 0000000..785d402 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/park.cfg @@ -0,0 +1,91 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro park] +description: Park the toolhead + Usage: PARK [P=<0|1|2>] [X=] [Y=] [Z=] [LAZY=<1|0>] +gcode: + {% set km = printer["gcode_macro _km_globals"] %} + {% set LAZY = params.LAZY|default(1)|int %} + {% if printer.toolhead.homed_axes != "xyz" %} + {% if LAZY %} + LAZY_HOME + {% else %} + {action_raise_error("Must home axes first.")} + {% endif %} + {% endif %} + + # Z position type from G27 (if below, absolute, relative) + {% set P = (params.P|default(2))|int %} # Default to 2 because it's sanest. + {% set X = params.X|default(km.park_x)|float %} + {% set Y = params.Y|default(km.park_y)|float %} + {% set Z = params.Z|default(km.park_z)|float %} + + M400 + _CHECK_KINEMATIC_LIMITS X="{X}" Y="{Y}" Z="{Z}" + _PARK_INNER X="{X}" Y="{Y}" Z="{Z}" P="{P}" LAZY="{LAZY}" + # Dummy argument block for Mainsail + {% set dummy = None if True else " + {% set dummy = params.P|default(mode=<0|1|2>)|int %} + {% set dummy = params.X|default(X position)|int %} + {% set dummy = params.Y|default(Y position)|int %} + {% set dummy = params.Z|default(Z position)|int %} + " %} # End argument block for Mainsail + +[gcode_macro _park_inner] +gcode: + {% set km = printer["gcode_macro _km_globals"] %} + {% set travel_speed_xy = km.travel_speed_xy %} + {% set travel_speed_z = km.travel_speed_z %} + + {% set position = printer.gcode_move.gcode_position %} + {% set origin = printer.gcode_move.homing_origin%} + + # Use the taller of the highest printed layer or the current Z height, which + # should help avoid crashes (e.g. when a sequential print in progress). + {% set clearance_z = (printer["gcode_macro _km_layer_run"].clearance_z, + position.z) | max %} + {% set P = params.P|int %} + {% set X = params.X|float - origin.x %} + {% set Y = params.Y|float - origin.y %} + {% set Z = params.Z|float %} + {% set LAZY = params.LAZY|int %} + + # Convert everything to absolute coordinates. + {% if P == 0 %} # Move absolute to Z if below current Z + {% if clearance_z > Z %} + {% set Z = clearance_z %} + {% endif %} + {% elif P == 1 %} # Move Z absolute. + {% set Z = Z - origin.z %} + {% elif P == 2 %} # Move Z relative + {% set Z = Z + clearance_z %} + {% else %} + {action_raise_error("Invalid parameter P=%i. Value must be 0, 1, or 2." | + format(P)) } + {% endif %} + + # Clamp to the printer limits. + {% set Z = ((Z, printer.toolhead.axis_maximum.z - origin.z)|min, + printer.toolhead.axis_minimum.z - origin.z)|max %} + + # Don't move if it's a lazy park and we're already in position. + {% if (not LAZY) or P != 2 or X != position.x or Y != position.y + or Z < clearance_z %} + SAVE_GCODE_STATE NAME=_KM_PARK + G90 + G0 Z{Z} F{travel_speed_z} + G0 X{X} Y{Y} F{travel_speed_xy} + RESTORE_GCODE_STATE NAME=_KM_PARK MOVE=0 + {% endif %} + + +[gcode_macro g27] +description: Parks the toolhead. + Usage: G27 [P=<0|1|2>] +gcode: + # Wraps any arguments for the PARK macro and defaults P=0 for Marlin compat. + PARK P={params.P|default(0)} {% for k in params|reject("in", "GP") %}{ + ' '~k~'="'~params[k]~'"' + }{% endfor %} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/pause_resume_cancel.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/pause_resume_cancel.cfg new file mode 100644 index 0000000..63f4525 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/pause_resume_cancel.cfg @@ -0,0 +1,144 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +# Enables pause/resume functionality +[gcode_macro pause] +description: Pauses the current print. + Usage: PAUSE [X=] [Y=] [Z=] [E=] [B=] +rename_existing: _KM_PAUSE_BASE +gcode: + {% set km = printer["gcode_macro _km_globals"] %} + # Retract length (negative) + {% set E = (params.E|default(5))|float %} + + {% if printer.pause_resume.is_paused %} + { action_respond_info("Print already paused") } + {% elif printer.idle_timeout.state | string == "Printing" or + (printer.virtual_sdcard|default({})).is_active|default(False) %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=pausing RESET_STACK=1 + {% set position = printer.gcode_move.gcode_position %} + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_x VALUE="{position.x}" + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_y VALUE="{position.y}" + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_z VALUE="{position.z}" + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_e VALUE="{E}" + SAVE_GCODE_STATE NAME=_KM_PAUSE_OVERRIDE_STATE + _KM_PAUSE_BASE + M83 + {% if printer.extruder.can_extrude %} + G1 E{'%.4f' % -E} F{km.load_speed} + {% endif %} + PARK P=2{% for k in params|select("in", "XYZ") %}{ + ' '~k~'="'~params[k]~'"'}{% endfor %} + _KM_BEEP_IF_AVAILABLE BEEPS={params.B|default(10)} + {% else %} + { action_respond_info("Print not in progress") } + {% endif %} + +[gcode_macro m600] +description: Pauses the current print. + Usage: M600 [B] [E] [L] [R] [U] [X] [Y] + [Z] +gcode: + PAUSE B="{0}" P=2{% for k in params|select("in", "EXYZ") %}{ + ' '~k~'="'~params[k]~'"'}{% endfor %} + UNLOAD_FILAMENT{% if 'U' in params %} LENGTH={params.U}{% endif + %} BEEPS="{params.B|default(10)|int}" + {% if 'R' in params %}M109 S{params.R}{% endif %} + +[gcode_macro m601] +description: Pauses the current print. + Usage: M601 +gcode: + PAUSE + +[gcode_macro m602] +description: Resumes the currently paused print. + Usage: M602 +gcode: + RESUME + +[gcode_macro m24] +rename_existing: M24.6245197 +gcode: + {% if printer.pause_resume.is_paused %} + RESUME + {% else %} + M24.6245197 + {% endif %} + +[gcode_macro m25] +rename_existing: M25.6245197 +gcode: + PAUSE + +[gcode_macro resume] +description: Resumes the currently paused print. + Usage: RESUME [E] +rename_existing: _KM_RESUME_BASE +variable_saved_extruder_temp: 0 +variable_saved_x: 0.0 +variable_saved_y: 0.0 +variable_saved_z: 0.0 +variable_saved_e: 0.0 +gcode: + {% if printer.pause_resume.is_paused %} + {% set km = printer["gcode_macro _km_globals"] %} + # Warm the extruder back up if needed. + {% set extruder = printer[printer.toolhead.extruder] %} + {% if extruder.target <= printer.configfile.settings[ + printer.toolhead.extruder].min_temp + | float + 0.5 %} + M109 S{saved_extruder_temp} + {% endif %} + + # If there's no saved_e assume we're completing a filament change and + # retract enough to avoid drooling on the model. + {% if 'E' not in params and not saved_e %} + {% set saved_e = 5.0 %} + G1 E{'%.4f' % -saved_e } F{km.load_speed} + {% endif %} + + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_extruder_temp VALUE="{0}" + G90 + # Move back to last position before unretracting. + G0 X{saved_x} Y{saved_y} F{km.travel_speed_xy} + G0 Z{saved_z} F{km.travel_speed_z} + G91 + # Unretract + G1 E{'%.4f' % (params.E|default(saved_e))} F{km.load_speed} + RESTORE_GCODE_STATE NAME=_KM_PAUSE_OVERRIDE_STATE MOVE=1 + _KM_RESUME_BASE + {% else %} + { action_respond_info("Printer is not paused.") } + {% endif %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=printing RESET_STACK=1 + +# TODO: Fix casing after front-ends get fixed +[gcode_macro CANCEL_PRINT] +description: Cancels the current print. + Usage: CANCEL_PRINT +rename_existing: _KM_CANCEL_PRINT_BASE +gcode: + _KM_CHECK_IS_PRINTING + _KM_PRINT_STATUS ACTION=CHANGE STATUS=cancelling RESET_STACK=1 + SET_GCODE_VARIABLE MACRO=_print_end_inner VARIABLE=cancelled VALUE="{True}" + PRINT_END + _KM_CANCEL_PRINT_BASE + {% if printer.pause_resume.is_paused %} + RESTORE_GCODE_STATE NAME=_KM_PAUSE_OVERRIDE_STATE MOVE=0 + {% endif %} + CLEAR_PAUSE + _KM_APPLY_PRINT_OFFSET RESET=1 + {% if 'virtual_sdcard' in printer and not printer.virtual_sdcard.is_active %} + SDCARD_RESET_FILE + {% endif %} + +[gcode_macro clear_pause] +description: Clears the current pause state. + Usage: CLEAR_PAUSE +rename_existing: _KM_CLEAR_PAUSE +gcode: + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_e VALUE="{0.0}" + SET_GCODE_VARIABLE MACRO=resume VARIABLE=saved_extruder_temp VALUE="{0}" + _KM_CLEAR_PAUSE diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/start_end.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/start_end.cfg new file mode 100644 index 0000000..c4e3958 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/start_end.cfg @@ -0,0 +1,484 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro print_start] +description: Inserted by slicer at start of print. Rather than using this macro + directly you should configure your slicer as instructed in the readme. + Usage: PRINT_START BED= EXTRUDER= [CHAMBER=] + [MESH_MIN=] [MESH_MAX=] [LAYERS=] + [NOZZLE_SIZE=] +gcode: + {action_respond_info( + "This file is using an old The PRINT_START format. This print will run " + "fine, but you should update your slicer config to take advantage of the " + "phased PRINT_START macros. The slicer documentation is here:\n" + "https://github.com/jschuh/klipper-macros\x23slicer-configuration" + )} + + _PRINT_START_PHASE_INIT {rawparams} + _PRINT_START_PHASE_PREHEAT + _PRINT_START_PHASE_PROBING + _PRINT_START_PHASE_EXTRUDER + _PRINT_START_PHASE_PURGE + +[gcode_macro _print_start_phase_init] +description: Inserted by slicer at start of print. Initializes PRINT_START + phases. + Usage: See PRINT_START. +gcode: + CHECK_KM_CONFIG # Need this in case startup errors were missed. + SET_GCODE_VARIABLE MACRO=_print_end_inner VARIABLE=cancelled VALUE="{False}" + _KM_APPLY_PRINT_OFFSET RESET=1 + _PRINT_START_PHASE_CHECK PHASE=none + {% set km = printer["gcode_macro _km_globals"] %} + + {% if not params.BED %} + {% set dummy = params.__setitem__('BED', params.BED_TEMP|int) %} + {% endif %} + {% if not params.EXTRUDER %} + {% set dummy = params.__setitem__('EXTRUDER', params.EXTRUDER_TEMP|int) %} + {% endif %} + + # Stash all the params for use by the other phases. + PRINT_START_SET PRINT_START_PHASE="init" {% for k in params %}{' %s=\"%s\"' % + (k,params[k]|replace('\\','\\\\')|replace('\'','\\\'')|replace('\"','\\\"')) + }{% endfor %} + + # Check and propogate the printable bounds.' + _km_check_and_set_print_bounds + + M107 # Turn off part cooling fan in case it was on. + CLEAR_PAUSE + # Kick off the longest preheats in the init. + M140 S{params.BED} + {% if params.CHAMBER %}M141 S{params.CHAMBER|int}{% endif %} + {% if printer.bed_mesh %}BED_MESH_CLEAR{% endif %} + # Load a saved mesh if configured. + {% if km.start_try_saved_surface_mesh and printer.bed_mesh %} + LOAD_SURFACE_MESH + {% endif %} + PRINT_START_SET PRINT_START_PHASE="preheat" + +[gcode_macro _print_start_phase_preheat] +description: Inserted by slicer at start of print. Handles the bed and chamber + heating phases and ends when both are stabilized at their target temperatures. + Usage: See PRINT_START. +gcode: + _PRINT_START_PHASE_CHECK PHASE=preheat + {% set print = printer["gcode_macro print_start_set"].print %} + {% set BED = print.BED|int %} + {% set EXTRUDER = print.EXTRUDER|int %} + {% set CHAMBER = print.CHAMBER|default(0)|int %} + {% set LAYERS = print.LAYERS|default(0)|int %} + {% set km = printer["gcode_macro _km_globals"] %} + # The bed started at no more than 0.2C below and 1.0C above the target temp. + {% set bed_at_target = (BED + 0.4 - printer.heater_bed.temperature) | + abs <= 0.6 %} + PRINT_START_SET BED_AT_TARGET={1 if bed_at_target else 0} + {% set start_level_bed_at_temp = km.start_level_bed_at_temp and + not printer.bed_mesh.profile_name %} + {% set actions_at_temp = start_level_bed_at_temp or + km.start_quad_gantry_level_at_temp or + km.start_z_tilt_adjust_at_temp or + (km.start_home_z_at_temp and not bed_at_target) %} + {% set bed_overshoot = (BED + (km.start_bed_heat_overshoot if + (BED and not bed_at_target) else 0.0), + printer.configfile.settings.heater_bed.max_temp ) | min %} + + INIT_LAYER_GCODE LAYERS="{LAYERS}" + {% if CHAMBER > 0.0 %} + M141 S{CHAMBER} + {% endif %} + # Start bed heating + M140 S{bed_overshoot} + {% if actions_at_temp %} + # If we're going to run a bed level we either have a probing temp specified + # or we heat the extruder part way to avoid oozing while probing. + M104 S{km.start_extruder_probing_temp if km.start_extruder_probing_temp > 0 + else (km.start_extruder_preheat_scale * EXTRUDER)|round(0,'ceil')|int} + {% else %} + # Honor the extruder probing temp, in case we just want to delay extruder + # heating until after the bed is ready. + M104 S{km.start_extruder_probing_temp if km.start_extruder_probing_temp > 0 + else EXTRUDER} + {% endif %} + # home all axes + _KM_PRINT_STATUS ACTION=CHANGE STATUS=homing RESET_STACK=1 + G28 + G90 + {% if BED > 0.0 %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=bed_heating RESET_STACK=1 + # Skip this if the bed was already at target when START_PRINT was called. + {% if not bed_at_target %} + PARK + # Overshoot the target a bit. + M190 S{bed_overshoot} + G4 P{km.start_bed_heat_delay / 2} + M190 R{BED} # Settle down after the overshoot. + G4 P{km.start_bed_heat_delay / 2} + {% endif %} + {% endif %} + + {% if CHAMBER > 0.0 %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=chamber_heating RESET_STACK=1 + _KM_PARK_IF_NEEDED HEATER="chamber" RANGE=ABOVE + M191 S{CHAMBER} + {% endif %} + + {% if BED > 0.0 and bed_at_target%} + M190 R{BED} # Extra bed stabilization if we skipped it earlier. + {% endif %} + PRINT_START_SET PRINT_START_PHASE="probing" + +[gcode_macro _print_start_phase_probing] +description: Inserted by slicer at start of print. Performs probing (including + mesh bed level) and other operations that should be run when the bed and + chamber are stabilized at their target temps. + Usage: See PRINT_START. +gcode: + _PRINT_START_PHASE_CHECK PHASE=probing + {% set print = printer["gcode_macro print_start_set"].print %} + {% set km = printer["gcode_macro _km_globals"] %} + {% set MESH_MIN = print.MESH_MIN|default(None) %} + {% set MESH_MAX = print.MESH_MAX|default(None) %} + # Randomize the placement of the print on the bed. + {% if km.start_random_placement_max > 0 and print.PRINT_MIN and MESH_MIN %} + {% set PRINT_MIN = print.PRINT_MIN.split(",")|map('float')|list %} + {% set PRINT_MAX = print.PRINT_MAX.split(",")|map('float')|list %} + {% set x_offset = (((km.print_max[0] - km.print_min[0] - PRINT_MAX[0] + + PRINT_MIN[0] - 2 * km.start_random_placement_padding)|int, + km.start_random_placement_max * 2)|min, 0)|max %} + {% set y_offset = (((km.print_max[1] - km.print_min[1] - PRINT_MAX[1] + + PRINT_MIN[1] - 2 * km.start_random_placement_padding)|int, + km.start_random_placement_max * 2)|min, 0)|max %} + {% if x_offset > 0 %} + {% set x_offset = range(x_offset)|random + km.print_min[0] - + PRINT_MIN[0] + km.start_random_placement_padding %} + {% endif %} + {% if y_offset > 0 %} + {% set y_offset = range(y_offset)|random + km.print_min[1] - + PRINT_MIN[1] + km.start_random_placement_padding %} + {% endif %} + # This MESH_MIN/MESH_MAX gets passed to BED_MESH_CALIBRATE below, but the + # rest of the macros rely on SET_GCODE_OFFSET performing the adjustment. + {% set MESH_MIN = MESH_MIN.split(",")|map('float')|list %} + {% set MESH_MAX = MESH_MAX.split(",")|map('float')|list %} + {% set MESH_MIN_NEW = (MESH_MIN[0] + x_offset, MESH_MIN[1] + y_offset) %} + {% set MESH_MAX_NEW = (MESH_MAX[0] + x_offset, MESH_MAX[1] + y_offset) %} + {action_respond_info( + "Relocating print origin from (%.3f,%.3f) "|format(*MESH_MIN) + + "to (%.3f,%.3f)"|format(*MESH_MIN_NEW))} + {% set MESH_MIN = (MESH_MIN_NEW[0], MESH_MIN_NEW[1])|join(',') %} + {% set MESH_MAX = (MESH_MAX_NEW[0], MESH_MAX_NEW[1])|join(',') %} + PRINT_START_SET PRINT_OFFSET={"%d,%d" % (x_offset,y_offset)} + {% endif %} + + {% set EXTRUDER = print.EXTRUDER|int %} + {% set km = printer["gcode_macro _km_globals"] %} + {% set start_level_bed_at_temp = km.start_level_bed_at_temp and + not printer.bed_mesh.profile_name %} + {% set start_home_z_at_temp = km.start_home_z_at_temp and + not print.BED_AT_TARGET|int %} + {% set actions_at_temp = start_level_bed_at_temp or + km.start_quad_gantry_level_at_temp or + km.start_z_tilt_adjust_at_temp or + start_home_z_at_temp %} + {% if actions_at_temp %} + {% if km.start_extruder_probing_temp > 0 %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=extruder_heating RESET_STACK=1 + _KM_PARK_IF_NEEDED HEATER={printer.toolhead.extruder} RANGE=2 + M109 R{km.start_extruder_probing_temp} + {% else %} + M104 S{EXTRUDER} # set the final extruder target temperature + {% endif %} + {% if km.start_z_tilt_adjust_at_temp %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=calibrating_z RESET_STACK=1 + Z_TILT_ADJUST + {% endif %} + {% if km.start_quad_gantry_level_at_temp %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=leveling_gantry RESET_STACK=1 + QUAD_GANTRY_LEVEL + {% endif %} + {% if start_home_z_at_temp %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=homing RESET_STACK=1 + G28 Z # Re-home only the Z axis now that the bed has stabilized. + {% endif %} + {% if start_level_bed_at_temp %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=meshing RESET_STACK=1 + _km_mesh_if_needed {% if MESH_MIN %} MESH_MIN={MESH_MIN}{% endif + %}{% if MESH_MAX %} MESH_MAX={MESH_MAX}{% endif %} + {% endif %} + {% if km.start_extruder_probing_temp > 0 %} + M104 S{EXTRUDER} # set the final extruder target temperature + {% endif %} + G4 + {% endif %} + PRINT_START_SET PRINT_START_PHASE="extruder" + +[gcode_macro _print_start_phase_extruder] +description: Inserted by slicer at start of print. Preheats the extruder. + Usage: See PRINT_START. +gcode: + _PRINT_START_PHASE_CHECK PHASE=extruder + {% set print = printer["gcode_macro print_start_set"].print %} + {% set EXTRUDER = print.EXTRUDER|default(print.EXTRUDER_TEMP)|float %} + {% set km = printer["gcode_macro _km_globals"] %} + + # Wait for extruder to reach temperature + {% if EXTRUDER > 0 %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=extruder_heating RESET_STACK=1 + _KM_PARK_IF_NEEDED HEATER={printer.toolhead.extruder} RANGE=ABOVE + M109 S{EXTRUDER} + {% endif %} + PRINT_START_SET PRINT_START_PHASE="purge" + +[gcode_macro _print_start_phase_purge] +description: Inserted by slicer at start of print. Generates purge lines. + Usage: See PRINT_START. +gcode: + _PRINT_START_PHASE_CHECK PHASE=purge + # Apply the offset for bed placement randomization. + _KM_APPLY_PRINT_OFFSET + # apply Z offset for bed surface (just in case it was reset). + _APPLY_BED_SURFACE_OFFSET + {% set print = printer["gcode_macro print_start_set"].print %} + {% set MESH_MIN = print.MESH_MIN|default(None) %} + {% set MESH_MAX = print.MESH_MAX|default(None) %} + {% set NOZZLE_SIZE = print.NOZZLE_SIZE|default(print.NOZZLE_SIZE)| + default(printer.configfile.settings.extruder.nozzle_diameter)|float %} + {% set km = printer["gcode_macro _km_globals"] %} + {% if km.start_purge_length > 0.0 and printer.extruder.can_extrude %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=purging RESET_STACK=1 + DRAW_PURGE_LINE WIDTH="{NOZZLE_SIZE * 1.25}" HEIGHT="{NOZZLE_SIZE * 0.625 + }"{% if MESH_MIN %} PRINT_MIN={MESH_MIN}{% endif + %}{% if MESH_MAX %} PRINT_MAX={MESH_MAX}{% endif %} + {% endif %} + PRINT_START_SET PRINT_START_PHASE="printing" + _KM_PRINT_STATUS ACTION=CHANGE STATUS=printing RESET_STACK=1 + +[gcode_macro _km_park_if_needed] +description: Parks the extruder if the current temperature of the supplied + heater is not within the specified target range. + Usage: _KM_PARK_IF_NEEDED HEATER= RANGE=[|ABOVE|BELOW] +gcode: + # This needs to get called as its own macro to get the current temp evaluated. + {% set HEATER = params.HEATER if params.HEATER in + printer.heaters.available_heaters else + ("heater_generic " ~ params.HEATER) %} + {% set RANGE = (params.RANGE|default(1))|string|upper %} + + {% if printer[HEATER].target %} + {% if RANGE == "ABOVE" %} + {% if printer[HEATER].temperature < printer[HEATER].target %} + PARK + {% endif %} + {% elif RANGE == "BELOW" %} + {% if printer[HEATER].temperature > printer[HEATER].target %} + PARK + {% endif %} + {% elif (printer[HEATER].temperature - printer[HEATER].target)|abs > + (printer[HEATER].target * RANGE|float * 0.01)|abs %} + PARK + {% endif %} + {% endif %} + +[gcode_macro _km_apply_print_offset] +variable_offset: [] +gcode: + {% set print = printer["gcode_macro print_start_set"].print %} + {% if params.RESET|default(0)|int and offset and + not printer["gcode_macro _km_save_state"].is_ephemeral%} + {% set PRINT_OFFSET = [offset.pop(0) * -1, offset.pop() * -1] %} + {% elif print.PRINT_OFFSET and not offset and + not printer["gcode_macro _km_save_state"].is_ephemeral %} + {% set PRINT_OFFSET = print.PRINT_OFFSET.split(",")|map('float')|list %} + {% set dummy = offset.extend(PRINT_OFFSET) %} + {% endif %} + + {% if PRINT_OFFSET %} + _KM_SET_GCODE_OFFSET_BASE {"X_ADJUST=%.2f Y_ADJUST=%.2f"| + format(*PRINT_OFFSET)} + {% endif %} + +[gcode_macro _km_mesh_if_needed] +gcode: + # TODO: Instead of blindly using the loaded mesh we could probe a few key + # points on the saved grid. If those probes show that the saved grid is no + # longer in tolerance we could just run BED_MESH_CALIBRATE_FAST anyway. + {% if not printer.bed_mesh.profile_name %} + BED_MESH_CALIBRATE_FAST {rawparams} + {% endif %} + +[gcode_macro print_start_set] +description: Inserted by slicer to set values used by PRINT_START. + Usage: PRINT_START_SET = +variable_print: {} +gcode: + {%for k in params %} + {% set dummy = print.__setitem__(k|upper, params[k]) %} + {% endfor %} + +[gcode_macro _print_start_phase_check] +gcode: + {% set print = printer["gcode_macro print_start_set"].print %} + {% set PRINT_START_PHASE = print.PRINT_START_PHASE|default("none") %} + {% if PRINT_START_PHASE != params.PHASE %} + # Reset the phases manually just to be sure. + SET_GCODE_VARIABLE MACRO=print_start_set VARIABLE=print VALUE="{{}}" + {% if params.PHASE != 'none' %} + {% set error = "PRINT_START phase error. Expected '%s' but found '%s'" % + (params.PHASE, PRINT_START_PHASE) %} + # Do the cancel manually if we're not confident it will fire. + {% if not 'virtual_sdcard' in printer or + not printer.virtual_sdcard.is_active or 'CANCEL_PRINT' not in + printer.configfile.settings.virtual_sdcard.on_error_gcode| + default("")|upper %} + {action_respond_info(error)} + CANCEL_PRINT + {% else %} + {action_raise_error(error)} + {% endif %} + {% else %} + { action_respond_info("Expected phase '%s' but found '%s'. Resetting." + % (params.PHASE, PRINT_START_PHASE)) } + {% endif %} + {% endif %} + +[gcode_macro print_end] +description: Inserted by slicer at end of print. + Usage: PRINT_END +gcode: + _KM_CHECK_IS_PRINTING + M400 + _PRINT_END_INNER + + {% set km = printer["gcode_macro _km_globals"] %} + + {% if km.start_clear_adjustments_at_end != 0 %} + RESET_HEATER_SCALING + RESET_FAN_SCALING + M220 S100 + M221 S100 + {% endif %} + _RESET_LAYER_GCODE + _RESET_VELOCITY_LIMITS + TURN_OFF_HEATERS + M107; turn off fan + {% if printer.bed_mesh %}BED_MESH_CLEAR{% endif %} + # Park the toolhead and present the bed + {% if printer.toolhead.homed_axes|lower == "xyz" %} + PARK Y="{km.start_end_park_y}" + {% endif %} + M84 ; disable steppers + CLEAR_PAUSE + SET_GCODE_VARIABLE MACRO=print_start_set VARIABLE=print VALUE="{{}}" + _KM_PRINT_STATUS ACTION=CHANGE STATUS=ready RESET_STACK=1 + +[gcode_macro _print_end_inner] +variable_cancelled: False +gcode: + SET_GCODE_VARIABLE MACRO=_print_end_inner VARIABLE=cancelled VALUE="{False}" + {% set km = printer["gcode_macro _km_globals"] %} + {% set toolhead = printer.toolhead %} + {% set origin = printer.gcode_move.homing_origin%} + {% set max_x = km.print_max[0] - origin.x %} + {% set max_y = km.print_max[1] - origin.y %} + {% set max_z = toolhead.axis_maximum.z - origin.z %} + + {% if not cancelled %} + _KM_PRINT_STATUS ACTION=CHANGE STATUS=completing + {% endif %} + + {% if printer.extruder.can_extrude %} + # Wipe if we're not cancelling a paused print. + {% if not printer.pause_resume.is_paused and not cancelled and + toolhead.homed_axes|lower == "xyz" %} + {% set x_safe = (max_x - toolhead.position.x, 2.0)|min %} + {% set y_safe = (max_y - toolhead.position.y, 2.0)|min %} + {% set z_safe = (max_z - toolhead.position.z, 2.0)|min %} + G91 + G0 Z{z_safe} E-1.0 F{km.travel_speed_z * 2} ; move nozzle up + G0 X{x_safe} Y{y_safe} E-1.0 F{km.travel_speed_xy} ; remove stringing + # Remove the offset now that we're done. + _KM_APPLY_PRINT_OFFSET RESET=1 + {% endif %} + + # Small retract to prevent ooze + G92 E0 + G1 E{"%.2f" % ((0, 2 - km.load_priming_length / 4)|min)} F1200 + M400 + {% endif %} + +[gcode_macro _km_check_is_printing] +variable_debug_state: False # Disables print state check for debugging. +description: Throws an error if print is not currently in progress. +gcode: + {% if not debug_state and + printer.idle_timeout.state|string != "Printing" and + not (printer.virtual_sdcard|default({})).is_active|default(False) and + not printer.pause_resume.is_paused %} + { action_raise_error("No active print.") } + {% endif %} + +[gcode_macro _km_check_and_set_print_bounds] +description: Validates all print bounds and caches their values. +gcode: + {% set km = printer["gcode_macro _km_globals"] %} + {% set print = printer["gcode_macro print_start_set"].print %} + + # Check the mesh bounds. + {% if print.MESH_MIN %} + {% set MESH_MIN = print.MESH_MIN.split(",")|map('float')|list %} + {% set MESH_MAX = print.MESH_MAX.split(",")|map('float')|list %} + {%if MESH_MIN[0] < km.print_min[0] or MESH_MIN[1] < km.print_min[1] %} + {action_raise_error("MESH_MIN %s is outside the printable bounds %s" % + (MESH_MIN|string, km.print_min|string))} + {%elif MESH_MAX[0] > km.print_max[0] or MESH_MAX[1] > km.print_max[1] %} + {action_raise_error("MESH_MAX %s is outside the printable bounds %s" % + (MESH_MAX|string, km.print_max|string))} + {% endif %} + {% endif %} + + # Find all the model bounds (including any bounds passed in). + {% set points = [] %} + {% if print.MODEL_MIN or print.MODEL_MAX %} + {% set MODEL_MIN = print.MODEL_MIN.split(",")|map('float')|list %} + {% set MODEL_MAX = print.MODEL_MAX.split(",")|map('float')|list %} + {% set points = [MODEL_MIN, MODEL_MAX] %} + {% endif %} + {% if (printer.exclude_object|default({})).objects %} + {% set points = printer.exclude_object.objects|selectattr('polygon')| + map(attribute='polygon')|sum(start=points) %} + {% set points_len = points|length %} + {% if points_len >= 2 %} + {% set x_coords = (points|map(attribute=0)|sort|list)[0::points_len-1] %} + {% set y_coords = (points|map(attribute=1)|sort|list)[0::points_len-1] %} + {% set MODEL_MIN = (x_coords[0],y_coords[0])|map('float')|list %} + {% set MODEL_MAX = (x_coords[1],y_coords[1])|map('float')|list %} + PRINT_START_SET MODEL_MIN="{MODEL_MIN|join(',') + }" MODEL_MAX="{MODEL_MAX|join(',')}" + {% endif %} + {% endif %} + + {% if MODEL_MIN %} + # Check the model bounds. + {% if MODEL_MIN[0] < km.print_min[0] or MODEL_MIN[1] < km.print_min[1] %} + {action_raise_error("MODEL_MIN %s is outside the printable bounds %s" % + (MODEL_MIN|string, km.print_min|string))} + {% elif MODEL_MAX[0] > km.print_max[0] or MODEL_MAX[1] > km.print_max[1] %} + {action_raise_error("MODEL_MAX %s is outside the printable bounds %s" % + (MODEL_MAX|string, km.print_max|string))} + {% endif %} + {% endif %} + + # Set the PRINT_LIMITS + {% if MESH_MIN and MODEL_MIN %} + PRINT_START_SET PRINT_MIN="{((MODEL_MIN[0],MESH_MIN[0])|min, + (MODEL_MIN[1],MESH_MIN[1])|min)|join(',') + }" PRINT_MAX="{((MODEL_MAX[0],MESH_MAX[0])|max, + (MODEL_MAX[1],MESH_MAX[1])|max)|join(',')}" + {% else %} + PRINT_START_SET PRINT_MIN="{km.print_min|join(',') + }" PRINT_MAX="{km.print_max|join(',')}" + {% endif %} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/state.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/state.cfg new file mode 100644 index 0000000..8c4535d --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/state.cfg @@ -0,0 +1,42 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro _km_save_state] +description: Tracks gcode state. +variable_state_set: {} +variable_is_ephemeral: 0 +gcode: + {% if params.SAVE|int %} + {% set dummy = state_set.__setitem__(params.NAME, None) %} + {% else %} + {% set dummy = state_set.__delitem__(params.NAME) %} + {% endif %} + SET_GCODE_VARIABLE MACRO=_km_save_state VARIABLE=is_ephemeral VALUE="{ + 1 if state_set|length > 0 else 0 }" + +[gcode_macro save_gcode_state] +description: Wraps SAVE_GCODE_STATE to track persistence state. + Usage: See Klipper documentation +rename_existing: _KM_SAVE_GCODE_STATE +gcode: + _KM_SAVE_GCODE_STATE {rawparams} + {% set NAME = params.NAME|default("default") %} + _km_save_state NAME={NAME} SAVE=1 + +[gcode_macro restore_gcode_state] +description: Wraps RESTORE_GCODE_STATE to track persistence state. + Usage: See Klipper documentation +rename_existing: _KM_RESTORE_GCODE_STATE +gcode: + _KM_RESTORE_GCODE_STATE {rawparams} + {% set NAME = params.NAME|default("default") %} + _km_save_state NAME={NAME} SAVE=0 + +[gcode_macro _abort_on_gcode_state] +gcode: + {% set save_state = printer["gcode_macro _km_save_state"] %} + {% if save_state.is_ephemeral %} + {action_raise_error("Encountered unexpected save state " + + save_state.state_set|list|sort|string)} + {% endif %} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/status_events.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/status_events.cfg new file mode 100644 index 0000000..1313759 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/status_events.cfg @@ -0,0 +1,152 @@ +# Copyright (C) 2023 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + + +[gcode_macro _km_print_status] +variable_last_status: 'none' +variable_status_stack: [] +variable_command_list: {} +variable_status_list: [ + 'ready', # Printer is ready to receive a job + 'filament_load', # Loading filament + 'filament_unload', # Unloading filament + 'bed_heating', # Waiting for the bed to reach target + 'chamber_heating', # Waiting for the chamber to reach target + 'homing', # Homing any axis + 'leveling_gantry', # Performing quad gantry-leveling + 'calibrating_z', # Performing z-tilt adjustment + 'meshing', # Calibrating a bed mesh + 'extruder_heating', # Waiting for the extruder to reach target + 'purging', # Printing purge line + 'printing', # Actively printing + 'pausing', # Print is paused + 'cancelling', # Print is being cancelled + 'completing', # Print completed + ] +gcode: + {% set ACTION = params.ACTION|trim|upper %} + {% set STATUS = params.STATUS|default("")|trim|lower %} + + # Add a status handler. + {% if ACTION == "ADD_EVENT" %} + {% set COMMAND = params.COMMAND %} + {% set ARGS = params.ARGS|default(0)|int != 0 %} + {% set TYPE = params.TYPE|default('ENTER')|trim|upper %} + {% set WHEN = params.WHEN|default('PRINTING')|trim|upper %} + {% set FILTER_ENTER = + (params.FILTER_ENTER|default("")|trim|lower).split(',')| + select()|unique|list %} + {% set FILTER_LEAVE = + (params.FILTER_LEAVE|default("")|trim|lower).split(',')| + select()|unique|list %} + + {% set STATUSES = STATUS.split(',')|map('trim')|list %} + {% for s in (STATUSES if STATUSES[0] != 'all' else status_list) %} + {% if not s in command_list %} + {% set dummy = command_list.__setitem__(s,[]) %} + {% endif %} + {% set dummy = command_list[s].append({'cmd':COMMAND, 'args':ARGS, + 'type':TYPE, 'when':WHEN, + 'filt_e':FILTER_ENTER, + 'filt_l':FILTER_LEAVE}) %} + {% endfor %} + + # Change the current status. + {% elif ACTION == "CHANGE" %} + {% if params.RESET_STACK|default(0)|int %} + {% for dummy in range(status_stack|length) %} + {% set dummy = status_stack.pop() %} + {% endfor %} + # TODO: Once python 3 is required, switch the for loop above to this: + #{% set dummy = status_stack.clear() %} + {% elif STATUS == "pop_status" %} + {% set STATUS = (status_stack|default(['ready'], True)).pop() %} + {% endif %} + + {% if STATUS not in status_list %} + {action_raise_error("Status '%s' not valid."|format(STATUS))} + {% endif %} + + {% if STATUS != last_status %} + {% set is_printing = + printer["gcode_macro print_start_set"].print.PRINT_START_PHASE| + default("")|length != 0 %} + {% set print_states = ('ALWAYS', 'PRINTING' if is_printing else 'IDLE') %} + # Process commands for the state we're leaving first. + {% for c in command_list[last_status]|default([]) %} + {% if c.type in ('BOTH','LEAVE') and c.when in print_states and + (not c.filt_l or STATUS in c.filt_l) %} + M400 + {c.cmd}{% if c.args %} TYPE=LEAVE WHEN={print_states[1] + } LAST_STATUS={last_status} NEXT_STATUS={STATUS}{% endif %} + {% endif %} + {% endfor %} + # Process commands for the state we're entering last. + {% for c in command_list[STATUS]|default([]) %} + {% if c.type in ('BOTH','ENTER') and c.when in print_states and + (not c.filt_e or STATUS in c.filt_e) %} + M400 + {c.cmd}{% if c.args %} TYPE=ENTER WHEN={print_states[1] + } LAST_STATUS={last_status} NEXT_STATUS={STATUS}{% endif %} + {% endif %} + {% endfor %} + SET_GCODE_VARIABLE MACRO=_km_print_status VARIABLE=last_status VALUE="'{ + STATUS}'" + {% endif %} + + # Push the current status onto the stack. + {% elif ACTION == "PUSH_STATUS" %} + {% set dummy = status_stack.append(last_status) %} + + # Illegal operation. + {% else %} + {action_raise_error("Action '%s' not valid."|format(ACTION))} + {% endif %} + +[gcode_macro gcode_on_print_status] +description: Adds a gcode command for a status event. + Usage: GCODE_ON_PRINT_STATUS STATUS= COMMAND= [ARGS=<1|0>] + [WHEN=] + [TYPE=] + [FILTER_ENTER=] + [FILTER_LEAVE=] +gcode: + {% set STATUS = (params.STATUS|lower).split(',')|map('trim')|list %} + {% set TYPE = params.TYPE|default('ENTER')|trim|upper %} + {% set WHEN = params.WHEN|default('PRINTING')|trim|upper %} + {% set FILTER_ENTER = + (params.FILTER_ENTER|default("")|trim|lower).split(',')|select()|list %} + {% set FILTER_LEAVE = + (params.FILTER_LEAVE|default("")|trim|lower).split(',')|select()|list %} + + # Error checking + {% set status_list = printer["gcode_macro _km_print_status"].status_list %} + {% for s in STATUS %} + {% if not (s in status_list or s == 'all' and STATUS|length == 1) %} + {action_raise_error("STATUS parameter '%s' not valid."|format(s))} + {% endif %} + {% endfor %} + + {% if TYPE not in ('ENTER', 'LEAVE', 'BOTH') %} + {action_raise_error("TYPE paramater '%s' not valid."|format(TYPE))} + {% elif WHEN not in ('PRINTING', 'IDLE', 'ALWAYS') %} + {action_raise_error("WHEN parameter '%s' not valid."|format(WHEN))} + {% elif TYPE == 'ENTER' and FILTER_LEAVE %} + {action_raise_error("FILTER_LEAVE not valid with TYPE=ENTER.")} + {% elif TYPE == 'LEAVE' and FILTER_ENTER %} + {action_raise_error("FILTER_ENTER not valid with TYPE=LEAVE.")} + {% endif %} + {% for f in FILTER_ENTER %} + {% if f not in status_list %} + {action_raise_error("FILTER_ENTER parameter '%s' not valid."|format(f))} + {% endif %} + {% endfor %} + {% for f in FILTER_LEAVE %} + {% if f not in status_list %} + {action_raise_error("FILTER_LEAVE parameter '%s' not valid."|format(f))} + {% endif %} + {% endfor %} + + # Run the command. + _KM_PRINT_STATUS ACTION=ADD_EVENT {rawparams} diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/velocity.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/velocity.cfg new file mode 100644 index 0000000..cb4a7c6 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-main/velocity.cfg @@ -0,0 +1,61 @@ +# Copyright (C) 2022 Justin Schuh +# +# This file may be distributed under the terms of the GNU GPLv3 license. + +[gcode_macro m201] +description: Sets maximum accelleration. + Usage: M201 [X] [Y] +variable_max_accel: 1.7976931348623157e+308 +gcode: + {% set km = printer["gcode_macro _km_globals"] %} + {% if 'X' in params or 'Y' in params %} + {% set accel = (params.X|default(params.Y)|float, + params.Y|default(params.X)|float)|min %} + SET_GCODE_VARIABLE MACRO=m201 VARIABLE=max_accel VALUE="{accel}" + {% else %} + SET_VELOCITY_LIMIT + {% endif %} + +[gcode_macro m203] +description: Sets maximum velocity. + Usage: M203 [X] [Y] +gcode: + {% if 'X' in params or 'Y' in params %} + {% set velocity = (params.X|default(params.Y)|float, + params.Y|default(params.X)|float)|min %} + SET_VELOCITY_LIMIT VELOCITY="{velocity}" + {% else %} + SET_VELOCITY_LIMIT + {% endif %} + +[gcode_macro m205] +description: Sets square corner velocity. + Usage: M203 [X] [Y] +gcode: + {% if 'X' in params or 'Y' in params %} + SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY="{ + (params.X|default(0)|float, params.Y|default(0)|float)|min}" + {% else %} + SET_VELOCITY_LIMIT + {% endif %} + +[gcode_macro m900] +description: Sets pressure advance. + Usage: M900 [K] [T] +gcode: + {% set km = printer["gcode_macro _km_globals"] %} + {% if km.pressure_advance_scale > 0.0 %} + {% set extruder = "extruder" ~ params.T|replace('0', '') + if "T" in params else printer.toolhead.extruder %} + {% if 'K' in params %} + SET_PRESSURE_ADVANCE EXTRUDER="{extruder}" ADVANCE="{ + params.K|float * km.pressure_advance_scale}" + {% endif %} + {% endif %} + + +[gcode_macro _reset_velocity_limits] +description: Sets maximum accelleration. + Usage: M204 [S] [P T] +gcode: + SET_GCODE_VARIABLE MACRO=m201 VARIABLE=max_accel VALUE="{1.7976931348623157e+308}" diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/LICENSE b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/README.md b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/README.md similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/README.md rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/README.md diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/bed_mesh_fast.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/bed_mesh_fast.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/bed_mesh_fast.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/bed_mesh_fast.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/bed_surface.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/bed_surface.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/bed_surface.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/bed_surface.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/beep.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/beep.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/beep.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/beep.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/draw.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/draw.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/draw.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/draw.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/fans.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/fans.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/fans.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/fans.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/filament.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/filament.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/filament.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/filament.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/globals.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/globals.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/globals.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/globals.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/heaters.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/heaters.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/heaters.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/heaters.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/idle.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/idle.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/idle.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/idle.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/kinematics.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/kinematics.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/kinematics.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/kinematics.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/layers.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/layers.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/layers.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/layers.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/optional/bed_mesh.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/optional/bed_mesh.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/optional/bed_mesh.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/optional/bed_mesh.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/optional/lcd_menus.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/optional/lcd_menus.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/optional/lcd_menus.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/optional/lcd_menus.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/park.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/park.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/park.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/park.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/pause_resume_cancel.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/pause_resume_cancel.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/pause_resume_cancel.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/pause_resume_cancel.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/start_end.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/start_end.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/start_end.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/start_end.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/state.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/state.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/state.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/state.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/velocity.cfg b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/velocity.cfg similarity index 100% rename from klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/velocity.cfg rename to klipper/DNV-TPU-Ender3/klipper_config/klipper-macros-oud/velocity.cfg diff --git a/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/.kinematics.cfg.swp b/klipper/DNV-TPU-Ender3/klipper_config/klipper-macros/.kinematics.cfg.swp deleted file mode 100644 index 05f3038b618a80c8587a0ae5a7dd62d4566e2534..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2O>7%Q6vrosZzxnCapLfBRGdiZCbe5gqqY>ap(@a{s7c9(qGi21wg>OdTD!B2 zP26(e)(b*H9Jq1e1QML!h(LfUapAy)0|-QhW_RDb z_j_+<9A#=Vm(HG}S*yZu?Pu)mC+F+mZ7#Bt?=aS^%Bt?Z(WR2kjUGwwU)2VuPd$Hn zy6UwfAr+6}>6S0rZ5~aZUbu8{@xs!6g~df(j8C405Aj$0YktLFa!(%L%<8#`=u_xjXcIaD{e2%}zd#>D??cz18Z-_4 zc`swvq0gWXp$_yM^cUj#9r_vi3Azrw1?hMdWG+L%5HJM(QvyVr2Z&2g)ak$#M!3#Y zX02x`hmRaO`YdkM!-!fWB(_a{B{QNQPOYE`gI;Ji!$8P} z?u6~Zk#x(Cc`+=SF<0B(Ii8#E#oXtvnkWldo}%*d%4&JC=ZjeNd@dWRNhfHgFfvYO z>$JgPMV1vcoy(jY*;P&LgU{-VeZ*ZhwC&H zZVx4BB(36=ak>yCl2e!{QcdvjBiQb08r&moyia7HEQ$~ZqE0(^jS-zWxE7MOg)V)g z?{k{X!ZRQQfUM3&hEXK_`0?#oUkFprDd3Kb(@=D50fO_VD8^0COM}&AqtVtlT;S9O z36zEoI2#;E9;o%~#&BIOMoC(>4L9`o9E-Sg0&epTjKkX8_89~NOR>}7X(z3nUnk45 zn8#x`5^W_yIY+NXPCHJ$!^|T$3<5{O+byThIgt;aOXo`&9FD_^Iw;k2)Gq0x4dMGF zLxm`dtTr4WExO2gI?hYkIY-PAHwm~@IK3E3!jE=9=SJ5>jbr)t z$STE}@74X#Q9Y*?Pa&h}SxzfEt63L5w~#%ZmUs=hK%N~}M{7rph>^1>3ZseA{MrHQ zaDAP4$K~9MX`~z3b54U?k6OzBvt5>B<1l!pJC|-P_>VxfPzvd-Lq-9NH!`yvo3#=<>Li%k)eUNEux zb@eROOK&7m`3ftXCG@6Pg kPEAr}rc$97G4-*BU38mClaA?q^W^JkSFC%mTn8uEKW|fzdH?_b diff --git a/klipper/DNV-TPU-Ender3/klipper_config/macros/jschuh_macros.cfg b/klipper/DNV-TPU-Ender3/klipper_config/macros/jschuh_macros.cfg index 73f627b..da477cb 100644 --- a/klipper/DNV-TPU-Ender3/klipper_config/macros/jschuh_macros.cfg +++ b/klipper/DNV-TPU-Ender3/klipper_config/macros/jschuh_macros.cfg @@ -5,14 +5,14 @@ # These are examples of some likely customizations: # Any sheets in the below list will be available with a configurable offset. #variable_bed_surfaces: ['smooth_1','texture_1'] -variable_print_min: (12, 30) # example: (0, 0) +variable_print_min: (12, 51) # example: (0, 0) variable_start_bed_heat_overshoot: 0.0 variable_park_x: 5.0 variable_park_y: 5.0 # Length (in mm) of filament to load (bowden tubes will be longer). variable_load_length: 50.0 # Hide the Octoprint LCD menu since I don't use it. -#variable_menu_show_octoprint: False +variable_menu_show_octoprint: False # Customize the filament menus (up to 10 entries). variable_menu_temperature: [ {'name' : 'TPU', 'extruder' : 220.0, 'bed' : 45.0}, @@ -20,22 +20,22 @@ variable_menu_temperature: [ {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0}, {'name' : 'ABS', 'extruder' : 245.0, 'bed' : 110.0, 'chamber' : 60}] # Length of filament (in millimeters) to purge at print start. -#variable_start_purge_length: 30 # This value works for most setups. +variable_start_purge_length: 30 # This value works for most setups. gcode: # This line is required by Klipper. # Any code you put here will run at klipper startup, after the initialization # for these macros. For example, you could uncomment the following line to # automatically adjust your bed surface offsets to account for any changes made # to your Z endstop or probe offset. # ADJUST_SURFACE_OFFSETS - M118 Einde gcode_macro _km_options + # This line includes all the standard macros. -[include ../klipper-macros/*.cfg] +[include ../klipper-macros-main/*.cfg] # Uncomment to include features that require specific hardware support. # LCD menu support for features like bed surface selection and pause next layer. -[include ../klipper-macros/optional/lcd_menus.cfg] +[include ../klipper-macros-main/optional/lcd_menus.cfg] # Optimized bed leveling -[include ../klipper-macros/optional/bed_mesh.cfg] +[include ../klipper-macros-main/optional/bed_mesh.cfg] # The sections below here are required for the macros to work. If your config # already has some of these sections you should merge the duplicates into one @@ -55,7 +55,7 @@ filename: ~/printer_data/variables.cfg # UPDATE THIS FOR YOUR PATH!!! #[virtual_sdcard] #path: ~/gcode_files # UPDATE THIS FOR YOUR PATH!!! -[display_status] +#[display_status] # Uncomment the sections below if Fluidd complains (because it's confused). [gcode_macro CANCEL_PRINT] diff --git a/klipper/DNV-TPU-Ender3/klipper_config/printer-20220104_172505.cfg b/klipper/DNV-TPU-Ender3/klipper_config/printer-20220104_172505.cfg deleted file mode 100644 index 2e4591a..0000000 --- a/klipper/DNV-TPU-Ender3/klipper_config/printer-20220104_172505.cfg +++ /dev/null @@ -1,907 +0,0 @@ -# This file contains common pin mappings for the BIGTREETECH SKR mini -# E3 v1.2. To use this config, the firmware should be compiled for the -# STM32F103 with a "28KiB bootloader" and USB communication. Also, -# select "Enable extra low-level configuration options" and configure -# "GPIO pins to set at micro-controller startup" to "!PC13". - -# The "make flash" command does not work on the SKR mini E3. Instead, -# after running "make", copy the generated "out/klipper.bin" file to a -# file named "firmware.bin" on an SD card and then restart the SKR -# mini E3 with that SD card. - -# See docs/Config_Reference.md for a description of parameters. - -# Note: This board has a design flaw in its thermistor circuits that -# cause inaccurate temperatures (most noticeable at low temperatures). - -[stepper_x] -step_pin: PB13 -dir_pin: !PB12 -enable_pin: !PB14 -microsteps: 16 -rotation_distance: 40 -endstop_pin: ^PC0 -position_endstop: 0 -position_max: 235 -homing_speed: 50 - -[tmc2209 stepper_x] -uart_pin: PB15 -run_current: 0.580 -stealthchop_threshold: 999999 - -[stepper_y] -step_pin: PB10 -dir_pin: !PB2 -enable_pin: !PB11 -microsteps: 16 -rotation_distance: 40 -endstop_pin: ^PC1 -position_endstop: 0 -position_max: 235 -homing_speed: 50 - -[tmc2209 stepper_y] -uart_pin: PC6 -run_current: 0.580 -stealthchop_threshold: 999999 - -[stepper_z] -step_pin: PB0 -dir_pin: PC5 -enable_pin: !PB1 -microsteps: 16 -rotation_distance: 8 -endstop_pin: ^PC2 -position_endstop: 0.0 -position_max: 250 - -[tmc2209 stepper_z] -uart_pin: PC10 -run_current: 0.580 -stealthchop_threshold: 999999 - -[bltouch] -sensor_pin: ^PC14 ;mine uses the Z pin for sensor -control_pin: PA1 -pin_up_reports_not_triggered: False -pin_up_touch_mode_reports_triggered: False -x_offset: 32.4 -y_offset: -34.9 -z_offset: 1.6 -pin_move_time: 1.5 - -[extruder] -# DropEffect OmniaDrop V2.1 -step_pin: PB3 -dir_pin: !PB4 -enable_pin: !PD2 -microsteps: 16 -gear_ratio: 5:1 -rotation_distance: 33.500 -nozzle_diameter: 0.400 -filament_diameter: 1.750 -heater_pin: PC8 -sensor_type: EPCOS 100K B57560G104F -sensor_pin: PA0 -control: pid -pid_Kp: 21.527 -pid_Ki: 1.063 -pid_Kd: 108.982 -min_temp: 0 -max_temp: 285 - -[tmc2209 extruder] -uart_pin: PC11 -run_current: 0.500 -stealthchop_threshold: 999999 - -[heater_bed] -heater_pin: PC9 -sensor_type: EPCOS 100K B57560G104F -sensor_pin: PC3 -control: pid -pid_Kp: 54.027 -pid_Ki: 0.770 -pid_Kd: 948.182 -min_temp: 0 -max_temp: 130 - -[fan] -pin: PA8 - -[mcu] -serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_32FFDA054158323011792557-if00 - -[printer] -kinematics: cartesian -max_velocity: 300 -max_accel: 3000 -max_z_velocity: 5 -max_z_accel: 100 - -[static_digital_output usb_pullup_enable] -pins: !PC13 - -[board_pins] -aliases: - # EXP1 header - EXP1_1=PB5, EXP1_3=PA9, EXP1_5=PA10, EXP1_7=PB8, EXP1_9=, - EXP1_2=PB6, EXP1_4=, EXP1_6=PB9, EXP1_8=PB7, EXP1_10=<5V> - -# See the sample-lcd.cfg file for definitions of common LCD displays. - -[display] -lcd_type: st7920 -cs_pin: EXP1_7 -sclk_pin: EXP1_6 -sid_pin: EXP1_8 -encoder_pins: ^EXP1_5, ^EXP1_3 -click_pin: ^!EXP1_2 - -[output_pin beeper] -pin: EXP1_1 - -[virtual_sdcard] -path: ~/gcode_files - -[display_status] - -[pause_resume] - -[gcode_macro PAUSE] -description: Pause the actual running print -rename_existing: PAUSE_BASE -# change this if you need more or less extrusion -variable_extrude: 1.0 -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - ##### set park positon for x and y ##### - # default is your max posion from your printer.cfg - {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} - {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} - ##### calculate save lift position ##### - {% set max_z = printer.toolhead.axis_maximum.z|float %} - {% set act_z = printer.toolhead.position.z|float %} - {% if act_z < (max_z - 2.0) %} - {% set z_safe = 2.0 %} - {% else %} - {% set z_safe = max_z - act_z %} - {% endif %} - ##### end of definitions ##### - PAUSE_BASE - G91 - {% if printer.extruder.can_extrude|lower == 'true' %} - G1 E-{E} F2100 - {% else %} - {action_respond_info("Extruder not hot enough")} - {% endif %} - {% if "xyz" in printer.toolhead.homed_axes %} - G1 Z{z_safe} F900 - G90 - G1 X{x_park} Y{y_park} F6000 - {% else %} - {action_respond_info("Printer not homed")} - {% endif %} - -[gcode_macro RESUME] -description: Resume the actual running print -rename_existing: RESUME_BASE -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - #### get VELOCITY parameter if specified #### - {% if 'VELOCITY' in params|upper %} - {% set get_params = ('VELOCITY=' + params.VELOCITY) %} - {%else %} - {% set get_params = "" %} - {% endif %} - ##### end of definitions ##### - {% if printer.extruder.can_extrude|lower == 'true' %} - G91 - G1 E{E} F2100 - {% else %} - {action_respond_info("Extruder not hot enough")} - {% endif %} - RESUME_BASE {get_params} - -[gcode_macro CANCEL_PRINT] -description: Cancel the actual running print -rename_existing: CANCEL_PRINT_BASE -gcode: - TURN_OFF_HEATERS - CANCEL_PRINT_BASE - -# The print bed can move so far to the front, that the nozzle can reach the -# plastic cover of the print bed heater cable (only when the bed is moved by -# hand). By homing the Y axis before the X axis, it is ensured the nozzle will -# not melt through the plastic part. -# BEWARE: You will lose the ability to home axes individually. The printer will -# always home all axes for every G28 command. -#[homing_override] -#gcode: -# G28 Y0 -# G28 X0 -# G28 Z0 - -[bed_screws] -screw1: 32,32 -screw2: 203,32 -screw3: 203,203 -screw4: 32,203 -screw5: 117,117 - -### menu main ### -[menu __main] -type: list -name: Main - -### menu tune ### -[menu __main __tune] -type: list -enable: {printer.idle_timeout.state == "Printing"} -name: Tune - -[menu __main __tune __speed] -type: input -name: Speed: {'%3d' % (menu.input*100)}% -input: {printer.gcode_move.speed_factor} -input_min: 0.01 -input_max: 5 -input_step: 0.01 -realtime: True -gcode: - M220 S{'%d' % (menu.input*100)} - -[menu __main __tune __flow] -type: input -name: Flow: {'%3d' % (menu.input*100)}% -input: {printer.gcode_move.extrude_factor} -input_min: 0.01 -input_max: 2 -input_step: 0.01 -realtime: True -gcode: - M221 S{'%d' % (menu.input*100)} - -[menu __main __tune __offsetz] -type: input -name: Offset Z:{'%05.3f' % menu.input} -input: {printer.gcode_move.homing_origin.z} -input_min: -5 -input_max: 5 -input_step: 0.005 -realtime: True -gcode: - SET_GCODE_OFFSET Z={'%.3f' % menu.input} MOVE=1 - - -### menu octoprint ### -[menu __main __octoprint] -type: list -name: OctoPrint - -[menu __main __octoprint __pause] -type: command -enable: {printer.idle_timeout.state == "Printing"} -name: Pause printing -gcode: - {action_respond_info('action:pause')} - -[menu __main __octoprint __resume] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Resume printing -gcode: - {action_respond_info('action:resume')} - -[menu __main __octoprint __abort] -type: command -enable: {printer.idle_timeout.state == "Printing"} -name: Abort printing -gcode: - {action_respond_info('action:cancel')} - -### menu virtual sdcard ### -[menu __main __sdcard] -type: vsdlist -enable: {('virtual_sdcard' in printer)} -name: SD Card - -[menu __main __sdcard __start] -type: command -enable: {('virtual_sdcard' in printer) and printer.virtual_sdcard.file_path and not printer.virtual_sdcard.is_active} -name: Start printing -gcode: M24 - -[menu __main __sdcard __resume] -type: command -enable: {('virtual_sdcard' in printer) and printer.print_stats.state == "paused"} -name: Resume printing -gcode: - {% if "pause_resume" in printer %} - RESUME - {% else %} - M24 - {% endif %} - -[menu __main __sdcard __pause] -type: command -enable: {('virtual_sdcard' in printer) and printer.print_stats.state == "printing"} -name: Pause printing -gcode: - {% if "pause_resume" in printer %} - PAUSE - {% else %} - M25 - {% endif %} - -[menu __main __sdcard __cancel] -type: command -enable: {('virtual_sdcard' in printer) and (printer.print_stats.state == "printing" or printer.print_stats.state == "paused")} -name: Cancel printing -gcode: - {% if 'pause_resume' in printer %} - CANCEL_PRINT - {% else %} - M25 - M27 - M26 S0 - TURN_OFF_HEATERS - {% if printer.toolhead.position.z <= printer.toolhead.axis_maximum.z - 5 %} - G91 - G0 Z5 F1000 - G90 - {% endif %} - {% endif %} - -### menu control ### -[menu __main __control] -type: list -name: Control - -[menu __main __control __home] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home All -gcode: G28 - -[menu __main __control __homez] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home Z -gcode: G28 Z - -[menu __main __control __homexy] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home X/Y -gcode: G28 X Y - -[menu __main __control __disable] -type: command -name: Steppers off -gcode: - M84 - M18 - -[menu __main __control __fanonoff] -type: input -enable: {'fan' in printer} -name: Fan: {'ON ' if menu.input else 'OFF'} -input: {printer.fan.speed} -input_min: 0 -input_max: 1 -input_step: 1 -gcode: - M106 S{255 if menu.input else 0} - -[menu __main __control __fanspeed] -type: input -enable: {'fan' in printer} -name: Fan speed: {'%3d' % (menu.input*100)}% -input: {printer.fan.speed} -input_min: 0 -input_max: 1 -input_step: 0.01 -gcode: - M106 S{'%d' % (menu.input*255)} - -[menu __main __control __caselightonoff] -type: input -enable: {'output_pin caselight' in printer} -name: Lights: {'ON ' if menu.input else 'OFF'} -input: {printer['output_pin caselight'].value} -input_min: 0 -input_max: 1 -input_step: 1 -gcode: - SET_PIN PIN=caselight VALUE={1 if menu.input else 0} - -[menu __main __control __caselightpwm] -type: input -enable: {'output_pin caselight' in printer} -name: Lights: {'%3d' % (menu.input*100)}% -input: {printer['output_pin caselight'].value} -input_min: 0.0 -input_max: 1.0 -input_step: 0.01 -gcode: - SET_PIN PIN=caselight VALUE={menu.input} - -### menu move 10mm ### -[menu __main __control __move_10mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Move 10mm - -[menu __main __control __move_10mm __axis_x] -type: input -name: Move X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_y] -type: input -name: Move Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Move Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Move E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu move 1mm ### -[menu __main __control __move_1mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Move 1mm - -[menu __main __control __move_1mm __axis_x] -type: input -name: Move X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_y] -type: input -name: Move Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Move Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Move E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu move 0.1mm ### -[menu __main __control __move_01mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Move 0.1mm - -[menu __main __control __move_01mm __axis_x] -type: input -name: Move X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_y] -type: input -name: Move Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Move Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Move E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu temperature ### -[menu __main __temp] -type: list -name: Temperature - -[menu __main __temp __hotend0_target] -type: input -enable: {('extruder' in printer) and ('extruder' in printer.heaters.available_heaters)} -name: {"Ex0:%3.0f (%4.0f)" % (menu.input, printer.extruder.temperature)} -input: {printer.extruder.target} -input_min: 0 -input_max: {printer.configfile.config.extruder.max_temp} -input_step: 1 -gcode: M104 T0 S{'%.0f' % menu.input} - -[menu __main __temp __hotend1_target] -type: input -enable: {('extruder1' in printer) and ('extruder1' in printer.heaters.available_heaters)} -name: {"Ex1:%3.0f (%4.0f)" % (menu.input, printer.extruder1.temperature)} -input: {printer.extruder1.target} -input_min: 0 -input_max: {printer.configfile.config.extruder1.max_temp} -input_step: 1 -gcode: M104 T1 S{'%.0f' % menu.input} - -[menu __main __temp __hotbed_target] -type: input -enable: {'heater_bed' in printer} -name: {"Bed:%3.0f (%4.0f)" % (menu.input, printer.heater_bed.temperature)} -input: {printer.heater_bed.target} -input_min: 0 -input_max: {printer.configfile.config.heater_bed.max_temp} -input_step: 1 -gcode: M140 S{'%.0f' % menu.input} - -[menu __main __temp __preheat_pla] -type: list -name: Preheat PLA - -[menu __main __temp __preheat_pla __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Preheat all -gcode: - M140 S60 - M104 S200 - -[menu __main __temp __preheat_pla __hotend] -type: command -enable: {'extruder' in printer} -name: Preheat hotend -gcode: M104 S200 - -[menu __main __temp __preheat_pla __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Preheat hotbed -gcode: M140 S60 - -[menu __main __temp __preheat_abs] -type: list -name: Preheat ABS - -[menu __main __temp __preheat_abs __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Preheat all -gcode: - M140 S110 - M104 S245 - -[menu __main __temp __preheat_abs __hotend] -type: command -enable: {'extruder' in printer} -name: Preheat hotend -gcode: M104 S245 - -[menu __main __temp __preheat_abs __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Preheat hotbed -gcode: M140 S110 - -[menu __main __temp __cooldown] -type: list -name: Cooldown - -[menu __main __temp __cooldown __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Cooldown all -gcode: - M104 S0 - M140 S0 - -[menu __main __temp __cooldown __hotend] -type: command -enable: {'extruder' in printer} -name: Cooldown hotend -gcode: M104 S0 - -[menu __main __temp __cooldown __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Cooldown hotbed -gcode: M140 S0 - -### menu filament ### - -[menu __main __filament] -type: list -name: Filament - -[menu __main __filament __hotend0_target] -type: input -enable: {'extruder' in printer} -name: {"Ex0:%3.0f (%4.0f)" % (menu.input, printer.extruder.temperature)} -input: {printer.extruder.target} -input_min: 0 -input_max: {printer.configfile.config.extruder.max_temp} -input_step: 1 -gcode: M104 T0 S{'%.0f' % menu.input} - -[menu __main __filament __loadf] -type: command -name: Load Fil. fast -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E50 F960 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __loads] -type: command -name: Load Fil. slow -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E50 F240 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __unloadf] -type: command -name: Unload Fil.fast -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E-50 F960 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __unloads] -type: command -name: Unload Fil.slow -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E-50 F240 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __feed] -type: input -name: Feed: {'%.1f' % menu.input} -input: 5 -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E{'%.1f' % menu.input} F60 - RESTORE_GCODE_STATE NAME=__filament__load - -### menu setup ### -[menu __main __setup] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Setup - -[menu __main __setup __save_config] -type: command -name: Save config -gcode: SAVE_CONFIG - -[menu __main __setup __restart] -type: list -name: Restart - -[menu __main __setup __restart __host_restart] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Restart host -gcode: RESTART - -[menu __main __setup __restart __firmware_restart] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Restart FW -gcode: FIRMWARE_RESTART - -[menu __main __setup __tuning] -type: list -name: PID tuning - -[menu __main __setup __tuning __hotend_pid_tuning] -type: command -enable: {(not printer.idle_timeout.state == "Printing") and ('extruder' in printer)} -name: Tune Hotend PID -gcode: PID_CALIBRATE HEATER=extruder TARGET=210 WRITE_FILE=1 - -[menu __main __setup __tuning __hotbed_pid_tuning] -type: command -enable: {(not printer.idle_timeout.state == "Printing") and ('heater_bed' in printer)} -name: Tune Hotbed PID -gcode: PID_CALIBRATE HEATER=heater_bed TARGET=60 WRITE_FILE=1 - -[menu __main __setup __calib] -type: list -name: Calibration - -[menu __main __setup __calib __delta_calib_auto] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Delta cal. auto -gcode: - G28 - DELTA_CALIBRATE - -[menu __main __setup __calib __delta_calib_man] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Delta cal. man - -[menu __main __setup __calib __bedprobe] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Bed probe -gcode: PROBE - -[menu __main __setup __calib __delta_calib_man __start] -type: command -name: Start probing -gcode: - G28 - DELTA_CALIBRATE METHOD=manual - -[menu __main __setup __calib __delta_calib_man __move_z] -type: input -name: Move Z: {'%03.2f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_step: 1 -realtime: True -gcode: - {%- if menu.event == 'change' -%} - G1 Z{'%.2f' % menu.input} - {%- elif menu.event == 'long_click' -%} - G1 Z{'%.2f' % menu.input} - SAVE_GCODE_STATE NAME=__move__axis - G91 - G1 Z2 - G1 Z-2 - RESTORE_GCODE_STATE NAME=__move__axis - {%- endif -%} - -[menu __main __setup __calib __delta_calib_man __test_z] -type: input -name: Test Z: {['++','+','+.01','+.05','+.1','+.5','-.5','-.1','-.05','-.01','-','--'][menu.input|int]} -input: 6 -input_min: 0 -input_max: 11 -input_step: 1 -gcode: - {%- if menu.event == 'long_click' -%} - TESTZ Z={['++','+','+.01','+.05','+.1','+.5','-.5','-.1','-.05','-.01','-','--'][menu.input|int]} - {%- endif -%} - -[menu __main __setup __calib __delta_calib_man __accept] -type: command -name: Accept -gcode: ACCEPT - -[menu __main __setup __calib __delta_calib_man __abort] -type: command -name: Abort -gcode: ABORT - -[menu __main __setup __dump] -type: command -name: Dump parameters -gcode: - {% for name1 in printer %} - {% for name2 in printer[name1] %} - { action_respond_info("printer['%s'].%s = %s" - % (name1, name2, printer[name1][name2])) } - {% else %} - { action_respond_info("printer['%s'] = %s" % (name1, printer[name1])) } - {% endfor %} - {% endfor %} \ No newline at end of file diff --git a/klipper/DNV-TPU-Ender3/klipper_config/printer-20230405_194210.cfg b/klipper/DNV-TPU-Ender3/klipper_config/printer-20230405_194210.cfg deleted file mode 100644 index aea3c5c..0000000 --- a/klipper/DNV-TPU-Ender3/klipper_config/printer-20230405_194210.cfg +++ /dev/null @@ -1,1009 +0,0 @@ -# This file contains common pin mappings for the BIGTREETECH SKR mini -# E3 v1.2. To use this config, the firmware should be compiled for the -# STM32F103 with a "28KiB bootloader" and USB communication. Also, -# select "Enable extra low-level configuration options" and configure -# "GPIO pins to set at micro-controller startup" to "!PC13". - -# The "make flash" command does not work on the SKR mini E3. Instead, -# after running "make", copy the generated "out/klipper.bin" file to a -# file named "firmware.bin" on an SD card and then restart the SKR -# mini E3 with that SD card. - -# See docs/Config_Reference.md for a description of parameters. - -# Note: This board has a design flaw in its thermistor circuits that -# cause inaccurate temperatures (most noticeable at low temperatures). - -# Met de DropEffect OmniDrop V2.1 is het punt links-beneden (dus het 0-punt): X = 12 en Y = 30 - -# Invoegen van macros. Deze komen uit: https://github.com/jschuh/klipper-macros -[include jschuh_macros.cfg] - -[stepper_x] -step_pin: PB13 -dir_pin: !PB12 -enable_pin: !PB14 -microsteps: 16 -rotation_distance: 40 -endstop_pin: ^PC0 -position_endstop: -13.5 -position_min: -13.5 -position_max: 221.5 -homing_speed: 50 - -[tmc2209 stepper_x] -uart_pin: PB15 -run_current: 0.580 -hold_current: 0.500 -stealthchop_threshold: 250 - -[stepper_y] -step_pin: PB10 -dir_pin: !PB2 -enable_pin: !PB11 -microsteps: 16 -rotation_distance: 40 -endstop_pin: ^PC1 -position_endstop: -9 -position_min: -9 -position_max: 226 -homing_speed: 50 - -[tmc2209 stepper_y] -uart_pin: PC6 -run_current: 0.580 -hold_current: 0.500 -stealthchop_threshold: 250 - -[stepper_z] -step_pin: PB0 -dir_pin: PC5 -enable_pin: !PB1 -microsteps: 16 -rotation_distance: 8 -endstop_pin: ^PC2 -position_endstop: 0 -position_max: 250 - -[tmc2209 stepper_z] -uart_pin: PC10 -run_current: 0.580 -hold_current: 0.500 -stealthchop_threshold: 5 - -[bltouch] -sensor_pin: ^PC14 -control_pin: PA1 -#pin_up_reports_not_triggered: False -#pin_up_touch_mode_reports_triggered: False -x_offset: 33.7 -y_offset: -33.5 -#z_offset: 2.68 -pin_move_time: 0.680 - -[bed_screws] -screw1: 29,31 -screw2: 196,31 -screw3: 196,206 -screw4: 29,206 -#screw5: 117,117 - -[bed_mesh] -speed: 80 -horizontal_move_z: 5 -mesh_min: 25,10 -mesh_max: 200,170 -probe_count: 5,5 - -[extruder] -# DropEffect OmniaDrop V2.1 -step_pin: PB3 -dir_pin: PB4 -enable_pin: !PD2 -microsteps: 16 -gear_ratio: 5:1 -rotation_distance: 32.160 -nozzle_diameter: 0.400 -filament_diameter: 1.750 -heater_pin: PC8 -sensor_type: EPCOS 100K B57560G104F -sensor_pin: PA0 -#control: pid -#pid_Kp: 21.527 -#pid_Ki: 1.063 -#pid_Kd: 108.982 -min_temp: 0 -max_temp: 285 - -[tmc2209 extruder] -uart_pin: PC11 -run_current: 0.500 -hold_current: 0.400 -stealthchop_threshold: 5 - -[heater_fan my_nozzle_fan] -# Aansturing via PT-DET pinout -pin: PC12 -heater: extruder -heater_temp: 50.0 -fan_speed: 1.0 - -[heater_bed] -heater_pin: PC9 -sensor_type: EPCOS 100K B57560G104F -sensor_pin: PC3 -#control: pid -#pid_Kp: 54.027 -#pid_Ki: 0.770 -#pid_Kd: 948.182 -min_temp: 0 -max_temp: 130 - -[fan] -pin: PA8 - -[mcu] -serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_32FFDA054158323011792557-if00 - -[printer] -kinematics: cartesian -max_velocity: 300 -max_accel: 3000 -max_z_velocity: 5 -max_z_accel: 100 - -[neopixel ledjes] -pin: PC7 -# The pin connected to the neopixel. This parameter must be -# provided. -chain_count: 6 -# The number of Neopixel chips that are "daisy chained" to the -# provided pin. The default is 1 (which indicates only a single -# Neopixel is connected to the pin). -color_order: GRB -# Set the pixel order required by the LED hardware (using a string -# containing the letters R, G, B, W with W optional). Alternatively, -# this may be a comma separated list of pixel orders - one for each -# LED in the chain. The default is GRB. -initial_RED: 1.0 -initial_GREEN: 1.0 -initial_BLUE: 1.0 -#initial_WHITE: 0.0 -# See the "led" section for information on these parameters. - -#[include neopixels.cfg] - -[static_digital_output usb_pullup_enable] -pins: !PC13 - -[board_pins] -aliases: - # EXP1 header - EXP1_1=PB5, EXP1_3=PA9, EXP1_5=PA10, EXP1_7=PB8, EXP1_9=, - EXP1_2=PB6, EXP1_4=, EXP1_6=PB9, EXP1_8=PB7, EXP1_10=<5V> - -# See the sample-lcd.cfg file for definitions of common LCD displays. - -[display] -lcd_type: st7920 -cs_pin: EXP1_7 -sclk_pin: EXP1_6 -sid_pin: EXP1_8 -encoder_pins: ^EXP1_5, ^EXP1_3 -click_pin: ^!EXP1_2 - -[output_pin beeper] -pin: EXP1_1 - -[virtual_sdcard] -path: ~/printer_data/gcodes - -[display_status] - -[pause_resume] - -[gcode_macro PAUSE] -description: Pause the actual running print -rename_existing: PAUSE_BASE -# change this if you need more or less extrusion -variable_extrude: 1.0 -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - ##### set park positon for x and y ##### - # default is your max posion from your printer.cfg - {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} - {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} - ##### calculate save lift position ##### - {% set max_z = printer.toolhead.axis_maximum.z|float %} - {% set act_z = printer.toolhead.position.z|float %} - {% if act_z < (max_z - 2.0) %} - {% set z_safe = 2.0 %} - {% else %} - {% set z_safe = max_z - act_z %} - {% endif %} - ##### end of definitions ##### - PAUSE_BASE - G91 - {% if printer.extruder.can_extrude|lower == 'true' %} - G1 E-{E} F2100 - {% else %} - {action_respond_info("Extruder not hot enough")} - {% endif %} - {% if "xyz" in printer.toolhead.homed_axes %} - G1 Z{z_safe} F900 - G90 - G1 X{x_park} Y{y_park} F6000 - {% else %} - {action_respond_info("Printer not homed")} - {% endif %} - -[gcode_macro RESUME] -description: Resume the actual running print -rename_existing: RESUME_BASE -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - #### get VELOCITY parameter if specified #### - {% if 'VELOCITY' in params|upper %} - {% set get_params = ('VELOCITY=' + params.VELOCITY) %} - {%else %} - {% set get_params = "" %} - {% endif %} - ##### end of definitions ##### - {% if printer.extruder.can_extrude|lower == 'true' %} - G91 - G1 E{E} F2100 - {% else %} - {action_respond_info("Extruder not hot enough")} - {% endif %} - RESUME_BASE {get_params} - -[gcode_macro CANCEL_PRINT] -description: Cancel the actual running print -rename_existing: CANCEL_PRINT_BASE -gcode: - TURN_OFF_HEATERS - CANCEL_PRINT_BASE - -# The print bed can move so far to the front, that the nozzle can reach the -# plastic cover of the print bed heater cable (only when the bed is moved by -# hand). By homing the Y axis before the X axis, it is ensured the nozzle will -# not melt through the plastic part. -# BEWARE: You will lose the ability to home axes individually. The printer will -# always home all axes for every G28 command. -#[homing_override] -#gcode: -# G28 Y0 -# G28 X0 -# G28 Z0 - -# ================================================================================ -# GCode Macro: START_PRINT -# Add START_PRINT in your slicers starting script. -# ================================================================================ -[gcode_macro START_PRINT] -gcode: - G28; Home all axes - BED_MESH_CALIBRATE - G92 E0; Reset Extruder - G1 Z25.0 F3000; Move Z Axis up little to prevent scratching of Heat Bed - G1 X0.1 Y20 Z0.3 F5000.0; Move to start position - G1 X0.1 Y200.0 Z0.3 F1500.0 E15; Draw the first line - G1 X0.4 Y200.0 Z0.3 F5000.0; Move to side a little - G1 X0.4 Y20 Z0.3 F1500.0 E30; Draw the second line - G92 E0; Reset Extruder - G1 Z25.0 F3000; Move Z Axis up little to prevent scratching of Heat Bed - M118 punt gcode_macro START_PRINT - -# ================================================================================ -# GCode Macro: END_PRINT -# Add END_PRINT in your slicers ending script -# ================================================================================ -[gcode_macro END_PRINT] -gcode: - G91; Relative Positioning - G1 Z+10; Move Z up so it doesn't hit anything - G90; Absolute Positioning - G1 Y190 F1500; bring Y up front -# G10 ; set tool offset? or retract? -# G1 E-10 F300; Retrack-10 - G1 X10 Y220 F2000; Move to X10, Y220 - M104 S0; Turn off Extruder temperature (set it to 0) - M140 S0; Turn off Bed temperature (set it to 0) - M106 S0; turn off cooling fan - M84; Disable steppers -# ================================================================================ -# GCode Macro G29 -# Fires when G29 is sent to the printer -# ================================================================================ -#[gcode_macro G29] -#gcode: -# G1 Z10 F600 -# G4 P200 -# G1 Z10 F600 -# G4 P100 - -### Raspberry Pi als MCU om de GPIO te gebruiken voor in- en output - -[mcu rpi] -serial: /tmp/klipper_host_mcu - -[adxl345] -cs_pin: rpi:None - -[resonance_tester] -accel_chip: adxl345 -probe_points: - 100, 100, 20 # an example - -### input-shaper waardes verkregen via adxl345 tuning -[input_shaper] -shaper_freq_x: 69.8 -shaper_type_x: mzv -shaper_freq_y: 41.4 -shaper_type_y: ei - -### menu main ### -[menu __main] -type: list -name: Main - -### menu tune ### -[menu __main __tune] -type: list -enable: {printer.idle_timeout.state == "Printing"} -name: Afstellen - -[menu __main __tune __speed] -type: input -name: Snelheid: {'%3d' % (menu.input*100)}% -input: {printer.gcode_move.speed_factor} -input_min: 0.01 -input_max: 5 -input_step: 0.01 -realtime: True -gcode: - M220 S{'%d' % (menu.input*100)} - -[menu __main __tune __flow] -type: input -name: Flow: {'%3d' % (menu.input*100)}% -input: {printer.gcode_move.extrude_factor} -input_min: 0.01 -input_max: 2 -input_step: 0.01 -realtime: True -gcode: - M221 S{'%d' % (menu.input*100)} - -[menu __main __tune __offsetz] -type: input -name: Offset Z:{'%05.3f' % menu.input} -input: {printer.gcode_move.homing_origin.z} -input_min: -5 -input_max: 5 -input_step: 0.005 -realtime: True -gcode: - SET_GCODE_OFFSET Z={'%.3f' % menu.input} MOVE=1 - -### menu virtual sdcard ### -[menu __main __sdcard] -type: vsdlist -enable: {('virtual_sdcard' in printer)} -name: SD Kaart - -[menu __main __sdcard __start] -type: command -enable: {('virtual_sdcard' in printer) and printer.virtual_sdcard.file_path and not printer.virtual_sdcard.is_active} -name: Start printen -gcode: M24 - -[menu __main __sdcard __resume] -type: command -enable: {('virtual_sdcard' in printer) and printer.print_stats.state == "paused"} -name: Herstart printen -gcode: - {% if "pause_resume" in printer %} - RESUME - {% else %} - M24 - {% endif %} - -[menu __main __sdcard __pause] -type: command -enable: {('virtual_sdcard' in printer) and printer.print_stats.state == "printing"} -name: Pauseer printen -gcode: - {% if "pause_resume" in printer %} - PAUSE - {% else %} - M25 - {% endif %} - -[menu __main __sdcard __cancel] -type: command -enable: {('virtual_sdcard' in printer) and (printer.print_stats.state == "printing" or printer.print_stats.state == "paused")} -name: Annuleer printen -gcode: - {% if 'pause_resume' in printer %} - CANCEL_PRINT - {% else %} - M25 - M27 - M26 S0 - TURN_OFF_HEATERS - {% if printer.toolhead.position.z <= printer.toolhead.axis_maximum.z - 5 %} - G91 - G0 Z5 F1000 - G90 - {% endif %} - {% endif %} - -### menu control ### -[menu __main __control] -type: list -name: Control - -[menu __main __control __home] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home All -gcode: G28 - -[menu __main __control __homez] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home Z -gcode: G28 Z - -[menu __main __control __homexy] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home X/Y -gcode: G28 X Y - -[menu __main __control __disable] -type: command -name: Steppers uit -gcode: - M84 - M18 - -[menu __main __control __fanonoff] -type: input -enable: {'fan' in printer} -name: Koeling: {'ON ' if menu.input else 'OFF'} -input: {printer.fan.speed} -input_min: 0 -input_max: 1 -input_step: 1 -gcode: - M106 S{255 if menu.input else 0} - -[menu __main __control __fanspeed] -type: input -enable: {'fan' in printer} -name: Snelheid koeler: {'%3d' % (menu.input*100)}% -input: {printer.fan.speed} -input_min: 0 -input_max: 1 -input_step: 0.01 -gcode: - M106 S{'%d' % (menu.input*255)} - -[menu __main __control __caselightonoff] -type: input -enable: {'output_pin caselight' in printer} -name: Verlichting: {'ON ' if menu.input else 'OFF'} -input: {printer['output_pin caselight'].value} -input_min: 0 -input_max: 1 -input_step: 1 -gcode: - SET_PIN PIN=caselight VALUE={1 if menu.input else 0} - -[menu __main __control __caselightpwm] -type: input -enable: {'output_pin caselight' in printer} -name: Verlichting: {'%3d' % (menu.input*100)}% -input: {printer['output_pin caselight'].value} -input_min: 0.0 -input_max: 1.0 -input_step: 0.01 -gcode: - SET_PIN PIN=caselight VALUE={menu.input} - -### menu move 10mm ### -[menu __main __control __move_10mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats 10mm - -[menu __main __control __move_10mm __axis_x] -type: input -name: Verplaats X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_y] -type: input -name: Verplaats Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Draai E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu move 1mm ### -[menu __main __control __move_1mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats 1mm - -[menu __main __control __move_1mm __axis_x] -type: input -name: Verplaats X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_y] -type: input -name: Verplaats Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Draai E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu move 0.1mm ### -[menu __main __control __move_01mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats 0.1mm - -[menu __main __control __move_01mm __axis_x] -type: input -name: Verplaats X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_y] -type: input -name: Verplaats Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Draai E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu temperature ### -[menu __main __temp] -type: list -name: Temperatuur - -[menu __main __temp __hotend0_target] -type: input -enable: {('extruder' in printer) and ('extruder' in printer.heaters.available_heaters)} -name: {"Ex0:%3.0f (%4.0f)" % (menu.input, printer.extruder.temperature)} -input: {printer.extruder.target} -input_min: 0 -input_max: {printer.configfile.config.extruder.max_temp} -input_step: 1 -gcode: M104 T0 S{'%.0f' % menu.input} - -[menu __main __temp __hotend1_target] -type: input -enable: {('extruder1' in printer) and ('extruder1' in printer.heaters.available_heaters)} -name: {"Ex1:%3.0f (%4.0f)" % (menu.input, printer.extruder1.temperature)} -input: {printer.extruder1.target} -input_min: 0 -input_max: {printer.configfile.config.extruder1.max_temp} -input_step: 1 -gcode: M104 T1 S{'%.0f' % menu.input} - -[menu __main __temp __hotbed_target] -type: input -enable: {'heater_bed' in printer} -name: {"Bed:%3.0f (%4.0f)" % (menu.input, printer.heater_bed.temperature)} -input: {printer.heater_bed.target} -input_min: 0 -input_max: {printer.configfile.config.heater_bed.max_temp} -input_step: 1 -gcode: M140 S{'%.0f' % menu.input} - -[menu __main __temp __preheat_pla] -type: list -name: Voorverwarmen PLA - -[menu __main __temp __preheat_pla __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Alles voorverwarmen -gcode: - M140 S60 - M104 S200 - -[menu __main __temp __preheat_pla __hotend] -type: command -enable: {'extruder' in printer} -name: Hotend voorverwarmen -gcode: M104 S200 - -[menu __main __temp __preheat_pla __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Hotbed voorverwarmen -gcode: M140 S60 - -[menu __main __temp __preheat_abs] -type: list -name: Voorverwarmen ABS - -[menu __main __temp __preheat_abs __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Alles voorverwarmen -gcode: - M140 S110 - M104 S245 - -[menu __main __temp __preheat_abs __hotend] -type: command -enable: {'extruder' in printer} -name: Hotend voorverwarmen -gcode: M104 S245 - -[menu __main __temp __preheat_abs __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Hotbed voorverwarmen -gcode: M140 S110 - -[menu __main __temp __cooldown] -type: list -name: Afkoelen - -[menu __main __temp __cooldown __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Alles afkoelen -gcode: - M104 S0 - M140 S0 - -[menu __main __temp __cooldown __hotend] -type: command -enable: {'extruder' in printer} -name: Hotend afkoelen -gcode: M104 S0 - -[menu __main __temp __cooldown __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Hotbed afkoelen -gcode: M140 S0 - -### menu filament ### - -[menu __main __filament] -type: list -name: Filament - -[menu __main __filament __hotend0_target] -type: input -enable: {'extruder' in printer} -name: {"Ex0:%3.0f (%4.0f)" % (menu.input, printer.extruder.temperature)} -input: {printer.extruder.target} -input_min: 0 -input_max: {printer.configfile.config.extruder.max_temp} -input_step: 1 -gcode: M104 T0 S{'%.0f' % menu.input} - -[menu __main __filament __loadf] -type: command -name: Fil. snel laden -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E50 F960 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __loads] -type: command -name: Fil. langzaam laden -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E50 F240 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __unloadf] -type: command -name: Fil. snel uitwerpen -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E-50 F960 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __unloads] -type: command -name: Fil. langzaam uitwerpen -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E-50 F240 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __feed] -type: input -name: Snelheid: {'%.1f' % menu.input} -input: 5 -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E{'%.1f' % menu.input} F60 - RESTORE_GCODE_STATE NAME=__filament__load - -### menu setup ### -[menu __main __setup] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Setup - -[menu __main __setup __save_config] -type: command -name: Bewaar configuratie -gcode: SAVE_CONFIG - -[menu __main __setup __restart] -type: list -name: Herstarten - -[menu __main __setup __restart __host_restart] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Herstart host -gcode: RESTART - -[menu __main __setup __restart __firmware_restart] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Herstart FW -gcode: FIRMWARE_RESTART - -[menu __main __setup __tuning] -type: list -name: PID tuning - -[menu __main __setup __tuning __hotend_pid_tuning] -type: command -enable: {(not printer.idle_timeout.state == "Printing") and ('extruder' in printer)} -name: Tune Hotend PID -gcode: PID_CALIBRATE HEATER=extruder TARGET=210 WRITE_FILE=1 - -[menu __main __setup __tuning __hotbed_pid_tuning] -type: command -enable: {(not printer.idle_timeout.state == "Printing") and ('heater_bed' in printer)} -name: Tune Hotbed PID -gcode: PID_CALIBRATE HEATER=heater_bed TARGET=60 WRITE_FILE=1 - -[menu __main __setup __calib] -type: list -name: Calibratie - -[menu __main __setup __calib __bedprobe] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Bed probe -gcode: PROBE - -[menu __main __setup __dump] -type: command -name: Dump parameters -gcode: - {% for name1 in printer %} - {% for name2 in printer[name1] %} - { action_respond_info("printer['%s'].%s = %s" - % (name1, name2, printer[name1][name2])) } - {% else %} - { action_respond_info("printer['%s'] = %s" % (name1, printer[name1])) } - {% endfor %} - {% endfor %} - -#*# <---------------------- SAVE_CONFIG ----------------------> -#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. -#*# -#*# [extruder] -#*# control = pid -#*# pid_kp = 28.195 -#*# pid_ki = 1.880 -#*# pid_kd = 105.733 -#*# -#*# [heater_bed] -#*# control = pid -#*# pid_kp = 50.775 -#*# pid_ki = 0.692 -#*# pid_kd = 931.084 -#*# -#*# [bltouch] -#*# z_offset = 2.920 -#*# -#*# [stepper_z] -#*# -#*# [bed_mesh GlasbedCarbonBoven] -#*# version = 1 -#*# points = -#*# 0.250000, 0.085000, 0.025000, -0.015000, -0.027500 -#*# 0.192500, 0.072500, 0.015000, -0.015000, -0.045000 -#*# 0.052500, -0.032500, -0.037500, -0.050000, 0.015000 -#*# -0.030000, -0.017500, 0.025000, 0.072500, 0.117500 -#*# 0.032500, 0.005000, 0.042500, 0.032500, 0.127500 -#*# tension = 0.2 -#*# min_x = 25.0 -#*# algo = lagrange -#*# y_count = 5 -#*# mesh_y_pps = 2 -#*# min_y = 10.0 -#*# x_count = 5 -#*# max_y = 170.0 -#*# mesh_x_pps = 2 -#*# max_x = 200.0 -#*# -#*# [bed_mesh GlasbedCarbonBoven ] -#*# version = 1 -#*# points = -#*# 0.030000, -0.065000, -0.075000, -0.145000, -0.165000 -#*# 0.272500, 0.092500, -0.070000, -0.275000, -0.422500 -#*# 0.027500, -0.052500, -0.075000, -0.165000, -0.160000 -#*# -0.045000, -0.040000, -0.045000, -0.105000, -0.057500 -#*# 0.017500, 0.005000, 0.022500, -0.012500, 0.002500 -#*# tension = 0.2 -#*# min_x = 25.0 -#*# algo = lagrange -#*# y_count = 5 -#*# mesh_y_pps = 2 -#*# min_y = 10.0 -#*# x_count = 5 -#*# max_y = 170.0 -#*# mesh_x_pps = 2 -#*# max_x = 200.0 -#*# -#*# [bed_mesh default] -#*# version = 1 -#*# points = -#*# -0.487500, -0.502500, -0.547500, -0.582500, -0.582500 -#*# -0.545000, -0.515000, -0.542500, -0.585000, -0.570000 -#*# -0.692500, -0.587500, -0.587500, -0.570000, -0.490000 -#*# -0.785000, -0.630000, -0.585000, -0.540000, -0.400000 -#*# -0.710000, -0.582500, -0.575000, -0.545000, -0.407500 -#*# tension = 0.2 -#*# min_x = 25.0 -#*# algo = lagrange -#*# y_count = 5 -#*# mesh_y_pps = 2 -#*# min_y = 10.0 -#*# x_count = 5 -#*# max_y = 170.0 -#*# mesh_x_pps = 2 -#*# max_x = 200.0 diff --git a/klipper/DNV-TPU-Ender3/klipper_config/printer-20230412_175951.cfg b/klipper/DNV-TPU-Ender3/klipper_config/printer-20230412_175951.cfg deleted file mode 100644 index 4bd6c5e..0000000 --- a/klipper/DNV-TPU-Ender3/klipper_config/printer-20230412_175951.cfg +++ /dev/null @@ -1,1010 +0,0 @@ -# This file contains common pin mappings for the BIGTREETECH SKR mini -# E3 v1.2. To use this config, the firmware should be compiled for the -# STM32F103 with a "28KiB bootloader" and USB communication. Also, -# select "Enable extra low-level configuration options" and configure -# "GPIO pins to set at micro-controller startup" to "!PC13". - -# The "make flash" command does not work on the SKR mini E3. Instead, -# after running "make", copy the generated "out/klipper.bin" file to a -# file named "firmware.bin" on an SD card and then restart the SKR -# mini E3 with that SD card. - -# See docs/Config_Reference.md for a description of parameters. - -# Note: This board has a design flaw in its thermistor circuits that -# cause inaccurate temperatures (most noticeable at low temperatures). - -# Met de DropEffect OmniDrop V2.1 is het punt links-beneden (dus het 0-punt): X = 12 en Y = 30 - -# Invoegen van macros. Deze komen uit: https://github.com/jschuh/klipper-macros -[include jschuh_macros.cfg] - -[exclude_object] - -[stepper_x] -step_pin: PB13 -dir_pin: !PB12 -enable_pin: !PB14 -microsteps: 16 -rotation_distance: 40 -endstop_pin: ^PC0 -position_endstop: -13.5 -position_min: -13.5 -position_max: 221.5 -homing_speed: 50 - -[tmc2209 stepper_x] -uart_pin: PB15 -run_current: 0.580 -hold_current: 0.500 -stealthchop_threshold: 250 - -[stepper_y] -step_pin: PB10 -dir_pin: !PB2 -enable_pin: !PB11 -microsteps: 16 -rotation_distance: 40 -endstop_pin: ^PC1 -position_endstop: -9 -position_min: -9 -position_max: 226 -homing_speed: 50 - -[tmc2209 stepper_y] -uart_pin: PC6 -run_current: 0.580 -hold_current: 0.500 -stealthchop_threshold: 250 - -[stepper_z] -step_pin: PB0 -dir_pin: PC5 -enable_pin: !PB1 -microsteps: 16 -rotation_distance: 8 -endstop_pin: ^PC2 -position_endstop: 0 -position_min: -2 -position_max: 250 - -[tmc2209 stepper_z] -uart_pin: PC10 -run_current: 0.580 -hold_current: 0.500 -stealthchop_threshold: 5 - -[bltouch] -sensor_pin: ^PC14 -control_pin: PA1 -#pin_up_reports_not_triggered: False -#pin_up_touch_mode_reports_triggered: False -x_offset: 33.7 -y_offset: -33.5 -#z_offset: 2.68 -pin_move_time: 0.680 - -[bed_screws] -screw1: 29,31 -screw2: 196,31 -screw3: 196,206 -screw4: 29,206 -#screw5: 117,117 - -[bed_mesh] -speed: 80 -horizontal_move_z: 5 -mesh_min: 25,10 -mesh_max: 200,170 -probe_count: 5,5 - -[extruder] -# DropEffect OmniaDrop V2.1 -step_pin: PB3 -dir_pin: PB4 -enable_pin: !PD2 -microsteps: 16 -gear_ratio: 5:1 -rotation_distance: 32.160 -nozzle_diameter: 0.400 -filament_diameter: 1.750 -heater_pin: PC8 -sensor_type: EPCOS 100K B57560G104F -sensor_pin: PA0 -#control: pid -#pid_Kp: 21.527 -#pid_Ki: 1.063 -#pid_Kd: 108.982 -min_temp: 0 -max_temp: 285 - -[tmc2209 extruder] -uart_pin: PC11 -run_current: 0.500 -hold_current: 0.400 -stealthchop_threshold: 5 - -[heater_fan my_nozzle_fan] -# Aansturing via PT-DET pinout -pin: PC12 -heater: extruder -heater_temp: 50.0 -fan_speed: 1.0 - -[heater_bed] -heater_pin: PC9 -sensor_type: EPCOS 100K B57560G104F -sensor_pin: PC3 -#control: pid -#pid_Kp: 54.027 -#pid_Ki: 0.770 -#pid_Kd: 948.182 -min_temp: 0 -max_temp: 130 - -[fan] -pin: PA8 - -[mcu] -serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_32FFDA054158323011792557-if00 - -[printer] -kinematics: cartesian -max_velocity: 300 -max_accel: 3000 -max_z_velocity: 5 -max_z_accel: 100 - -[neopixel ledjes] -pin: PC7 -# The pin connected to the neopixel. This parameter must be -# provided. -chain_count: 6 -# The number of Neopixel chips that are "daisy chained" to the -# provided pin. The default is 1 (which indicates only a single -# Neopixel is connected to the pin). -color_order: GRB -# Set the pixel order required by the LED hardware (using a string -# containing the letters R, G, B, W with W optional). Alternatively, -# this may be a comma separated list of pixel orders - one for each -# LED in the chain. The default is GRB. -initial_RED: 1.0 -initial_GREEN: 1.0 -initial_BLUE: 1.0 -#initial_WHITE: 0.0 -# See the "led" section for information on these parameters. - -#[include neopixels.cfg] - -[static_digital_output usb_pullup_enable] -pins: !PC13 - -[board_pins] -aliases: - # EXP1 header - EXP1_1=PB5, EXP1_3=PA9, EXP1_5=PA10, EXP1_7=PB8, EXP1_9=, - EXP1_2=PB6, EXP1_4=, EXP1_6=PB9, EXP1_8=PB7, EXP1_10=<5V> - -# See the sample-lcd.cfg file for definitions of common LCD displays. - -[display] -lcd_type: st7920 -cs_pin: EXP1_7 -sclk_pin: EXP1_6 -sid_pin: EXP1_8 -encoder_pins: ^EXP1_5, ^EXP1_3 -click_pin: ^!EXP1_2 - -[output_pin beeper] -pin: EXP1_1 - -[virtual_sdcard] -path: ~/printer_data/gcodes - -[display_status] - -[pause_resume] - -[gcode_macro PAUSE] -description: Pause the actual running print -rename_existing: PAUSE_BASE -# change this if you need more or less extrusion -variable_extrude: 1.0 -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - ##### set park positon for x and y ##### - # default is your max posion from your printer.cfg - {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} - {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} - ##### calculate save lift position ##### - {% set max_z = printer.toolhead.axis_maximum.z|float %} - {% set act_z = printer.toolhead.position.z|float %} - {% if act_z < (max_z - 2.0) %} - {% set z_safe = 2.0 %} - {% else %} - {% set z_safe = max_z - act_z %} - {% endif %} - ##### end of definitions ##### - PAUSE_BASE - G91 - {% if printer.extruder.can_extrude|lower == 'true' %} - G1 E-{E} F2100 - {% else %} - {action_respond_info("Extruder not hot enough")} - {% endif %} - {% if "xyz" in printer.toolhead.homed_axes %} - G1 Z{z_safe} F900 - G90 - G1 X{x_park} Y{y_park} F6000 - {% else %} - {action_respond_info("Printer not homed")} - {% endif %} - -[gcode_macro RESUME] -description: Resume the actual running print -rename_existing: RESUME_BASE -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - #### get VELOCITY parameter if specified #### - {% if 'VELOCITY' in params|upper %} - {% set get_params = ('VELOCITY=' + params.VELOCITY) %} - {%else %} - {% set get_params = "" %} - {% endif %} - ##### end of definitions ##### - {% if printer.extruder.can_extrude|lower == 'true' %} - G91 - G1 E{E} F2100 - {% else %} - {action_respond_info("Extruder not hot enough")} - {% endif %} - RESUME_BASE {get_params} - -[gcode_macro CANCEL_PRINT] -description: Cancel the actual running print -rename_existing: CANCEL_PRINT_BASE -gcode: - TURN_OFF_HEATERS - CANCEL_PRINT_BASE - -# The print bed can move so far to the front, that the nozzle can reach the -# plastic cover of the print bed heater cable (only when the bed is moved by -# hand). By homing the Y axis before the X axis, it is ensured the nozzle will -# not melt through the plastic part. -# BEWARE: You will lose the ability to home axes individually. The printer will -# always home all axes for every G28 command. -#[homing_override] -#gcode: -# G28 Y0 -# G28 X0 -# G28 Z0 - -# ================================================================================ -# GCode Macro: START_PRINT -# Add START_PRINT in your slicers starting script. -# ================================================================================ -[gcode_macro START_PRINT] -gcode: - G28; Home all axes - BED_MESH_CALIBRATE - G92 E0; Reset Extruder - G1 Z25.0 F3000; Move Z Axis up little to prevent scratching of Heat Bed - G1 X0.1 Y20 Z0.3 F5000.0; Move to start position - G1 X0.1 Y200.0 Z0.3 F1500.0 E15; Draw the first line - G1 X0.4 Y200.0 Z0.3 F5000.0; Move to side a little - G1 X0.4 Y20 Z0.3 F1500.0 E30; Draw the second line - G92 E0; Reset Extruder - G1 Z25.0 F3000; Move Z Axis up little to prevent scratching of Heat Bed - M118 punt gcode_macro START_PRINT - -# ================================================================================ -# GCode Macro: END_PRINT -# Add END_PRINT in your slicers ending script -# ================================================================================ -[gcode_macro END_PRINT] -gcode: - G91; Relative Positioning - G1 Z+10; Move Z up so it doesn't hit anything - G90; Absolute Positioning - G1 Y190 F1500; bring Y up front -# G10 ; set tool offset? or retract? -# G1 E-10 F300; Retrack-10 - G1 X10 Y220 F2000; Move to X10, Y220 - M104 S0; Turn off Extruder temperature (set it to 0) - M140 S0; Turn off Bed temperature (set it to 0) - M106 S0; turn off cooling fan - M84; Disable steppers -# ================================================================================ -# GCode Macro G29 -# Fires when G29 is sent to the printer -# ================================================================================ -#[gcode_macro G29] -#gcode: -# G1 Z10 F600 -# G4 P200 -# G1 Z10 F600 -# G4 P100 - -### Raspberry Pi als MCU om de GPIO te gebruiken voor in- en output - -[mcu rpi] -serial: /tmp/klipper_host_mcu - -[adxl345] -cs_pin: rpi:None - -[resonance_tester] -accel_chip: adxl345 -probe_points: - 100, 100, 20 # an example - -### input-shaper waardes verkregen via adxl345 tuning -[input_shaper] -shaper_freq_x: 69.8 -shaper_type_x: mzv -shaper_freq_y: 41.4 -shaper_type_y: ei - -### menu main ### -[menu __main] -type: list -name: Main - -### menu tune ### -[menu __main __tune] -type: list -enable: {printer.idle_timeout.state == "Printing"} -name: Afstellen - -[menu __main __tune __speed] -type: input -name: Snelheid: {'%3d' % (menu.input*100)}% -input: {printer.gcode_move.speed_factor} -input_min: 0.01 -input_max: 5 -input_step: 0.01 -realtime: True -gcode: - M220 S{'%d' % (menu.input*100)} - -[menu __main __tune __flow] -type: input -name: Flow: {'%3d' % (menu.input*100)}% -input: {printer.gcode_move.extrude_factor} -input_min: 0.01 -input_max: 2 -input_step: 0.01 -realtime: True -gcode: - M221 S{'%d' % (menu.input*100)} - -[menu __main __tune __offsetz] -type: input -name: Offset Z:{'%05.3f' % menu.input} -input: {printer.gcode_move.homing_origin.z} -input_min: -5 -input_max: 5 -input_step: 0.005 -realtime: True -gcode: - SET_GCODE_OFFSET Z={'%.3f' % menu.input} MOVE=1 - -### menu virtual sdcard ### -[menu __main __sdcard] -type: vsdlist -enable: {('virtual_sdcard' in printer)} -name: SD Kaart - -[menu __main __sdcard __start] -type: command -enable: {('virtual_sdcard' in printer) and printer.virtual_sdcard.file_path and not printer.virtual_sdcard.is_active} -name: Start printen -gcode: M24 - -[menu __main __sdcard __resume] -type: command -enable: {('virtual_sdcard' in printer) and printer.print_stats.state == "paused"} -name: Herstart printen -gcode: - {% if "pause_resume" in printer %} - RESUME - {% else %} - M24 - {% endif %} - -[menu __main __sdcard __pause] -type: command -enable: {('virtual_sdcard' in printer) and printer.print_stats.state == "printing"} -name: Pauseer printen -gcode: - {% if "pause_resume" in printer %} - PAUSE - {% else %} - M25 - {% endif %} - -[menu __main __sdcard __cancel] -type: command -enable: {('virtual_sdcard' in printer) and (printer.print_stats.state == "printing" or printer.print_stats.state == "paused")} -name: Annuleer printen -gcode: - {% if 'pause_resume' in printer %} - CANCEL_PRINT - {% else %} - M25 - M27 - M26 S0 - TURN_OFF_HEATERS - {% if printer.toolhead.position.z <= printer.toolhead.axis_maximum.z - 5 %} - G91 - G0 Z5 F1000 - G90 - {% endif %} - {% endif %} - -### menu control ### -[menu __main __control] -type: list -name: Control - -[menu __main __control __home] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home All -gcode: G28 - -[menu __main __control __homez] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home Z -gcode: G28 Z - -[menu __main __control __homexy] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Home X/Y -gcode: G28 X Y - -[menu __main __control __disable] -type: command -name: Steppers uit -gcode: - M84 - M18 - -[menu __main __control __fanonoff] -type: input -enable: {'fan' in printer} -name: Koeling: {'ON ' if menu.input else 'OFF'} -input: {printer.fan.speed} -input_min: 0 -input_max: 1 -input_step: 1 -gcode: - M106 S{255 if menu.input else 0} - -[menu __main __control __fanspeed] -type: input -enable: {'fan' in printer} -name: Snelheid koeler: {'%3d' % (menu.input*100)}% -input: {printer.fan.speed} -input_min: 0 -input_max: 1 -input_step: 0.01 -gcode: - M106 S{'%d' % (menu.input*255)} - -[menu __main __control __caselightonoff] -type: input -enable: {'output_pin caselight' in printer} -name: Verlichting: {'ON ' if menu.input else 'OFF'} -input: {printer['output_pin caselight'].value} -input_min: 0 -input_max: 1 -input_step: 1 -gcode: - SET_PIN PIN=caselight VALUE={1 if menu.input else 0} - -[menu __main __control __caselightpwm] -type: input -enable: {'output_pin caselight' in printer} -name: Verlichting: {'%3d' % (menu.input*100)}% -input: {printer['output_pin caselight'].value} -input_min: 0.0 -input_max: 1.0 -input_step: 0.01 -gcode: - SET_PIN PIN=caselight VALUE={menu.input} - -### menu move 10mm ### -[menu __main __control __move_10mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats 10mm - -[menu __main __control __move_10mm __axis_x] -type: input -name: Verplaats X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_y] -type: input -name: Verplaats Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_10mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Draai E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 10.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu move 1mm ### -[menu __main __control __move_1mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats 1mm - -[menu __main __control __move_1mm __axis_x] -type: input -name: Verplaats X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_y] -type: input -name: Verplaats Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_1mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Draai E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 1.0 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu move 0.1mm ### -[menu __main __control __move_01mm] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats 0.1mm - -[menu __main __control __move_01mm __axis_x] -type: input -name: Verplaats X:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.x} -input_min: {printer.toolhead.axis_minimum.x} -input_max: {printer.toolhead.axis_maximum.x} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 X{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_y] -type: input -name: Verplaats Y:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.y} -input_min: {printer.toolhead.axis_minimum.y} -input_max: {printer.toolhead.axis_maximum.y} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Y{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_z] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Verplaats Z:{'%05.1f' % menu.input} -input: {printer.gcode_move.gcode_position.z} -input_min: 0 -input_max: {printer.toolhead.axis_maximum.z} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - G90 - G1 Z{menu.input} - RESTORE_GCODE_STATE NAME=__move__axis - -[menu __main __control __move_01mm __axis_e] -type: input -enable: {not printer.idle_timeout.state == "Printing"} -name: Draai E:{'%+06.1f' % menu.input} -input: 0 -input_min: -{printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_max: {printer.configfile.config.extruder.max_extrude_only_distance|default(50)} -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__move__axis - M83 - G1 E{menu.input} F240 - RESTORE_GCODE_STATE NAME=__move__axis - -### menu temperature ### -[menu __main __temp] -type: list -name: Temperatuur - -[menu __main __temp __hotend0_target] -type: input -enable: {('extruder' in printer) and ('extruder' in printer.heaters.available_heaters)} -name: {"Ex0:%3.0f (%4.0f)" % (menu.input, printer.extruder.temperature)} -input: {printer.extruder.target} -input_min: 0 -input_max: {printer.configfile.config.extruder.max_temp} -input_step: 1 -gcode: M104 T0 S{'%.0f' % menu.input} - -[menu __main __temp __hotend1_target] -type: input -enable: {('extruder1' in printer) and ('extruder1' in printer.heaters.available_heaters)} -name: {"Ex1:%3.0f (%4.0f)" % (menu.input, printer.extruder1.temperature)} -input: {printer.extruder1.target} -input_min: 0 -input_max: {printer.configfile.config.extruder1.max_temp} -input_step: 1 -gcode: M104 T1 S{'%.0f' % menu.input} - -[menu __main __temp __hotbed_target] -type: input -enable: {'heater_bed' in printer} -name: {"Bed:%3.0f (%4.0f)" % (menu.input, printer.heater_bed.temperature)} -input: {printer.heater_bed.target} -input_min: 0 -input_max: {printer.configfile.config.heater_bed.max_temp} -input_step: 1 -gcode: M140 S{'%.0f' % menu.input} - -[menu __main __temp __preheat_pla] -type: list -name: Voorverwarmen PLA - -[menu __main __temp __preheat_pla __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Alles voorverwarmen -gcode: - M140 S60 - M104 S200 - -[menu __main __temp __preheat_pla __hotend] -type: command -enable: {'extruder' in printer} -name: Hotend voorverwarmen -gcode: M104 S200 - -[menu __main __temp __preheat_pla __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Hotbed voorverwarmen -gcode: M140 S60 - -[menu __main __temp __preheat_abs] -type: list -name: Voorverwarmen ABS - -[menu __main __temp __preheat_abs __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Alles voorverwarmen -gcode: - M140 S110 - M104 S245 - -[menu __main __temp __preheat_abs __hotend] -type: command -enable: {'extruder' in printer} -name: Hotend voorverwarmen -gcode: M104 S245 - -[menu __main __temp __preheat_abs __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Hotbed voorverwarmen -gcode: M140 S110 - -[menu __main __temp __cooldown] -type: list -name: Afkoelen - -[menu __main __temp __cooldown __all] -type: command -enable: {('extruder' in printer) and ('heater_bed' in printer)} -name: Alles afkoelen -gcode: - M104 S0 - M140 S0 - -[menu __main __temp __cooldown __hotend] -type: command -enable: {'extruder' in printer} -name: Hotend afkoelen -gcode: M104 S0 - -[menu __main __temp __cooldown __hotbed] -type: command -enable: {'heater_bed' in printer} -name: Hotbed afkoelen -gcode: M140 S0 - -### menu filament ### - -[menu __main __filament] -type: list -name: Filament - -[menu __main __filament __hotend0_target] -type: input -enable: {'extruder' in printer} -name: {"Ex0:%3.0f (%4.0f)" % (menu.input, printer.extruder.temperature)} -input: {printer.extruder.target} -input_min: 0 -input_max: {printer.configfile.config.extruder.max_temp} -input_step: 1 -gcode: M104 T0 S{'%.0f' % menu.input} - -[menu __main __filament __loadf] -type: command -name: Fil. snel laden -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E50 F960 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __loads] -type: command -name: Fil. langzaam laden -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E50 F240 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __unloadf] -type: command -name: Fil. snel uitwerpen -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E-50 F960 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __unloads] -type: command -name: Fil. langzaam uitwerpen -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E-50 F240 - RESTORE_GCODE_STATE NAME=__filament__load - -[menu __main __filament __feed] -type: input -name: Snelheid: {'%.1f' % menu.input} -input: 5 -input_step: 0.1 -gcode: - SAVE_GCODE_STATE NAME=__filament__load - M83 - G1 E{'%.1f' % menu.input} F60 - RESTORE_GCODE_STATE NAME=__filament__load - -### menu setup ### -[menu __main __setup] -type: list -enable: {not printer.idle_timeout.state == "Printing"} -name: Setup - -[menu __main __setup __save_config] -type: command -name: Bewaar configuratie -gcode: SAVE_CONFIG - -[menu __main __setup __restart] -type: list -name: Herstarten - -[menu __main __setup __restart __host_restart] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Herstart host -gcode: RESTART - -[menu __main __setup __restart __firmware_restart] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Herstart FW -gcode: FIRMWARE_RESTART - -[menu __main __setup __tuning] -type: list -name: PID tuning - -[menu __main __setup __tuning __hotend_pid_tuning] -type: command -enable: {(not printer.idle_timeout.state == "Printing") and ('extruder' in printer)} -name: Tune Hotend PID -gcode: PID_CALIBRATE HEATER=extruder TARGET=210 WRITE_FILE=1 - -[menu __main __setup __tuning __hotbed_pid_tuning] -type: command -enable: {(not printer.idle_timeout.state == "Printing") and ('heater_bed' in printer)} -name: Tune Hotbed PID -gcode: PID_CALIBRATE HEATER=heater_bed TARGET=60 WRITE_FILE=1 - -[menu __main __setup __calib] -type: list -name: Calibratie - -[menu __main __setup __calib __bedprobe] -type: command -enable: {not printer.idle_timeout.state == "Printing"} -name: Bed probe -gcode: PROBE - -[menu __main __setup __dump] -type: command -name: Dump parameters -gcode: - {% for name1 in printer %} - {% for name2 in printer[name1] %} - { action_respond_info("printer['%s'].%s = %s" - % (name1, name2, printer[name1][name2])) } - {% else %} - { action_respond_info("printer['%s'] = %s" % (name1, printer[name1])) } - {% endfor %} - {% endfor %} - -#*# <---------------------- SAVE_CONFIG ----------------------> -#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. -#*# -#*# [extruder] -#*# control = pid -#*# pid_kp = 30.552 -#*# pid_ki = 2.289 -#*# pid_kd = 101.966 -#*# -#*# [heater_bed] -#*# control = pid -#*# pid_kp = 69.576 -#*# pid_ki = 0.488 -#*# pid_kd = 2478.635 -#*# -#*# [bltouch] -#*# z_offset = 2.675 -#*# -#*# [stepper_z] -#*# -#*# [bed_mesh GlasbedCarbonBoven] -#*# version = 1 -#*# points = -#*# 0.250000, 0.085000, 0.025000, -0.015000, -0.027500 -#*# 0.192500, 0.072500, 0.015000, -0.015000, -0.045000 -#*# 0.052500, -0.032500, -0.037500, -0.050000, 0.015000 -#*# -0.030000, -0.017500, 0.025000, 0.072500, 0.117500 -#*# 0.032500, 0.005000, 0.042500, 0.032500, 0.127500 -#*# tension = 0.2 -#*# min_x = 25.0 -#*# algo = lagrange -#*# y_count = 5 -#*# mesh_y_pps = 2 -#*# min_y = 10.0 -#*# x_count = 5 -#*# max_y = 170.0 -#*# mesh_x_pps = 2 -#*# max_x = 200.0 -#*# -#*# [bed_mesh GlasbedCarbonBoven ] -#*# version = 1 -#*# points = -#*# 0.030000, -0.065000, -0.075000, -0.145000, -0.165000 -#*# 0.272500, 0.092500, -0.070000, -0.275000, -0.422500 -#*# 0.027500, -0.052500, -0.075000, -0.165000, -0.160000 -#*# -0.045000, -0.040000, -0.045000, -0.105000, -0.057500 -#*# 0.017500, 0.005000, 0.022500, -0.012500, 0.002500 -#*# tension = 0.2 -#*# min_x = 25.0 -#*# algo = lagrange -#*# y_count = 5 -#*# mesh_y_pps = 2 -#*# min_y = 10.0 -#*# x_count = 5 -#*# max_y = 170.0 -#*# mesh_x_pps = 2 -#*# max_x = 200.0 -#*# -#*# [bed_mesh default] -#*# version = 1 -#*# points = -#*# -0.570000, -0.585000, -0.595000 -#*# -0.597500, -0.577500, -0.565000 -#*# -0.580000, -0.570000, -0.532500 -#*# tension = 0.2 -#*# min_x = 68.63 -#*# algo = lagrange -#*# y_count = 3 -#*# mesh_y_pps = 2 -#*# min_y = 68.62 -#*# x_count = 3 -#*# max_y = 162.36 -#*# mesh_x_pps = 2 -#*# max_x = 162.36 diff --git a/klipper/DNV-TPU-Ender3/klipper_config/printer.cfg b/klipper/DNV-TPU-Ender3/klipper_config/printer.cfg index bdebeaf..153913b 100644 --- a/klipper/DNV-TPU-Ender3/klipper_config/printer.cfg +++ b/klipper/DNV-TPU-Ender3/klipper_config/printer.cfg @@ -184,6 +184,7 @@ pin: EXP1_1 [virtual_sdcard] path: ~/printer_data/gcodes +on_error_gcode: CANCEL_PRINT [display_status]