From 69f6df9d8d2c12a70e2243c29f0ea1d096b2af8f Mon Sep 17 00:00:00 2001 From: Surion79 <102791900+Surion79@users.noreply.github.com> Date: Tue, 20 Jun 2023 00:17:49 +0200 Subject: [PATCH 01/39] fixed line start in /proc/cpuinfo --- scripts/system_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system_info.py b/scripts/system_info.py index 4493551bb..6e6fe0293 100755 --- a/scripts/system_info.py +++ b/scripts/system_info.py @@ -55,7 +55,7 @@ def get_unknown_board_info(): try: with open('/proc/cpuinfo', 'r') as f: for line in f: - if line.startswith('Hardware') or line.startswith('Model name'): + if line.startswith('Hardware') or line.startswith('Model'): return line.split(':')[1].strip() with open('/etc/os-release', 'r') as f: for line in f: From 2383ca3806342f5aa27640b48d6696c88cae71cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Wed, 21 Jun 2023 14:09:32 +0200 Subject: [PATCH 02/39] fixed Z position endstop when no probe is configured --- config/hardware/probes/no_probe.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/hardware/probes/no_probe.cfg b/config/hardware/probes/no_probe.cfg index 4523dccfd..dc2c6c76a 100644 --- a/config/hardware/probes/no_probe.cfg +++ b/config/hardware/probes/no_probe.cfg @@ -4,3 +4,6 @@ variable_probe_type_enabled: "none" variable_startprint_actions: "bed_soak", "extruder_preheating", "chamber_soak", "extruder_heating", "purge", "clean", "z_offset", "primeline" gcode: + +[stepper_z] +position_endstop: 0 From 285bce998d34cdd38b9327a7e7699ed77b48f0eb Mon Sep 17 00:00:00 2001 From: smwoodward Date: Wed, 21 Jun 2023 19:23:29 -0500 Subject: [PATCH 03/39] Create BTT_Octopus_Max.cfg --- .../mcu_definitions/main/BTT_Octopus_Max.cfg | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 config/mcu_definitions/main/BTT_Octopus_Max.cfg diff --git a/config/mcu_definitions/main/BTT_Octopus_Max.cfg b/config/mcu_definitions/main/BTT_Octopus_Max.cfg new file mode 100644 index 000000000..c82a8201c --- /dev/null +++ b/config/mcu_definitions/main/BTT_Octopus_Max.cfg @@ -0,0 +1,48 @@ +[board_pins mcu_manufacturer] +aliases: + MCU_MOTOR0_STEP=PC13 , MCU_MOTOR0_DIR=PC14 , MCU_MOTOR0_ENABLE=PE6 , MCU_MOTOR0_UART=PG14 , + MCU_MOTOR1_STEP=PE4 , MCU_MOTOR1_DIR=PE5 , MCU_MOTOR1_ENABLE=PE3 , MCU_MOTOR1_UART=PG13 , + MCU_MOTOR2_1_STEP=PE1 , MCU_MOTOR2_1_DIR=PE0 , MCU_MOTOR2_1_ENABLE=PE2 , MCU_MOTOR2_1_UART=PG12 , + MCU_MOTOR3_STEP=PB8 , MCU_MOTOR3_DIR=PB9 , MCU_MOTOR3_ENABLE=PB7 , MCU_MOTOR3_UART=PG11 , + MCU_MOTOR4_STEP=PB5 , MCU_MOTOR4_DIR=PB4 , MCU_MOTOR4_ENABLE=PB6 , MCU_MOTOR4_UART=PG10 , + MCU_MOTOR5_STEP=PG15 , MCU_MOTOR5_DIR=PB3 , MCU_MOTOR5_ENABLE=PD5 , MCU_MOTOR5_UART=PG9 , + MCU_MOTOR6_STEP=PD3 , MCU_MOTOR6_DIR=PD2 , MCU_MOTOR6_ENABLE=PD4 , MCU_MOTOR6_UART=PD7 , + MCU_MOTOR7_STEP=PA10 , MCU_MOTOR7_DIR=PA9 , MCU_MOTOR7_ENABLE=PA15 , MCU_MOTOR7_UART=PD6 , + MCU_MOTOR8_STEP=PA8 , MCU_MOTOR8_DIR=PC7 , MCU_MOTOR8_ENABLE=PC9 , MCU_MOTOR8_UART=PG8 , + MCU_MOTOR9_STEP=PG6 , MCU_MOTOR9_DIR=PC6 , MCU_MOTOR9_ENABLE=PC8 , MCU_MOTOR9_UART=PG7 , + + MCU_STOP0=PF0 , MCU_STOP1=PF2 , MCU_STOP2=PF4 , MCU_STOP3=PF3 , + MCU_STOP4=PF1 , MCU_STOP5=PC15 , MCU_STOP6=PG14 , MCU_STOP7=PG15 , + MCU_PROBE=PB15 , + MCU_SERVOS=PB14 , + + MCU_HE0=PF6 , MCU_HE1=PA0 , MCU_HE2=PF9 , MCU_HE3=PF7 , + + MCU_BED0=PF5 , + + MCU_TB=PB1 , + MCU_T0=PB0 , MCU_T1=PC5 , MCU_T2=PC4 , MCU_T3=PA7 , + + MCU_FAN0=PA6 , MCU_FAN1=PA5 , MCU_FAN2=PA4 , MCU_FAN3=PA3 , MCU_FAN4=PA1 , MCU_FAN5=PF8 , + MCU_FAN6=PA2 , + + MCU_FAN4_TACH=PC3 , MCU_FAN5_TACH=PC1 , MCU_FAN6_TACH=PC2 , + + MCU_NEOPIXEL=PE10 , + MCU_NEOPIXEL2=PE9 , + MCU_PS_ON=PF13 , + MCU_POWER_DET=PF12 , + + # EXP1 header + EXP1_1=PG2 , EXP1_2=PD15 , + EXP1_3=PD14 , EXP1_4=PD13 , + EXP1_5=PD12 , EXP1_6=PD11 , # Slot in the socket on this side + EXP1_7=PD10 , EXP1_8=PD15 , + EXP1_9= , EXP1_10=<5V> , + + # EXP2 header + EXP2_1=PE13 , EXP2_2=PE12 , + EXP2_3=PG5 , EXP2_4=PE11 , + EXP2_5=PG4 , EXP2_6=PE14 , # Slot in the socket on this side + EXP2_7=PG3 , EXP2_8= , + EXP2_9= , EXP2_10=<5V> , From 193ca8dd884dc6d05f17d1550221f785078a0fc1 Mon Sep 17 00:00:00 2001 From: garyd9 Date: Fri, 23 Jun 2023 10:41:26 -0400 Subject: [PATCH 04/39] Added comments on reading the graphs Just some generic advice. --- docs/input_shaper.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/input_shaper.md b/docs/input_shaper.md index ad5c2c2a3..cfb59c778 100644 --- a/docs/input_shaper.md +++ b/docs/input_shaper.md @@ -17,6 +17,8 @@ When tuning Input Shaper, keep the following in mind: 1. Perform the tests when the machine is heat-soaked and close to printing conditions, as belt tension can change with temperature. 1. Avoid running the toolhead fans during the tests, as they introduce unnecessary noise to the graphs, making them harder to interpret. This means that even if you should heatsoak the printer, you should also refrain from activating the hotend heater during the test, as it will also trigger the hotend fan. However, as a bad fan can introduce some vibrations, feel free to use the test to diagnose an unbalanced fan as seen in the [Examples of Input Shaper graphs](#examples-of-input-shaper-graphs) section. 1. Ensure the accuracy of your ADXL measurements by running a `MEASURE_AXES_NOISE` test and checking that the result is below 100 for all axes. If it's not, check your ADXL and wiring before continuing. + 1. The graphs can only show symptoms of possible problems and in different ways. Those symptoms can sometimes suggest causes, but they rarely pinpoint issues. + 1. Remember why you're running these tests (clean prints) and don't become too obsessive over perfect graphs. > **Note** > From 676515bda650f78d6edd24dc8a644d3f5a0c0075 Mon Sep 17 00:00:00 2001 From: crazy-daddy <67276479+crazy-daddy@users.noreply.github.com> Date: Mon, 26 Jun 2023 12:29:05 +0200 Subject: [PATCH 05/39] Update BTT_Manta_M8P_v1.1.cfg On v1.1 FAN4 was converted to a 2 pin. PC13 is used for M7_STOP now. See: https://github.com/bigtreetech/Manta-M8P/blob/master/Hardware/BIGTREETECH%20MANTA%20M8P%20V1.1%20PinOut.png vs old https://github.com/bigtreetech/Manta-M8P/blob/master/Hardware/BIGTREETECH%20MANTA%20M8P%20V1.0%20PinOut.png --- config/mcu_definitions/main/BTT_Manta_M8P_v1.1.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/mcu_definitions/main/BTT_Manta_M8P_v1.1.cfg b/config/mcu_definitions/main/BTT_Manta_M8P_v1.1.cfg index f96bec65b..4e0f83fb8 100644 --- a/config/mcu_definitions/main/BTT_Manta_M8P_v1.1.cfg +++ b/config/mcu_definitions/main/BTT_Manta_M8P_v1.1.cfg @@ -18,8 +18,7 @@ aliases: MCU_THB=PA0 , MCU_TH0=PA1 , MCU_TH1=PA2 , MCU_TH2=PA3 , MCU_TH3=PA4 , - MCU_FAN0=PE6 , MCU_FAN1=PE0 , MCU_FAN2=PC12 , MCU_FAN3=PE5 , - MCU_FAN4=PE4 , MCU_FAN4_TACH=PC13 , + MCU_FAN0=PE6 , MCU_FAN1=PE0 , MCU_FAN2=PC12 , MCU_FAN3=PE5 , MCU_FAN4=PE4 , MCU_FAN5=PB8 , MCU_FAN5_TACH=PC14 , MCU_FAN6=PB9 , MCU_FAN6_TACH=PC15 , From 12c3ec567868f9a1272c9053a421245ad78e179e Mon Sep 17 00:00:00 2001 From: elpopo <68954733+elpopo-eng@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:16:22 +0200 Subject: [PATCH 06/39] add ellis speed test --- macros/calibration/speed_test.cfg | 111 ++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 macros/calibration/speed_test.cfg diff --git a/macros/calibration/speed_test.cfg b/macros/calibration/speed_test.cfg new file mode 100644 index 000000000..d89ac260e --- /dev/null +++ b/macros/calibration/speed_test.cfg @@ -0,0 +1,111 @@ +# macro test speed fromm ellis https://github.com/AndrewEllis93/Print-Tuning-Guide/blob/main/macros/TEST_SPEED.cfg +# this macro is slightly modified to add the warm-up speed parameter + +# Home, get position, throw around toolhead, home again. +# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured. +# We only measure to a full step to accomodate for endstop variance. +# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10 + +[gcode_macro TEST_SPEED] +gcode: + # Speed + {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} + {% set warmup_speed = params.WARMUP_SPEED|default(printer.configfile.settings.printer.max_velocity/5)|int %} + # Iterations + {% set iterations = params.ITERATIONS|default(5)|int %} + # Acceleration + {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} + # Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions) + {% set bound = params.BOUND|default(20)|int %} + # Size for small pattern box + {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} + + # Large pattern + # Max positions, inset by BOUND + {% set x_min = printer.toolhead.axis_minimum.x + bound %} + {% set x_max = printer.toolhead.axis_maximum.x - bound %} + {% set y_min = printer.toolhead.axis_minimum.y + bound %} + {% set y_max = printer.toolhead.axis_maximum.y - bound %} + + # Small pattern at center + # Find X/Y center point + {% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %} + {% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %} + + # Set small pattern box around center point + {% set x_center_min = x_center - (smallpatternsize/2) %} + {% set x_center_max = x_center + (smallpatternsize/2) %} + {% set y_center_min = y_center - (smallpatternsize/2) %} + {% set y_center_max = y_center + (smallpatternsize/2) %} + + # Save current gcode state (absolute/relative, etc) + SAVE_GCODE_STATE NAME=TEST_SPEED + + # Output parameters to g-code terminal + { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } + + # Home and get position for comparison later: + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + + # Tilt if not already Tilted + _TILT_CALIBRATE FORCE=false + # Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24) + G90 + G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{warmup_speed*60} + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + # full home + G28 + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{warmup_speed*60} + G4 P1000 + GET_POSITION + + # Go to starting position + G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} + + # Set new limits + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} + + {% for i in range(iterations) %} + # Large pattern diagonals + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Large pattern box + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Small pattern diagonals + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + + # Small patternbox + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + {% endfor %} + + # Restore max speed/accel/accel_to_decel to their configured values + SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} + + # Re-home and get position again for comparison: + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12 + # Go to XY home positions (in case your homing override leaves it elsewhere) + G90 + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{warmup_speed*60} + G4 P1000 + GET_POSITION + + # Restore previous gcode state (absolute/relative, etc) + RESTORE_GCODE_STATE NAME=TEST_SPEED \ No newline at end of file From 8aabc0490141c126ae68dbf2a3f884250caba554 Mon Sep 17 00:00:00 2001 From: elpopo <68954733+elpopo-eng@users.noreply.github.com> Date: Wed, 28 Jun 2023 15:38:45 +0200 Subject: [PATCH 07/39] Rename speed_test.cfg to test_speed.cfg --- macros/calibration/{speed_test.cfg => test_speed.cfg} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename macros/calibration/{speed_test.cfg => test_speed.cfg} (99%) diff --git a/macros/calibration/speed_test.cfg b/macros/calibration/test_speed.cfg similarity index 99% rename from macros/calibration/speed_test.cfg rename to macros/calibration/test_speed.cfg index d89ac260e..4ba6d9075 100644 --- a/macros/calibration/speed_test.cfg +++ b/macros/calibration/test_speed.cfg @@ -108,4 +108,4 @@ gcode: GET_POSITION # Restore previous gcode state (absolute/relative, etc) - RESTORE_GCODE_STATE NAME=TEST_SPEED \ No newline at end of file + RESTORE_GCODE_STATE NAME=TEST_SPEED From 873b520528148583c5bb35e5b47e091a66088ea0 Mon Sep 17 00:00:00 2001 From: R B <16458763+rborling@users.noreply.github.com> Date: Tue, 4 Jul 2023 19:45:22 -0400 Subject: [PATCH 08/39] Cancel_print.cfg caselights Edited to match the END_PRINT functionality for the case lights to use the light_intensity_end_print value. Per Azi V2.4971 https://discord.com/channels/460117602945990666/1096701708643614820/1125890377782665386 --- macros/base/cancel_print.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/base/cancel_print.cfg b/macros/base/cancel_print.cfg index 2eef32138..d61f699b5 100644 --- a/macros/base/cancel_print.cfg +++ b/macros/base/cancel_print.cfg @@ -46,7 +46,7 @@ gcode: {% endif %} {% if light_enabled %} - LIGHT_OFF + LIGHT_ON S={light_intensity_end_print} {% endif %} {% if status_leds_enabled %} STATUS_LEDS COLOR="OFF" From e644d486cb24b235d30c996888d37b4ab7eecb6d Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sat, 15 Jul 2023 14:07:24 +0200 Subject: [PATCH 09/39] added TMC2240 with sensorless homing support --- config/hardware/axis/X/0.9deg.cfg | 2 +- config/hardware/axis/X/1.8deg.cfg | 2 +- config/hardware/axis/X/TMC/TMC2209.cfg | 4 +- config/hardware/axis/X/TMC/TMC2240.cfg | 15 ++++++++ config/hardware/axis/Y/0.9deg.cfg | 2 +- config/hardware/axis/Y/1.8deg.cfg | 2 +- config/hardware/axis/Y/TMC/TMC2209.cfg | 4 +- config/hardware/axis/Y/TMC/TMC2240.cfg | 15 ++++++++ .../hardware/axis/Z/TMC/TMC2209_1-Motor.cfg | 4 +- .../hardware/axis/Z/TMC/TMC2209_3-Motors.cfg | 4 +- .../hardware/axis/Z/TMC/TMC2209_4-Motors.cfg | 2 +- config/hardware/axis/Z/VSW_0.9deg.cfg | 2 +- config/hardware/axis/Z/VSW_1.8deg.cfg | 2 +- config/hardware/extruder/TMC/TMC2209.cfg | 4 +- config/hardware/extruder/TMC/TMC2240.cfg | 4 +- config/hardware/extruder/cw1.cfg | 2 +- config/hardware/extruder/cw2.cfg | 2 +- config/hardware/extruder/galileo.cfg | 2 +- config/hardware/extruder/lgx_heavy.cfg | 2 +- config/hardware/extruder/lgx_lite.cfg | 2 +- config/hardware/extruder/orbiter2.0.cfg | 2 +- .../sensorless_BTT_TMC2240.cfg | 37 +++++++++++++++++++ .../sensorless_MKS_TMC2240.cfg | 37 +++++++++++++++++++ macros/base/homing/homing_override.cfg | 18 +++++---- user_templates/mcu.cfg | 2 + .../mcu_defaults/main/BTT_Octopus.cfg | 6 +++ user_templates/printer.cfg | 2 + 27 files changed, 149 insertions(+), 33 deletions(-) create mode 100644 config/hardware/axis/X/TMC/TMC2240.cfg create mode 100644 config/hardware/axis/Y/TMC/TMC2240.cfg create mode 100644 config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg create mode 100644 config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg diff --git a/config/hardware/axis/X/0.9deg.cfg b/config/hardware/axis/X/0.9deg.cfg index 9132f42a3..0c86dba3a 100644 --- a/config/hardware/axis/X/0.9deg.cfg +++ b/config/hardware/axis/X/0.9deg.cfg @@ -1,6 +1,6 @@ [stepper_x] rotation_distance: 40 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 400 # We also include the default wiring and speeds from here to avoid duplicating diff --git a/config/hardware/axis/X/1.8deg.cfg b/config/hardware/axis/X/1.8deg.cfg index 4675f6e10..ee1d030a2 100644 --- a/config/hardware/axis/X/1.8deg.cfg +++ b/config/hardware/axis/X/1.8deg.cfg @@ -1,6 +1,6 @@ [stepper_x] rotation_distance: 40 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 200 # We also include the default wiring and speeds from here to avoid duplicating diff --git a/config/hardware/axis/X/TMC/TMC2209.cfg b/config/hardware/axis/X/TMC/TMC2209.cfg index 71317bc43..2b25f6666 100644 --- a/config/hardware/axis/X/TMC/TMC2209.cfg +++ b/config/hardware/axis/X/TMC/TMC2209.cfg @@ -1,12 +1,12 @@ # X TMC2209 definition [gcode_macro _USER_VARIABLES] -variable_x_driver: "TMC2209" +variable_x_driver: "tmc2209" gcode: [tmc2209 stepper_x] uart_pin: X_TMCUART -interpolate: False +interpolate: True run_current: 0.8 sense_resistor: 0.110 stealthchop_threshold: 0 diff --git a/config/hardware/axis/X/TMC/TMC2240.cfg b/config/hardware/axis/X/TMC/TMC2240.cfg new file mode 100644 index 000000000..840be8124 --- /dev/null +++ b/config/hardware/axis/X/TMC/TMC2240.cfg @@ -0,0 +1,15 @@ +# X TMC2240 definition + +[gcode_macro _USER_VARIABLES] +variable_x_driver: "tmc2240" +gcode: + +[tmc2240 stepper_x] +cs_pin: X_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.7 +stealthchop_threshold: 0 diff --git a/config/hardware/axis/Y/0.9deg.cfg b/config/hardware/axis/Y/0.9deg.cfg index 90e952051..9bc9f0604 100644 --- a/config/hardware/axis/Y/0.9deg.cfg +++ b/config/hardware/axis/Y/0.9deg.cfg @@ -1,6 +1,6 @@ [stepper_y] rotation_distance: 40 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 400 # We also include the default wiring and speeds from here to avoid duplicating diff --git a/config/hardware/axis/Y/1.8deg.cfg b/config/hardware/axis/Y/1.8deg.cfg index 13417effd..bd3fe24c4 100644 --- a/config/hardware/axis/Y/1.8deg.cfg +++ b/config/hardware/axis/Y/1.8deg.cfg @@ -1,6 +1,6 @@ [stepper_y] rotation_distance: 40 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 200 # We also include the default wiring and speeds from here to avoid duplicating diff --git a/config/hardware/axis/Y/TMC/TMC2209.cfg b/config/hardware/axis/Y/TMC/TMC2209.cfg index d532e5a68..34d5a1119 100644 --- a/config/hardware/axis/Y/TMC/TMC2209.cfg +++ b/config/hardware/axis/Y/TMC/TMC2209.cfg @@ -1,12 +1,12 @@ # Y TMC2209 definition [gcode_macro _USER_VARIABLES] -variable_y_driver: "TMC2209" +variable_y_driver: "tmc2209" gcode: [tmc2209 stepper_y] uart_pin: Y_TMCUART -interpolate: False +interpolate: True run_current: 0.8 sense_resistor: 0.110 stealthchop_threshold: 0 diff --git a/config/hardware/axis/Y/TMC/TMC2240.cfg b/config/hardware/axis/Y/TMC/TMC2240.cfg new file mode 100644 index 000000000..307778d48 --- /dev/null +++ b/config/hardware/axis/Y/TMC/TMC2240.cfg @@ -0,0 +1,15 @@ +# Y TMC2240 definition + +[gcode_macro _USER_VARIABLES] +variable_y_driver: "tmc2240" +gcode: + +[tmc2240 stepper_y] +cs_pin: Y_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.7 +stealthchop_threshold: 0 diff --git a/config/hardware/axis/Z/TMC/TMC2209_1-Motor.cfg b/config/hardware/axis/Z/TMC/TMC2209_1-Motor.cfg index f007c86fe..8939fb5bc 100644 --- a/config/hardware/axis/Z/TMC/TMC2209_1-Motor.cfg +++ b/config/hardware/axis/Z/TMC/TMC2209_1-Motor.cfg @@ -2,13 +2,13 @@ # User variable only needed here as they are called recursively [gcode_macro _USER_VARIABLES] -variable_z_driver: "TMC2209" +variable_z_driver: "tmc2209" gcode: [tmc2209 stepper_z] uart_pin: Z_TMCUART -interpolate: False +interpolate: True run_current: 0.8 sense_resistor: 0.110 stealthchop_threshold: 0 diff --git a/config/hardware/axis/Z/TMC/TMC2209_3-Motors.cfg b/config/hardware/axis/Z/TMC/TMC2209_3-Motors.cfg index 5d0392518..e369c45ae 100644 --- a/config/hardware/axis/Z/TMC/TMC2209_3-Motors.cfg +++ b/config/hardware/axis/Z/TMC/TMC2209_3-Motors.cfg @@ -2,14 +2,14 @@ [tmc2209 stepper_z1] uart_pin: Z1_TMCUART -interpolate: False +interpolate: True run_current: 0.8 sense_resistor: 0.110 stealthchop_threshold: 0 [tmc2209 stepper_z2] uart_pin: Z2_TMCUART -interpolate: False +interpolate: True run_current: 0.8 sense_resistor: 0.110 stealthchop_threshold: 0 diff --git a/config/hardware/axis/Z/TMC/TMC2209_4-Motors.cfg b/config/hardware/axis/Z/TMC/TMC2209_4-Motors.cfg index 90c135138..46ba9d86d 100644 --- a/config/hardware/axis/Z/TMC/TMC2209_4-Motors.cfg +++ b/config/hardware/axis/Z/TMC/TMC2209_4-Motors.cfg @@ -2,7 +2,7 @@ [tmc2209 stepper_z3] uart_pin: Z3_TMCUART -interpolate: False +interpolate: True run_current: 0.8 sense_resistor: 0.110 stealthchop_threshold: 0 diff --git a/config/hardware/axis/Z/VSW_0.9deg.cfg b/config/hardware/axis/Z/VSW_0.9deg.cfg index 438a59e9d..7fc51fb53 100644 --- a/config/hardware/axis/Z/VSW_0.9deg.cfg +++ b/config/hardware/axis/Z/VSW_0.9deg.cfg @@ -1,6 +1,6 @@ [stepper_z] rotation_distance: 40 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 400 # We also include the default wiring and speeds from here to avoid duplicating diff --git a/config/hardware/axis/Z/VSW_1.8deg.cfg b/config/hardware/axis/Z/VSW_1.8deg.cfg index a2c437a2d..16549768e 100644 --- a/config/hardware/axis/Z/VSW_1.8deg.cfg +++ b/config/hardware/axis/Z/VSW_1.8deg.cfg @@ -1,6 +1,6 @@ [stepper_z] rotation_distance: 40 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 200 # We also include the default wiring and speeds from here to avoid duplicating diff --git a/config/hardware/extruder/TMC/TMC2209.cfg b/config/hardware/extruder/TMC/TMC2209.cfg index b89e7284e..86c70a969 100644 --- a/config/hardware/extruder/TMC/TMC2209.cfg +++ b/config/hardware/extruder/TMC/TMC2209.cfg @@ -1,12 +1,12 @@ # Extruder TMC2209 definition [gcode_macro _USER_VARIABLES] -variable_e_driver: "TMC2209" +variable_e_driver: "tmc2209" gcode: [tmc2209 extruder] uart_pin: E_TMCUART -interpolate: false +interpolate: True run_current: 0.45 sense_resistor: 0.110 stealthchop_threshold: 0 diff --git a/config/hardware/extruder/TMC/TMC2240.cfg b/config/hardware/extruder/TMC/TMC2240.cfg index 633689ad0..4886f9ec7 100644 --- a/config/hardware/extruder/TMC/TMC2240.cfg +++ b/config/hardware/extruder/TMC/TMC2240.cfg @@ -1,6 +1,6 @@ # Extruder TMC2240 definition [gcode_macro _USER_VARIABLES] -variable_e_driver: "TMC2240" +variable_e_driver: "tmc2240" gcode: [tmc2240 extruder] @@ -11,4 +11,4 @@ spi_software_miso_pin: E_MISO run_current: 0.6 stealthchop_threshold: 0 spi_speed: 500000 -interpolate: False +interpolate: True diff --git a/config/hardware/extruder/cw1.cfg b/config/hardware/extruder/cw1.cfg index 2dc143827..311231f61 100644 --- a/config/hardware/extruder/cw1.cfg +++ b/config/hardware/extruder/cw1.cfg @@ -8,7 +8,7 @@ gcode: # new_rd = previous_rd * mesured_distance / requested_distance rotation_distance: 22.6789511 gear_ratio: 50:17 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 200 nozzle_diameter: 0.400 diff --git a/config/hardware/extruder/cw2.cfg b/config/hardware/extruder/cw2.cfg index 1488386e7..d5bca8270 100644 --- a/config/hardware/extruder/cw2.cfg +++ b/config/hardware/extruder/cw2.cfg @@ -8,7 +8,7 @@ gcode: # new_rd = previous_rd * mesured_distance / requested_distance rotation_distance: 22.6789511 gear_ratio: 50:10 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 200 nozzle_diameter: 0.400 diff --git a/config/hardware/extruder/galileo.cfg b/config/hardware/extruder/galileo.cfg index 5302ca663..9f6923d98 100644 --- a/config/hardware/extruder/galileo.cfg +++ b/config/hardware/extruder/galileo.cfg @@ -8,7 +8,7 @@ gcode: # new_rd = previous_rd * mesured_distance / requested_distance rotation_distance: 22.6789511 gear_ratio: 7.5:1 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 200 nozzle_diameter: 0.400 diff --git a/config/hardware/extruder/lgx_heavy.cfg b/config/hardware/extruder/lgx_heavy.cfg index 22a8aa246..25c071b98 100644 --- a/config/hardware/extruder/lgx_heavy.cfg +++ b/config/hardware/extruder/lgx_heavy.cfg @@ -8,7 +8,7 @@ gcode: # new_rd = previous_rd * mesured_distance / requested_distance rotation_distance: 54.4 gear_ratio: 44:14, 37:17 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 200 nozzle_diameter: 0.400 diff --git a/config/hardware/extruder/lgx_lite.cfg b/config/hardware/extruder/lgx_lite.cfg index 0784a8344..84b22c2ec 100644 --- a/config/hardware/extruder/lgx_lite.cfg +++ b/config/hardware/extruder/lgx_lite.cfg @@ -8,7 +8,7 @@ gcode: # new_rd = previous_rd * mesured_distance / requested_distance rotation_distance: 54.69 gear_ratio: 44:10, 37:17 -microsteps: 64 +microsteps: 32 full_steps_per_rotation: 200 nozzle_diameter: 0.400 diff --git a/config/hardware/extruder/orbiter2.0.cfg b/config/hardware/extruder/orbiter2.0.cfg index 46985cdc7..5bb47aaed 100644 --- a/config/hardware/extruder/orbiter2.0.cfg +++ b/config/hardware/extruder/orbiter2.0.cfg @@ -8,7 +8,7 @@ gcode: # new_rd = previous_rd * mesured_distance / requested_distance rotation_distance: 4.637 gear_ratio: 7.5:1 -microsteps: 16 +microsteps: 32 full_steps_per_rotation: 200 nozzle_diameter: 0.400 diff --git a/config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg b/config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg new file mode 100644 index 000000000..faf98fd34 --- /dev/null +++ b/config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg @@ -0,0 +1,37 @@ +# This file add support for Sensorless homing using TMC2240 drivers +# To use it, be sure to place the corresponding jumpers correctly on your MCU! +[gcode_macro _USER_VARIABLES] +variable_sensorless_homing_enabled: True +gcode: + + +[stepper_x] +homing_speed: 40 +endstop_pin: tmc2240_stepper_x:virtual_endstop + +[tmc2240 stepper_x] +diag1_pin: ^X_STOP +driver_SGT: -64 + +[stepper_y] +homing_speed: 40 +endstop_pin: tmc2240_stepper_y:virtual_endstop + +[tmc2240 stepper_y] +diag1_pin: ^Y_STOP +driver_SGT: -64 # -64 is most sensitive value, 63 is least sensitive + + +## PLEASE READ THE FOLLOWING: +## -64 is the most sensitive value, 63 is the least sensitive. Here we set a default +## value of -64 to avoid any trouble or crash. Your axes should not move with this parameter! + +## Follow the Klipper documentation here: https://www.klipper3d.org/TMC_Drivers.html#sensorless-homing +## to find the best suited SGTHRS value according to your machine. Then you can put it in your overrides +## file like that: + +# [tmc2240 stepper_x] +# driver_SGT: xxx + +# [tmc2240 stepper_y] +# driver_SGT: xxx diff --git a/config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg b/config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg new file mode 100644 index 000000000..a2c0d4f54 --- /dev/null +++ b/config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg @@ -0,0 +1,37 @@ +# This file add support for Sensorless homing using TMC2240 drivers +# To use it, be sure to place the corresponding jumpers correctly on your MCU! +[gcode_macro _USER_VARIABLES] +variable_sensorless_homing_enabled: True +gcode: + + +[stepper_x] +homing_speed: 40 +endstop_pin: tmc2240_stepper_x:virtual_endstop + +[tmc2240 stepper_x] +diag0_pin: ^X_STOP +driver_SGT: -64 + +[stepper_y] +homing_speed: 40 +endstop_pin: tmc2240_stepper_y:virtual_endstop + +[tmc2240 stepper_y] +diag0_pin: ^Y_STOP +driver_SGT: -64 # -64 is most sensitive value, 63 is least sensitive + + +## PLEASE READ THE FOLLOWING: +## -64 is the most sensitive value, 63 is the least sensitive. Here we set a default +## value of -64 to avoid any trouble or crash. Your axes should not move with this parameter! + +## Follow the Klipper documentation here: https://www.klipper3d.org/TMC_Drivers.html#sensorless-homing +## to find the best suited SGTHRS value according to your machine. Then you can put it in your overrides +## file like that: + +# [tmc2240 stepper_x] +# driver_SGT: xxx + +# [tmc2240 stepper_y] +# driver_SGT: xxx diff --git a/macros/base/homing/homing_override.cfg b/macros/base/homing/homing_override.cfg index e926cbf86..f34f1340e 100644 --- a/macros/base/homing/homing_override.cfg +++ b/macros/base/homing/homing_override.cfg @@ -9,6 +9,8 @@ gcode: {% set homing_travel_accel = printer["gcode_macro _USER_VARIABLES"].homing_travel_accel %} {% set sensorless_homing_enabled = printer["gcode_macro _USER_VARIABLES"].sensorless_homing_enabled %} {% set sensorless_current_factor = printer["gcode_macro _USER_VARIABLES"].sensorless_current_factor / 100 %} + {% set x_driver = printer["gcode_macro _USER_VARIABLES"].x_driver %} + {% set y_driver = printer["gcode_macro _USER_VARIABLES"].y_driver %} {% set z_drop_speed = printer["gcode_macro _USER_VARIABLES"].z_drop_speed * 60 %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} @@ -106,8 +108,8 @@ gcode: { action_respond_info("Homing X") } {% endif %} {% if sensorless_homing_enabled %} - {% set old_current_x = printer.configfile.config['tmc2209 stepper_x'].run_current|float %} - {% set old_current_y = printer.configfile.config['tmc2209 stepper_y'].run_current|float %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} {% set new_current_x = sensorless_current_factor * old_current_x %} {% set new_current_y = sensorless_current_factor * old_current_y %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} @@ -126,8 +128,8 @@ gcode: { action_respond_info("Homing Y") } {% endif %} {% if sensorless_homing_enabled %} - {% set old_current_x = printer.configfile.config['tmc2209 stepper_x'].run_current|float %} - {% set old_current_y = printer.configfile.config['tmc2209 stepper_y'].run_current|float %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} {% set new_current_x = sensorless_current_factor * old_current_x %} {% set new_current_y = sensorless_current_factor * old_current_y %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} @@ -148,8 +150,8 @@ gcode: { action_respond_info("Homing Y") } {% endif %} {% if sensorless_homing_enabled %} - {% set old_current_x = printer.configfile.config['tmc2209 stepper_x'].run_current|float %} - {% set old_current_y = printer.configfile.config['tmc2209 stepper_y'].run_current|float %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} {% set new_current_x = sensorless_current_factor * old_current_x %} {% set new_current_y = sensorless_current_factor * old_current_y %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} @@ -168,8 +170,8 @@ gcode: { action_respond_info("Homing X") } {% endif %} {% if sensorless_homing_enabled %} - {% set old_current_x = printer.configfile.config['tmc2209 stepper_x'].run_current|float %} - {% set old_current_y = printer.configfile.config['tmc2209 stepper_y'].run_current|float %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} {% set new_current_x = sensorless_current_factor * old_current_x %} {% set new_current_y = sensorless_current_factor * old_current_y %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} diff --git a/user_templates/mcu.cfg b/user_templates/mcu.cfg index cc7c36da1..9f98b0b31 100644 --- a/user_templates/mcu.cfg +++ b/user_templates/mcu.cfg @@ -22,9 +22,11 @@ ### 1. X Drivers ------------------------------------------------------------------------- # [include config/hardware/axis/X/TMC/TMC2209.cfg] # [include config/hardware/axis/X/TMC/TMC2209_V0specific.cfg] # Should only be used for early LDO V0 kits to mitigate the known VFAs issue +# [include config/hardware/axis/X/TMC/TMC2240.cfg] ### 2. Y Drivers ------------------------------------------------------------------------- # [include config/hardware/axis/Y/TMC/TMC2209.cfg] # [include config/hardware/axis/Y/TMC/TMC2209_V0specific.cfg] # Should only be used for early LDO V0 kits to mitigate the known VFAs issue +# [include config/hardware/axis/Y/TMC/TMC2240.cfg] ### 3. Z Drivers ------------------------------------------------------------------------- # [include config/hardware/axis/Z/TMC/TMC2209_1-Motor.cfg] # [include config/hardware/axis/Z/TMC/TMC2209_3-Motors.cfg] diff --git a/user_templates/mcu_defaults/main/BTT_Octopus.cfg b/user_templates/mcu_defaults/main/BTT_Octopus.cfg index 0dd3d24d0..e6cae3e7d 100644 --- a/user_templates/mcu_defaults/main/BTT_Octopus.cfg +++ b/user_templates/mcu_defaults/main/BTT_Octopus.cfg @@ -26,6 +26,10 @@ aliases: E_STEP=MCU_MOTOR6_STEP , E_DIR=MCU_MOTOR6_DIR , E_ENABLE=MCU_MOTOR6_ENABLE , E_TMCUART=MCU_MOTOR6_UART , + # DRIVER_SPI_MOSI=EXP2_6 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + # DRIVER_SPI_MISO=EXP2_1 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + # DRIVER_SPI_SCK=EXP2_2 , # Used in case of SPI drivers such as TMC2240 or TMC5160 + X_STOP=MCU_STOP0 , Y_STOP=MCU_STOP1 , Z_STOP=MCU_STOP2 , PROBE_INPUT=MCU_STOP7 , RUNOUT_SENSOR=MCU_STOP3 , @@ -45,3 +49,5 @@ aliases: LIGHT_NEOPIXEL=MCU_STOP5 , STATUS_NEOPIXEL=MCU_NEOPIXEL , + SERVO_PIN=MCU_SERVOS , + diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index 74ac1a9e7..abf9b4e56 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -209,6 +209,8 @@ # ----------------------------------------------------------------- SENSORLESS HOMING ----> Select only one line ### -------------------------------------------------------------------------------------- # [include config/software/sensorless_homing/sensorless_TMC2209.cfg] +# [include config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg] +# [include config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg] ### Follow the Klipper documentation here: https://www.klipper3d.org/TMC_Drivers.html#sensorless-homing ### to find the best suited SGTHRS value according to your machine. Then add this value to your From d825ff8447b082f0fcae2b025ee8b506a18b43fa Mon Sep 17 00:00:00 2001 From: Jack Anderson Date: Sat, 15 Jul 2023 08:23:58 -0500 Subject: [PATCH 10/39] add filament warning sensor pins to octopus max --- .../mcu_defaults/main/BTT_Octopus_Max.cfg | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg diff --git a/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg b/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg new file mode 100644 index 000000000..9205dad94 --- /dev/null +++ b/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg @@ -0,0 +1,46 @@ + +#------------------------------------------# +#### BTT Octopus Max MCU definition ######## +#------------------------------------------# + +[mcu] +##-------------------------------------------------------------------- +# This board work by using a serial connection by default. If you +# want to use CAN, invert the commented lines and use canbus_uuid. + +serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path +# canbus_uuid: change-me-to-the-correct-canbus-id +##-------------------------------------------------------------------- + +[include config/mcu_definitions/main/BTT_Octopus_Max.cfg] # Do not remove this line +[board_pins octopus_max_mcu] +mcu: mcu +aliases: + X_STEP=MCU_MOTOR0_STEP , X_DIR=MCU_MOTOR0_DIR , X_ENABLE=MCU_MOTOR0_ENABLE , X_TMCUART=MCU_MOTOR0_UART , + Y_STEP=MCU_MOTOR1_STEP , Y_DIR=MCU_MOTOR1_DIR , Y_ENABLE=MCU_MOTOR1_ENABLE , Y_TMCUART=MCU_MOTOR1_UART , + + Z_STEP=MCU_MOTOR2_1_STEP , Z_DIR=MCU_MOTOR2_1_DIR , Z_ENABLE=MCU_MOTOR2_1_ENABLE , Z_TMCUART=MCU_MOTOR2_1_UART , + Z1_STEP=MCU_MOTOR3_STEP , Z1_DIR=MCU_MOTOR3_DIR , Z1_ENABLE=MCU_MOTOR3_ENABLE , Z1_TMCUART=MCU_MOTOR3_UART , + Z2_STEP=MCU_MOTOR4_STEP , Z2_DIR=MCU_MOTOR4_DIR , Z2_ENABLE=MCU_MOTOR4_ENABLE , Z2_TMCUART=MCU_MOTOR4_UART , + Z3_STEP=MCU_MOTOR5_STEP , Z3_DIR=MCU_MOTOR5_DIR , Z3_ENABLE=MCU_MOTOR5_ENABLE , Z3_TMCUART=MCU_MOTOR5_UART , + + E_STEP=MCU_MOTOR6_STEP , E_DIR=MCU_MOTOR6_DIR , E_ENABLE=MCU_MOTOR6_ENABLE , E_TMCUART=MCU_MOTOR6_UART , + + X_STOP=MCU_STOP0 , Y_STOP=MCU_STOP1 , Z_STOP=MCU_STOP2 , + PROBE_INPUT=MCU_STOP7 , + RUNOUT_SENSOR=MCU_FWS0 , + + E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_T0 , + BED_HEATER=MCU_HE1 , BED_TEMPERATURE=MCU_TB , + + PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , + CONTROLLER_FAN=MCU_FAN2 , + EXHAUST_FAN=MCU_FAN3 , + FILTER_FAN=MCU_FAN4 , HOST_CONTROLLER_FAN=MCU_FAN5 , + + CHAMBER_TEMPERATURE=MCU_T1 , ELECTRICAL_CABINET_TEMPERATURE=MCU_T2 , + + LIGHT_OUTPUT=MCU_HE2 , + LIGHT_NEOPIXEL=MCU_STOP5 , + STATUS_NEOPIXEL=MCU_NEOPIXEL , + From 9bb1adc777254629b97d51976c32f1d6c145d5c5 Mon Sep 17 00:00:00 2001 From: Jack Anderson Date: Sat, 15 Jul 2023 08:24:17 -0500 Subject: [PATCH 11/39] add btt octopus max template --- config/mcu_definitions/main/BTT_Octopus_Max.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/config/mcu_definitions/main/BTT_Octopus_Max.cfg b/config/mcu_definitions/main/BTT_Octopus_Max.cfg index c82a8201c..71a7b2d1e 100644 --- a/config/mcu_definitions/main/BTT_Octopus_Max.cfg +++ b/config/mcu_definitions/main/BTT_Octopus_Max.cfg @@ -32,6 +32,7 @@ aliases: MCU_NEOPIXEL2=PE9 , MCU_PS_ON=PF13 , MCU_POWER_DET=PF12 , + MCU_FWS0=PC0 , MCU_FWS1=PF10 # EXP1 header EXP1_1=PG2 , EXP1_2=PD15 , From 9713b5b5647a17a28f2b3775c6dc5f10800ba6ac Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sat, 15 Jul 2023 15:47:17 +0200 Subject: [PATCH 12/39] fix homing for bed at the bottom printers such as V0.2 --- macros/base/homing/homing_override.cfg | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/macros/base/homing/homing_override.cfg b/macros/base/homing/homing_override.cfg index f34f1340e..382911ee3 100644 --- a/macros/base/homing/homing_override.cfg +++ b/macros/base/homing/homing_override.cfg @@ -234,7 +234,11 @@ gcode: G28 Z0 G91 - G0 Z{homing_zhop} F{z_drop_speed} # small Z hop to avoid grinding the bed + {% if printer["configfile"].settings["stepper_z"]["homing_positive_dir"] == False %} + G0 Z{homing_zhop} F{z_drop_speed} # small Z hop to avoid grinding the bed (as we should be close to Z0 right now) + {% elif printer["configfile"].settings["stepper_z"]["homing_positive_dir"] == True %} + G0 Z-{homing_zhop} F{z_drop_speed} # small Z move in the opposite direction to avoid staying on the endstop (not dangerous since we should be at Z max) + {% endif %} G90 # if voron tap, restore original temperature From 38b593ea09e18914f0e3f66cf399ef1f4801c093 Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sat, 15 Jul 2023 18:42:47 +0200 Subject: [PATCH 13/39] TMC2240 for Z available and fix sensorless --- .../hardware/axis/Z/TMC/TMC2240_1-Motor.cfg | 17 +++++++++++++++ .../hardware/axis/Z/TMC/TMC2240_3-Motors.cfg | 21 +++++++++++++++++++ .../hardware/axis/Z/TMC/TMC2240_4-Motors.cfg | 11 ++++++++++ .../sensorless_BTT_TMC2240.cfg | 4 ++-- .../sensorless_MKS_TMC2240.cfg | 4 ++-- macros/base/homing/homing_override.cfg | 4 ++++ user_templates/mcu.cfg | 3 +++ 7 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 config/hardware/axis/Z/TMC/TMC2240_1-Motor.cfg create mode 100644 config/hardware/axis/Z/TMC/TMC2240_3-Motors.cfg create mode 100644 config/hardware/axis/Z/TMC/TMC2240_4-Motors.cfg diff --git a/config/hardware/axis/Z/TMC/TMC2240_1-Motor.cfg b/config/hardware/axis/Z/TMC/TMC2240_1-Motor.cfg new file mode 100644 index 000000000..2e3ae38bc --- /dev/null +++ b/config/hardware/axis/Z/TMC/TMC2240_1-Motor.cfg @@ -0,0 +1,17 @@ +# Z TMC2240 definition + +# User variable only needed here as they are called recursively +[gcode_macro _USER_VARIABLES] +variable_z_driver: "tmc2240" +gcode: + + +[tmc2240 stepper_z] +cs_pin: Z_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.7 +stealthchop_threshold: 0 diff --git a/config/hardware/axis/Z/TMC/TMC2240_3-Motors.cfg b/config/hardware/axis/Z/TMC/TMC2240_3-Motors.cfg new file mode 100644 index 000000000..5263c0c02 --- /dev/null +++ b/config/hardware/axis/Z/TMC/TMC2240_3-Motors.cfg @@ -0,0 +1,21 @@ +[include TMC2240_1-Motor.cfg] + +[tmc2240 stepper_z1] +cs_pin: Z1_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.7 +stealthchop_threshold: 0 + +[tmc2240 stepper_z2] +cs_pin: Z2_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.7 +stealthchop_threshold: 0 diff --git a/config/hardware/axis/Z/TMC/TMC2240_4-Motors.cfg b/config/hardware/axis/Z/TMC/TMC2240_4-Motors.cfg new file mode 100644 index 000000000..5de1fca9c --- /dev/null +++ b/config/hardware/axis/Z/TMC/TMC2240_4-Motors.cfg @@ -0,0 +1,11 @@ +[include TMC2240_3-Motors.cfg] + +[tmc2240 stepper_z3] +cs_pin: Z3_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO +interpolate: True +run_current: 0.7 +stealthchop_threshold: 0 diff --git a/config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg b/config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg index faf98fd34..041b0f3e7 100644 --- a/config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg +++ b/config/software/sensorless_homing/sensorless_BTT_TMC2240.cfg @@ -10,7 +10,7 @@ homing_speed: 40 endstop_pin: tmc2240_stepper_x:virtual_endstop [tmc2240 stepper_x] -diag1_pin: ^X_STOP +diag0_pin: ^!X_STOP driver_SGT: -64 [stepper_y] @@ -18,7 +18,7 @@ homing_speed: 40 endstop_pin: tmc2240_stepper_y:virtual_endstop [tmc2240 stepper_y] -diag1_pin: ^Y_STOP +diag0_pin: ^!Y_STOP driver_SGT: -64 # -64 is most sensitive value, 63 is least sensitive diff --git a/config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg b/config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg index a2c0d4f54..10e77ddbc 100644 --- a/config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg +++ b/config/software/sensorless_homing/sensorless_MKS_TMC2240.cfg @@ -10,7 +10,7 @@ homing_speed: 40 endstop_pin: tmc2240_stepper_x:virtual_endstop [tmc2240 stepper_x] -diag0_pin: ^X_STOP +diag1_pin: ^!X_STOP driver_SGT: -64 [stepper_y] @@ -18,7 +18,7 @@ homing_speed: 40 endstop_pin: tmc2240_stepper_y:virtual_endstop [tmc2240 stepper_y] -diag0_pin: ^Y_STOP +diag1_pin: ^!Y_STOP driver_SGT: -64 # -64 is most sensitive value, 63 is least sensitive diff --git a/macros/base/homing/homing_override.cfg b/macros/base/homing/homing_override.cfg index 382911ee3..3388889a0 100644 --- a/macros/base/homing/homing_override.cfg +++ b/macros/base/homing/homing_override.cfg @@ -114,6 +114,7 @@ gcode: {% set new_current_y = sensorless_current_factor * old_current_y %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 {% endif %} G28 X0 G1 X{x_position_endstop + x_homing_backoff} F{homing_travel_speed} @@ -134,6 +135,7 @@ gcode: {% set new_current_y = sensorless_current_factor * old_current_y %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 {% endif %} G28 Y0 G1 Y{y_position_endstop + y_homing_backoff} F{homing_travel_speed} @@ -156,6 +158,7 @@ gcode: {% set new_current_y = sensorless_current_factor * old_current_y %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 {% endif %} G28 Y0 G1 Y{y_position_endstop + y_homing_backoff} F{homing_travel_speed} @@ -176,6 +179,7 @@ gcode: {% set new_current_y = sensorless_current_factor * old_current_y %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 {% endif %} G28 X0 G1 X{x_position_endstop + x_homing_backoff} F{homing_travel_speed} diff --git a/user_templates/mcu.cfg b/user_templates/mcu.cfg index 9f98b0b31..3c6065eb6 100644 --- a/user_templates/mcu.cfg +++ b/user_templates/mcu.cfg @@ -31,6 +31,9 @@ # [include config/hardware/axis/Z/TMC/TMC2209_1-Motor.cfg] # [include config/hardware/axis/Z/TMC/TMC2209_3-Motors.cfg] # [include config/hardware/axis/Z/TMC/TMC2209_4-Motors.cfg] +# [include config/hardware/axis/Z/TMC/TMC2240_1-Motor.cfg] +# [include config/hardware/axis/Z/TMC/TMC2240_3-Motors.cfg] +# [include config/hardware/axis/Z/TMC/TMC2240_4-Motors.cfg] # ---------------------------------------------------------------------------------------- From 81dd8ca6540f376ae62db7b3c84a43a142c28cd6 Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sat, 15 Jul 2023 18:57:03 +0200 Subject: [PATCH 14/39] Z tilt and bed mesh config file added for 120mm bed (trizero and co) --- config/software/bed_mesh/bed_mesh_120mm.cfg | 28 +++++++++++++++++++++ config/software/tilting/z_tilt_120mm.cfg | 25 ++++++++++++++++++ user_templates/printer.cfg | 2 ++ 3 files changed, 55 insertions(+) create mode 100644 config/software/bed_mesh/bed_mesh_120mm.cfg create mode 100644 config/software/tilting/z_tilt_120mm.cfg diff --git a/config/software/bed_mesh/bed_mesh_120mm.cfg b/config/software/bed_mesh/bed_mesh_120mm.cfg new file mode 100644 index 000000000..9a71e663f --- /dev/null +++ b/config/software/bed_mesh/bed_mesh_120mm.cfg @@ -0,0 +1,28 @@ +# If this files is included, then it also activate the bed_mesh +# automatically in the START_PRINT macro +[gcode_macro _USER_VARIABLES] +variable_bed_mesh_enabled: True +gcode: + +# Also include directly the dockable probe overide of BED_MESH_CALIBRATE from here +[include ../../../macros/base/probing/overides/bed_mesh_calibrate.cfg] +# And also include the adaptive mesh macro at the same time +[include ../../../macros/calibration/adaptive_bed_mesh.cfg] + + +[bed_mesh] +# FOLLOW THE FORUMULA FOR relative_reference_index to be centered, +# This is only for manual call of BED_MESH_CABLIBRATE all those parameters are overridden on the fly if using the adaptive bed mesh macro +# for example: +# [(9x9)-1] / 2 = 40 +# [(7x7)-1] / 2 = 24 +# [(5x5)-1] / 2 = 12 +speed: 350 +horizontal_move_z: 12 +mesh_min: 7, 21.75 +mesh_max: 105, 113 +probe_count: 5, 5 +fade_start: 0.6 +fade_end: 10.0 +algorithm: bicubic +relative_reference_index: 12 diff --git a/config/software/tilting/z_tilt_120mm.cfg b/config/software/tilting/z_tilt_120mm.cfg new file mode 100644 index 000000000..9db6069d5 --- /dev/null +++ b/config/software/tilting/z_tilt_120mm.cfg @@ -0,0 +1,25 @@ +# Quand gantry leveling definition +# If this files is included, then it also activate the QGL +# automatically in the START_PRINT macro +[gcode_macro _USER_VARIABLES] +variable_ztilt_enabled: True +gcode: + +# Also include directly the dockable probe overide of qgl from here +[include ../../../macros/base/probing/overides/z_tilt.cfg] +[include ../../../macros/base/homing/tilting.cfg] + + +[z_tilt] +z_positions: + -48, 14 + 60, 140 + 168, 14 +points: + 22.5, 0.5 + 74.5, 98.25 + 116.5, 0.5 +speed: 350 +horizontal_move_z: 16 +retries: 5 +retry_tolerance: 0.0075 diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index abf9b4e56..a16c8a215 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -197,6 +197,7 @@ # -------------------------------------------------------------------------- BED MESH ----> Select only one line ### -------------------------------------------------------------------------------------- +# [include config/software/bed_mesh/bed_mesh_120mm.cfg] # [include config/software/bed_mesh/bed_mesh_250mm.cfg] # [include config/software/bed_mesh/bed_mesh_300mm.cfg] # [include config/software/bed_mesh/bed_mesh_350mm.cfg] @@ -236,6 +237,7 @@ # [include config/software/tilting/qgl_300mm.cfg] # [include config/software/tilting/qgl_350mm.cfg] +# [include config/software/tilting/z_tilt_120mm.cfg] # [include config/software/tilting/z_tilt_250mm.cfg] # [include config/software/tilting/z_tilt_300mm.cfg] # [include config/software/tilting/z_tilt_350mm.cfg] From 79d5e241727f05bb4c541d9c5a61c69942c32470 Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sat, 15 Jul 2023 20:28:31 +0200 Subject: [PATCH 15/39] fixed the relative_reference_index deprecation --- config/software/bed_mesh/bed_mesh_120mm.cfg | 8 +-- config/software/bed_mesh/bed_mesh_250mm.cfg | 8 +-- config/software/bed_mesh/bed_mesh_300mm.cfg | 8 +-- config/software/bed_mesh/bed_mesh_350mm.cfg | 8 +-- config/software/z_calibration.cfg | 2 +- docs/features/adaptive_bed_mesh.md | 58 ++------------------- macros/base/homing/homing_override.cfg | 33 ++++-------- macros/base/homing/z_calibration.cfg | 25 +++------ macros/base/start_print.cfg | 18 +------ macros/calibration/adaptive_bed_mesh.cfg | 56 ++++---------------- 10 files changed, 37 insertions(+), 187 deletions(-) diff --git a/config/software/bed_mesh/bed_mesh_120mm.cfg b/config/software/bed_mesh/bed_mesh_120mm.cfg index 9a71e663f..834ac4293 100644 --- a/config/software/bed_mesh/bed_mesh_120mm.cfg +++ b/config/software/bed_mesh/bed_mesh_120mm.cfg @@ -11,12 +11,6 @@ gcode: [bed_mesh] -# FOLLOW THE FORUMULA FOR relative_reference_index to be centered, -# This is only for manual call of BED_MESH_CABLIBRATE all those parameters are overridden on the fly if using the adaptive bed mesh macro -# for example: -# [(9x9)-1] / 2 = 40 -# [(7x7)-1] / 2 = 24 -# [(5x5)-1] / 2 = 12 speed: 350 horizontal_move_z: 12 mesh_min: 7, 21.75 @@ -25,4 +19,4 @@ probe_count: 5, 5 fade_start: 0.6 fade_end: 10.0 algorithm: bicubic -relative_reference_index: 12 +zero_reference_position: 60, 60 diff --git a/config/software/bed_mesh/bed_mesh_250mm.cfg b/config/software/bed_mesh/bed_mesh_250mm.cfg index f36e8bad5..613a9da5b 100644 --- a/config/software/bed_mesh/bed_mesh_250mm.cfg +++ b/config/software/bed_mesh/bed_mesh_250mm.cfg @@ -11,12 +11,6 @@ gcode: [bed_mesh] -# FOLLOW THE FORUMULA FOR relative_reference_index to be centered, -# This is only for manual call of BED_MESH_CABLIBRATE all those parameters are overridden on the fly if using the adaptive bed mesh macro -# for example: -# [(9x9)-1] / 2 = 40 -# [(7x7)-1] / 2 = 24 -# [(5x5)-1] / 2 = 12 speed: 350 horizontal_move_z: 12 mesh_min: 25, 25 @@ -25,4 +19,4 @@ probe_count: 7, 7 fade_start: 0.6 fade_end: 10.0 algorithm: bicubic -relative_reference_index: 24 +zero_reference_position: 125, 125 diff --git a/config/software/bed_mesh/bed_mesh_300mm.cfg b/config/software/bed_mesh/bed_mesh_300mm.cfg index 88cba2e42..956ee4b85 100644 --- a/config/software/bed_mesh/bed_mesh_300mm.cfg +++ b/config/software/bed_mesh/bed_mesh_300mm.cfg @@ -11,12 +11,6 @@ gcode: [bed_mesh] -# FOLLOW THE FORUMULA FOR relative_reference_index to be centered, -# This is only for manual call of BED_MESH_CABLIBRATE all those parameters are overridden on the fly if using the adaptive bed mesh macro -# for example: -# [(9x9)-1] / 2 = 40 -# [(7x7)-1] / 2 = 24 -# [(5x5)-1] / 2 = 12 speed: 350 horizontal_move_z: 12 mesh_min: 25, 25 @@ -25,4 +19,4 @@ probe_count: 9, 9 fade_start: 0.6 fade_end: 10.0 algorithm: bicubic -relative_reference_index: 40 +zero_reference_position: 150, 150 diff --git a/config/software/bed_mesh/bed_mesh_350mm.cfg b/config/software/bed_mesh/bed_mesh_350mm.cfg index 66afce978..6328567a9 100644 --- a/config/software/bed_mesh/bed_mesh_350mm.cfg +++ b/config/software/bed_mesh/bed_mesh_350mm.cfg @@ -11,12 +11,6 @@ gcode: [bed_mesh] -# FOLLOW THE FORUMULA FOR relative_reference_index to be centered, -# This is only for manual call of BED_MESH_CABLIBRATE all those parameters are overridden on the fly if using the adaptive bed mesh macro -# for example: -# [(9x9)-1] / 2 = 40 -# [(7x7)-1] / 2 = 24 -# [(5x5)-1] / 2 = 12 speed: 350 horizontal_move_z: 12 mesh_min: 25, 25 @@ -25,4 +19,4 @@ probe_count: 9, 9 fade_start: 0.6 fade_end: 10.0 algorithm: bicubic -relative_reference_index: 40 +zero_reference_position: 175, 175 diff --git a/config/software/z_calibration.cfg b/config/software/z_calibration.cfg index 849e39f07..52bdb77eb 100644 --- a/config/software/z_calibration.cfg +++ b/config/software/z_calibration.cfg @@ -25,5 +25,5 @@ samples: 3 #samples_tolerance: 0.01 speed: 350 # X,Y movements probing_first_fast: true -start_gcode: ACTIVATE_PROBE +before_switch_gcode: ACTIVATE_PROBE end_gcode: DEACTIVATE_PROBE diff --git a/docs/features/adaptive_bed_mesh.md b/docs/features/adaptive_bed_mesh.md index 8ae34a9fc..699defa7e 100644 --- a/docs/features/adaptive_bed_mesh.md +++ b/docs/features/adaptive_bed_mesh.md @@ -10,8 +10,7 @@ Sometime I print small parts, sometime I print full plates and I like to get a p Here is how the magic happen: 1. The coordinates of the first layer corners are extracted either from the slicer (currently work with SuperSlicer, PrusaSlicer and Cura) or (since v3.0) directly from the `[exclude_object]` tags of Klipper 2. On this area, a new set of points is computed to get at least the same precision (or better) as the original `[bed_mesh]` section. For example, if the `[bed_mesh]` section is set to 9×9 for a 300mm² bed, then it will compute for a 100mm² first layer surface a 3×3 mesh. Also if for whatever reason your parts are not in the center of the build plate (like when using a damaged PEI center), it will follow them to probe this exact area. - 3. The computed set of probed points is always odd: this allow the algorithm to compute a `relative_reference_index` point exactly in the center of the area. This point coordinates are saved in a variable if you need to use it somewhere else (like for example with the [klipper_z_calibration](https://github.com/protoloft/klipper_z_calibration) plugin and its `BED_POSITION` parameter). - 4. To go further, the adaptive bed mesh macro has also some smart features: + 3. To go further, the adaptive bed mesh macro has also some smart features: - The shape of the computed mesh is not always a square and is always adapted to fit the first layer: for example, it can be something like 3×9 in case of an elongated part. - In case of a very small part, the algorithm can choose automatically to not do any bed mesh at all if there is less than 3×3 points to probe. If this behavior is not wanted because of a very bad bed, a mesh can still be forced using the `FORCE_MESH=1` parameter. - The macro can also choose and change automatically the interpolation algorithm between bicubic and lagrange depending of the size and shape of the mesh computed (like 3×3 vs 3×9) to always get the best precision. @@ -51,13 +50,13 @@ If you want to install it to your own custom config, here is the way to go: PRINT_START [all your own things...] SIZE=%MINX%_%MINY%_%MAXX%_%MAXY% ``` -> Please note that using the `[exclude_object]` tags (method 1) is a little bit less precise than using the original "SIZE" parameter (method 2) as the `[exclude_object]` tags are using the full parts sizes (not only the first layer). So if you do a part with large overhangs, it will do a large mesh using the tags but will only mesh the base of the part with the SIZE parameter. Also, if you add a skirt around the parts, there is no tags associated to this and the mesh can be a little bit smaller and lead to bad adhesion of the skirt in case of a very bad "taco" bed (like on an Ender3 or CR10 style printers). So my advice is: use the [exclude_object] tags method for a new installation as it's much more easier to install. But if you are updating from an older version of the macro, continue to use the SIZE parameter as the hard part is already done and will still work. +> Please note that using the `[exclude_object]` tags (method 1) is a little bit less precise than using the original "SIZE" parameter (method 2) as the `[exclude_object]` tags are using the full parts sizes (not only the first layer). So if you do a part with large overhangs, it will do a large mesh using the tags but will only mesh the base of the part with the SIZE parameter. Also, if you add a skirt around the parts or use a purge tower (like ERCF users), there is no tags associated to this and the mesh can be a little bit smaller and lead to bad adhesion of these objects. So my advice is: use the [exclude_object] tags method for a new installation as it's much more easier to install. But if you are updating from an older version of the macro or use an ERCF, use the SIZE parameter! 3. In klipper, if it's not already the case, add and configure a `[bed_mesh]` for your machine. This will be the base on which my macro compute the new adaptive bed mesh. Keep in mind that you can (and should) push the precision a little bit further: do not hesistate to go with a mesh of 9x9 (or even more) as with my adaptive bed mesh, not all the points will be probed for smaller parts. 4. **VERY IMPORTANT CHECKS**: - Check that the `BED_MESH_CALIBRATE` command is working correctly now or fix your `[bed_mesh]` section. - - Check that the `mesh_min`, `mesh_max`, `probe_count` and `mesh_pps` config entries in your `[bed_mesh]` section are specified using **TWO numbers** as my macro is waiting for it and will fail if there is only one specified. Something like this is ok: + - Check that the `mesh_min`, `mesh_max`, `probe_count` and `mesh_pps` config entries in your `[bed_mesh]` section are specified using **TWO numbers** as my macro is waiting for it and will fail if there is only one specified. Something like this is ok: ``` probe_count: 9,9 @@ -71,56 +70,23 @@ If you want to install it to your own custom config, here is the way to go:
Using Exclude Objects -There is two way to use this set of macros and do an adaptive bed mesh. Choose between the two points the one that is best for you: - - 1. First way is the normal and easy way adapted for most of the users: in your klipper config, modify your `PRINT_START` macro definition by calling the `ADAPTIVE_BED_MESH` macro when you want to start the probing: +In your klipper config, modify your `PRINT_START` macro definition by calling the `ADAPTIVE_BED_MESH` macro when you want to start the probing: ``` ADAPTIVE_BED_MESH ``` - 2. Second way is for power users that also use the [klipper_z_calibration](https://github.com/protoloft/klipper_z_calibration) plugin and want to do the bed mesh **after** the Z calibration procedure. You will first need to add a call to `COMPUTE_MESH_PARAMETERS` somewhere in the beginning of your `PRINT_START`. - - Then you will need to call **in an another macro** the `CALIBRATE_Z` command with the computed mesh center point: - - ``` - {% set mesh_center = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].mesh_center %} - CALIBRATE_Z BED_POSITION={mesh_center} - ``` - - Finally, do a simple call to `ADAPTIVE_BED_MESH` whenever you want to effectively do the mesh. - - The *in an another macro* point is very important due to the way klipper is working and you will have troubles if you do not do this. For example, you can do it directly like me in the [CALIBRATE_Z overide](./../../macros/base/homing/z_calibration.cfg).
Using the SIZE parameter from the slicer -There is two way to use this set of macros and do an adaptive bed mesh. Choose between the two points the one that is best for you: - - 1. First way is the normal and easy way adapted for most of the users: in your klipper config, modify your `PRINT_START` macro definition by adding two lines of gcode. The first one is to get the `SIZE` parameter from the slicer, and the second one is to call the `ADAPTIVE_BED_MESH` macro to start the probing. Something like that will do the trick: +In your klipper config, modify your `PRINT_START` macro definition by adding two lines of gcode. The first one is to get the `SIZE` parameter from the slicer, and the second one is to call the `ADAPTIVE_BED_MESH` macro to start the probing. Something like that will do the trick: ``` {% set FL_SIZE = params.SIZE|default("0_0_0_0")|string %} ADAPTIVE_BED_MESH SIZE={FL_SIZE} ``` - 2. Second way is for power users that also use the [klipper_z_calibration](https://github.com/protoloft/klipper_z_calibration) plugin and want to do the bed mesh **after** the Z calibration procedure: in your klipper config, modify your `PRINT_START` macro definition by adding some gcode lines. First you need to get the `SIZE` parameter from the slicer and then call the `COMPUTE_MESH_PARAMETERS` macro with it like so: - - ``` - {% set FL_SIZE = params.SIZE|default("0_0_0_0")|string %} - COMPUTE_MESH_PARAMETERS SIZE={FL_SIZE} - ``` - - Then you need to call **in an another macro** the `CALIBRATE_Z` command with the computed mesh center point: - - ``` - {% set mesh_center = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].mesh_center %} - CALIBRATE_Z BED_POSITION={mesh_center} - ``` - - Finally, do a simple call to `ADAPTIVE_BED_MESH` whenever you want to effectively do the mesh. - - The *in an another macro* point is very important due to the way klipper is working and you will have troubles if you do not do this. For example, you can do it directly like me in the [CALIBRATE_Z overide](./../../macros/base/homing/z_calibration.cfg).
@@ -132,20 +98,6 @@ Regarding the parameters availables, you can use them either when calling the `A |MARGIN|5|margin in mm to add around the first layer for the probing area| |FORCE_MESH|0|force a 3×3 mesh even for very small parts (when less than 3×3 points are computed)| -## FAQ - -#### Error: !! Malformed command 'CALIBRATE_Z BED_POSITION=(0, 0)' -This is the most common issue and is in fact due to the way Klipper and the Jinja templates are working: the templates are evaluated at the beginning of every macro call to "generate" raw gcode. Then, this generated gcode is read and executed directly as-is by Klipper. This means that after the template is evaluated and the gcode generated, no more computation and/or memory access is done during the gcode execution. - -So basically, when you start a macro (like your `START_PRINT`), Klipper is rendering the Jinja template by accessing all the variables and so on and replace everything with their current value. If we speak about the `mesh_center`, this variable is not already computed at this time and the result will be `(0, 0)`. Then if you do some computation in the macro like `COMPUTE_MESH_PARAMETERS`, the gecode already generated will not be replaced (but will be in a next macro call). So in order to access it, you need to start a new macro that will render the template and generate gcode **after** having computed the mesh parameters. - -I don't know if I managed to explain clearly what happens in Klipper, but here is how to solve the issue: move the following two lines in another macro that is called **after** `COMPUTE_MESH_PARAMETERS`. You can also integrate this logic directly in the `CALIBRATE_Z` overide as I've done: [see here](./../../macros/base/homing/z_calibration.cfg). - -``` -{% set mesh_center = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].mesh_center %} -CALIBRATE_Z BED_POSITION={mesh_center} -``` - ## Partnerships diff --git a/macros/base/homing/homing_override.cfg b/macros/base/homing/homing_override.cfg index 3388889a0..142cfa3ec 100644 --- a/macros/base/homing/homing_override.cfg +++ b/macros/base/homing/homing_override.cfg @@ -201,28 +201,22 @@ gcode: { action_respond_info("Homing Z") } {% endif %} - # If there is a virtual probe endstop (ie. TAP or inductive as virtual), there are two cases: - # 1. If it's a standard and usual homing, we go to the bed center point - # 2. If it's a homing called during the print start for final Z offset adjustement, we check if there is - # an adaptive mesh computed. If possible we home directly on the RRI point (fallback to the bed center) + # If there is a virtual probe endstop (ie. TAP or inductive as virtual), we go to the center of the bed # If the Z endstop is not virtual, then we just move to it {% if printer["configfile"].config["stepper_z"]["endstop_pin"]|lower == "probe:z_virtual_endstop" %} - # In both cases, if our virtual endstop is a dockable probe, we need to activate it first - {% if probe_type_enabled == "dockable_virtual" %} + # If our virtual endstop is a dockable probe, we need to activate it first + # If it's the voron tap, we put it to a safe temperature + {% if probe_type_enabled == "dockable_virtual" or probe_type_enabled == "vorontap" %} ACTIVATE_PROBE {% endif %} - {% if bed_mesh_enabled %} - {% set mesh_ready = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].ready %} - {% if mesh_ready %} - {% set mesh_center = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].mesh_center %} - {% set x_mesh_center, y_mesh_center = mesh_center.split(',')|map('trim')|map('float') %} - RESPOND MSG="Z homing: a mesh is computed and ready, probing mesh center: {mesh_center}" - G0 X{x_mesh_center} Y{y_mesh_center} F{homing_travel_speed} - {% else %} - G0 X{x_position_center} Y{y_position_center} F{homing_travel_speed} - {% endif %} - {% else %} + + # If there is a bed_mesh enabled and a zero_reference_position set, we retrieve it to home on it + # Else, we default to the center of the bed + {% if not bed_mesh_enabled or not printer["configfile"].config["bed_mesh"]["zero_reference_position"] %} G0 X{x_position_center} Y{y_position_center} F{homing_travel_speed} + {% else %} + {% set ZRPx, ZRPy = printer["configfile"].config["bed_mesh"]["zero_reference_position"].split(',')|map('trim')|map('float') %} + G0 X{ZRPx} Y{ZRPy} F{homing_travel_speed} {% endif %} # Else, go to the Z endstop physical pin @@ -230,11 +224,6 @@ gcode: _GOTO_Z_PROBE {% endif %} - # Check in case of a Voron TAP probe to avoid probing the bed at high temperature - {% if probe_type_enabled == "vorontap" %} - ACTIVATE_PROBE - {% endif %} - G28 Z0 G91 diff --git a/macros/base/homing/z_calibration.cfg b/macros/base/homing/z_calibration.cfg index 5bc1d4e74..4e35cbd2b 100644 --- a/macros/base/homing/z_calibration.cfg +++ b/macros/base/homing/z_calibration.cfg @@ -22,31 +22,18 @@ gcode: { action_respond_info("Z Offset calibration") } {% endif %} - ACTIVATE_PROBE - # Goto to z probe avoiding dock _GOTO_Z_PROBE - # Auto Z offset adjustement. If a mesh is ready to be done, we look at the center point - # and use it as the bed probing point. klipper_z_calibration plugin minimum version v0.8.2 needed - # Else we just call a standard CALIBRATE_Z command (to get the center from the current mesh RRI or config bed center point) - {% if bed_mesh_enabled %} - {% set mesh_ready = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].ready %} - {% set mesh_center = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].mesh_center %} - - {% if mesh_ready %} - RESPOND MSG="Z calibration: a mesh is computed and ready, probing mesh center: {mesh_center}" - _BASE_CALIBRATE_Z BED_POSITION={mesh_center} - {% else %} - RESPOND MSG="Z calibration: probing default point (or using current mesh RRI)" - _BASE_CALIBRATE_Z - {% endif %} - {% else %} + # If there is a bed_mesh enabled and a zero_reference_position set, we retrieve it to calibrate Z on it (using probe offsets) + # Else, we default to the center of the bed + {% if not bed_mesh_enabled or not printer["configfile"].config["bed_mesh"]["zero_reference_position"] %} _BASE_CALIBRATE_Z + {% else %} + {% set ZRPx, ZRPy = printer["configfile"].config["bed_mesh"]["zero_reference_position"].split(',')|map('trim')|map('float') %} + _BASE_CALIBRATE_Z BED_POSITION="{ZRPx},{ZRPy}" {% endif %} - DEACTIVATE_PROBE - {% if status_leds_enabled %} STATUS_LEDS COLOR="READY" {% endif %} diff --git a/macros/base/start_print.cfg b/macros/base/start_print.cfg index ea3458411..e298f2e75 100644 --- a/macros/base/start_print.cfg +++ b/macros/base/start_print.cfg @@ -343,14 +343,7 @@ gcode: # If auto z calibration plugin is enabled, we measure the nozzle height using the physical Z endstop probe, followed by # a measurement of the probe on the physical Z endstop probe, and then a measurement of the center of the bed (or mesh) # If it's a TAP probe or inductive probe or no Z calibration, then it's only a G28 Z to get a correct Z offset measurement - {% set FL_SIZE = printer["gcode_macro START_PRINT"].fl_size %} - {% set zcalib_plugin_enabled = printer["gcode_macro _USER_VARIABLES"].zcalib_plugin_enabled %} - {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} - - {% if bed_mesh_enabled and printer.bed_mesh.profile_name == "" %} - COMPUTE_MESH_PARAMETERS SIZE={FL_SIZE} - {% endif %} {% if zcalib_plugin_enabled %} G28 Z @@ -363,10 +356,6 @@ gcode: [gcode_macro _MODULE_BED_MESH] gcode: # ----- BED MESH ------------------------------------------- - # For the bed mesh, there is two possibilities depending if we use the auto z calibration plugin: - # - If yes, then a mesh should already be ready by a call to COMPUTE_MESH_PARAMETERS from a previous module - # because we already needed to use the mesh_center point as a parameter to the z calibration command - # - If no, then we need to use the SIZE parameter to the ADAPTIVE_BED_MESH call to do all at once now {% set FL_SIZE = printer["gcode_macro START_PRINT"].fl_size %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} @@ -381,12 +370,7 @@ gcode: RESPOND MSG="Bed mesh measurement..." {% endif %} - {% set mesh_ready = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].ready %} - {% if mesh_ready %} - ADAPTIVE_BED_MESH - {% else %} - ADAPTIVE_BED_MESH SIZE={FL_SIZE} - {% endif %} + ADAPTIVE_BED_MESH SIZE={FL_SIZE} {% endif %} diff --git a/macros/calibration/adaptive_bed_mesh.cfg b/macros/calibration/adaptive_bed_mesh.cfg index 438961d09..5e3e21ea2 100644 --- a/macros/calibration/adaptive_bed_mesh.cfg +++ b/macros/calibration/adaptive_bed_mesh.cfg @@ -2,9 +2,13 @@ ########## ADAPTIVE BED MESH ############ ######################################### # Written by Frix_x#0161 # -# @version: 3.0 +# @version: 4.0 # CHANGELOG: +# v4.0: - patched and re-simplified the macro to work with latest Klipper changes: zero_reference_position is much more constrained and all the fancy stuff +# that was used in the past for homing over the RRI with virtual probe or Z calibration plugin is not possible anymore. Now homing must be done at +# fixed zero_reference_poisition and can't be dynamic anymore (but it's also simpler) +# - this change also allow the mesh to have even probe point now for more flexibility # v3.0: - added the use of [exclude_object] tags to extract the first layer bounding box (many thanks to Kyleisah for the excellent idea and inspiration) # the macro is still fully compatible with the old way using the SIZE parameter: it will use it if specified, or else # fallback to the [exclude_object] method and if both are not available, it will do a full and normal bed mesh as usual. @@ -30,9 +34,7 @@ # 2. It compute a new set of points to probe on this new zone to get at least the same precision as your standard bed mesh. For example, if # a normal bed mesh is set to 9x9 for 300mm², it will then compute 3x3 for a 100mm² surface. Also if for whatever reason your parts are in # the corner of the build plate (like for a damaged PEI in the center), it will follow them to probe this exact area. -# 3. As the probed points computed are odd, it will also compute the new relative reference index point in the center of the zone and save -# the coordinates of this point to use them somwhere else (like the probed point of the auto z calibration plugin for example). -# 4. To go further, it will not do any bed_mesh if there is less than 3x3 points to probe (very small part alone) and choose/change the +# 3. To go further, it will not do any bed_mesh if there is less than 3x3 points to probe (very small part alone) and choose/change the # algorithm (bicubic/lagrange) depending of the size and shape of the mesh computed (like 3x3 vs 3x9) # Feel free to ping me on Discord (Frix_x#0161) if you need help or have any comments to improve it :) @@ -46,9 +48,7 @@ variable_do_mesh: False variable_do_nominal: False variable_mesh_min: 0,0 variable_mesh_max: 0,0 -variable_mesh_center: 0,0 variable_probe_count: 0,0 -variable_rri: 0 variable_algo: "bicubic" gcode: @@ -120,44 +120,25 @@ gcode: RESPOND MSG="Bed mesh forced (small part detected): meshing 3x3..." {% set xProbeCnt = 3 %} {% set yProbeCnt = 3 %} - {% set rRefIndex = 4 %} {% set algo = "lagrange" %} - {% set xCenter = xMin + ((xMax - xMin) / 2) %} - {% set yCenter = yMin + ((yMax - yMin) / 2) %} {% set mesh_min = "%d,%d"|format(xMin, yMin) %} {% set mesh_max = "%d,%d"|format(xMax, yMax) %} {% set probe_count = "%d,%d"|format(xProbeCnt, yProbeCnt) %} - {% set mesh_center = "%d,%d"|format(xCenter, yCenter) %} - RESPOND MSG="Computed mesh parameters: MESH_MIN={mesh_min} MESH_MAX={mesh_max} MESH_CENTER={mesh_center} PROBE_COUNT={probe_count} RELATIVE_REFERENCE_INDEX={rRefIndex} ALGORITHM={algo}" + RESPOND MSG="Computed mesh parameters: MESH_MIN={mesh_min} MESH_MAX={mesh_max} PROBE_COUNT={probe_count} ALGORITHM={algo}" SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=do_mesh VALUE={True} SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=do_nominal VALUE={False} SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=mesh_min VALUE='"{mesh_min}"' SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=mesh_max VALUE='"{mesh_max}"' - SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=mesh_center VALUE='"{mesh_center}"' SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=probe_count VALUE='"{probe_count}"' - SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=rri VALUE={rRefIndex} SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=algo VALUE='"{algo}"' {% else %} RESPOND MSG="Computed mesh parameters: none, bed mesh not needed for very small parts" SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=do_mesh VALUE={False} - {% set xCenter = xMin + ((xMax - xMin) / 2) %} - {% set yCenter = yMin + ((yMax - yMin) / 2) %} - {% set mesh_center = "%d,%d"|format(xCenter, yCenter) %} # we still compute the mesh center for those using klipper_z_calibration - SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=mesh_center VALUE='"{mesh_center}"' {% endif %} {% else %} {% set xProbeCnt = [3, xProbeCnt]|max %} {% set yProbeCnt = [3, yProbeCnt]|max %} - # We verify that the number of probe points on each axis is odd or add one to it - # This is very important to have a relative_reference_index point at the center of the mesh ! - {% if xProbeCnt % 2 == 0 %} - {% set xProbeCnt = xProbeCnt + 1 %} - {% endif %} - {% if yProbeCnt % 2 == 0 %} - {% set yProbeCnt = yProbeCnt + 1 %} - {% endif %} - # Check of the probe points and interpolation algorithms according to Klipper code {% if xMeshPPS != 0 or yMeshPPS != 0 %} {% set probeCntMin = [xProbeCnt, yProbeCnt]|min %} @@ -181,34 +162,21 @@ gcode: {% endif %} {% endif %} - # 5 ----- COMPUTE THE RELATIVE_REFERENCE_INDEX POINT -------------------- - {% set rRefIndex = (((xProbeCnt * yProbeCnt) - 1) / 2)|int %} - {% set xCenter = xMin + ((xMax - xMin) / 2) %} - {% set yCenter = yMin + ((yMax - yMin) / 2) %} - - # 6 ----- FORMAT THE PARAMETERS AND SAVE THEM --------------------------- + # 5 ----- FORMAT THE PARAMETERS AND SAVE THEM --------------------------- {% set mesh_min = "%d,%d"|format(xMin, yMin) %} {% set mesh_max = "%d,%d"|format(xMax, yMax) %} {% set probe_count = "%d,%d"|format(xProbeCnt, yProbeCnt) %} - {% set mesh_center = "%d,%d"|format(xCenter, yCenter) %} - RESPOND MSG="Computed mesh parameters: MESH_MIN={mesh_min} MESH_MAX={mesh_max} MESH_CENTER={mesh_center} PROBE_COUNT={probe_count} RELATIVE_REFERENCE_INDEX={rRefIndex} ALGORITHM={algo}" + RESPOND MSG="Computed mesh parameters: MESH_MIN={mesh_min} MESH_MAX={mesh_max} PROBE_COUNT={probe_count} ALGORITHM={algo}" SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=do_mesh VALUE={True} SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=do_nominal VALUE={False} SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=mesh_min VALUE='"{mesh_min}"' SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=mesh_max VALUE='"{mesh_max}"' - SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=mesh_center VALUE='"{mesh_center}"' SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=probe_count VALUE='"{probe_count}"' - SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=rri VALUE={rRefIndex} SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=algo VALUE='"{algo}"' {% endif %} {% else %} SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=do_mesh VALUE={True} SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=do_nominal VALUE={True} - - {% set xCenter = xMinConf + ((xMaxConf - xMinConf) / 2) %} - {% set yCenter = yMinConf + ((yMaxConf - yMinConf) / 2) %} - {% set mesh_center = "%d,%d"|format(xCenter, yCenter) %} # we still compute the mesh center for those using klipper_z_calibration - SET_GCODE_VARIABLE MACRO=_ADAPTIVE_MESH_VARIABLES VARIABLE=mesh_center VALUE='"{mesh_center}"' {% endif %} # Finaly save in the variables that we already computed the values @@ -246,7 +214,6 @@ gcode: {% set mesh_min = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].mesh_min %} {% set mesh_max = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].mesh_max %} {% set probe_count = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].probe_count %} - {% set rRefIndex = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].rri %} {% set algo = printer["gcode_macro _ADAPTIVE_MESH_VARIABLES"].algo %} # 2 --------- ADAPTIVE_BED_MESH LOGIC -------------------------------------- @@ -258,13 +225,8 @@ gcode: RESPOND MSG="Adaptive bed mesh: nominal bed mesh" BED_MESH_CALIBRATE {% else %} - {% if printer["configfile"].config["bed_mesh"]["relative_reference_index"] is defined %} - RESPOND MSG="Adaptive bed mesh: MESH_MIN={mesh_min} MESH_MAX={mesh_max} PROBE_COUNT={probe_count} RELATIVE_REFERENCE_INDEX={rRefIndex} ALGORITHM={algo}" - BED_MESH_CALIBRATE MESH_MIN={mesh_min} MESH_MAX={mesh_max} PROBE_COUNT={probe_count} RELATIVE_REFERENCE_INDEX={rRefIndex} ALGORITHM={algo} - {% else %} RESPOND MSG="Adaptive bed mesh: MESH_MIN={mesh_min} MESH_MAX={mesh_max} PROBE_COUNT={probe_count} ALGORITHM={algo}" BED_MESH_CALIBRATE MESH_MIN={mesh_min} MESH_MAX={mesh_max} PROBE_COUNT={probe_count} ALGORITHM={algo} - {% endif %} {% endif %} {% else %} RESPOND MSG="Adaptive bed mesh: no mesh to be done" From 6ca43544ad12e5c589c7545dae2416071bdbc1f1 Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sat, 15 Jul 2023 22:58:07 +0200 Subject: [PATCH 16/39] fixed the logging for the chamber temp when timing out --- macros/helpers/heatsoak.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macros/helpers/heatsoak.cfg b/macros/helpers/heatsoak.cfg index c4596e240..53bc640ca 100644 --- a/macros/helpers/heatsoak.cfg +++ b/macros/helpers/heatsoak.cfg @@ -13,7 +13,7 @@ gcode: _WAIT_CHAMBER_TEMP TEMP={SETPOINT_TEMP} {% endfor %} {% if verbose %} - RESPOND MSG="Chamber temperature OK !" + RESPOND MSG="Chamber temperature OK or timeout reached!" {% endif %} {% endif %} From 46b240366d91aa123ef144f62f720c7fc19cad21 Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sun, 16 Jul 2023 12:45:40 +0200 Subject: [PATCH 17/39] Filament motion sensor pause on runout --- config/hardware/filament_sensors/motion_sensor.cfg | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/config/hardware/filament_sensors/motion_sensor.cfg b/config/hardware/filament_sensors/motion_sensor.cfg index 9fc4a970c..2e46f05e2 100644 --- a/config/hardware/filament_sensors/motion_sensor.cfg +++ b/config/hardware/filament_sensors/motion_sensor.cfg @@ -4,18 +4,11 @@ gcode: [filament_motion_sensor runout_sensor] +switch_pin: RUNOUT_SENSOR detection_length: 7.0 -# The minimum length of filament pulled through the sensor to trigger -# a state change on the switch_pin -# Default is 7 mm. extruder: extruder -# The name of the extruder section this sensor is associated with. -# This parameter must be provided. -switch_pin:RUNOUT_SENSOR -pause_on_runout:False +pause_on_runout: True #runout_gcode: #insert_gcode: #event_delay: #pause_delay: -# See the "filament_switch_sensor" section for a description of the -# above parameters. From 47f9b4c374aa1aacee473e491e82daec9bc230ee Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sun, 16 Jul 2023 19:51:14 +0200 Subject: [PATCH 18/39] controller fan is now a real controller fan --- config/hardware/fans/controller_fan.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/hardware/fans/controller_fan.cfg b/config/hardware/fans/controller_fan.cfg index 3d9a83668..cf5fc3735 100644 --- a/config/hardware/fans/controller_fan.cfg +++ b/config/hardware/fans/controller_fan.cfg @@ -1,5 +1,5 @@ -[heater_fan controller_fan] +[controller_fan controller_fan] pin: CONTROLLER_FAN kick_start_time: 0.5 -heater: heater_bed -heater_temp: 45.0 +fan_speed: 1.0 +idle_timeout: 60 From 1d4bb76fce5182cfbd94bf5f5149338b7c6f4a07 Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Sun, 16 Jul 2023 19:52:59 +0200 Subject: [PATCH 19/39] fixed logging to avoid confusing Klippain users --- scripts/system_info.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/system_info.py b/scripts/system_info.py index 6e6fe0293..03ab8852b 100755 --- a/scripts/system_info.py +++ b/scripts/system_info.py @@ -109,8 +109,8 @@ def print_system_info(): else: # This is the case where it is running on a unknown machine type # so we use the specific function to try to gather more info... - print(f"Machine: {machine} - in an unknown machine") - print(f"Unknown system information: {get_unknown_board_info()}") + print(f"Machine: {machine}") + print(f"System information: {get_unknown_board_info()}") total_ram, available_ram = future_ram_info.result() From a898f1368a22fcc362d3d5f8415bca113c83837e Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Mon, 17 Jul 2023 16:43:55 +0200 Subject: [PATCH 20/39] fixed servos overheating due to unreleased control --- macros/hardware_functions/servos.cfg | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/macros/hardware_functions/servos.cfg b/macros/hardware_functions/servos.cfg index 5d7acbbb5..de8ad34b7 100644 --- a/macros/hardware_functions/servos.cfg +++ b/macros/hardware_functions/servos.cfg @@ -18,7 +18,9 @@ gcode: {% set probe_servo_name = printer["gcode_macro _USER_VARIABLES"].probe_servo_name %} {% set probe_servo_angle_deployed = printer["gcode_macro _USER_VARIABLES"].probe_servo_angle_deployed %} SET_SERVO SERVO={probe_servo_name} ANGLE={probe_servo_angle_deployed} - G4 P500 + M400 + G4 P1000 + SET_SERVO SERVO={probe_servo_name} WIDTH=0 {% elif item == "purge" or item == "clean" %} {% if verbose %} @@ -32,7 +34,9 @@ gcode: {% set purgeclean_servo_name = printer["gcode_macro _USER_VARIABLES"].purgeclean_servo_name %} {% set purgeclean_servo_angle_deployed = printer["gcode_macro _USER_VARIABLES"].purgeclean_servo_angle_deployed %} SET_SERVO SERVO={purgeclean_servo_name} ANGLE={purgeclean_servo_angle_deployed} - G4 P500 + M400 + G4 P1000 + SET_SERVO SERVO={purgeclean_servo_name} WIDTH=0 {% else %} { action_raise_error("Servo ITEM must be specified!") } @@ -59,7 +63,9 @@ gcode: {% set probe_servo_name = printer["gcode_macro _USER_VARIABLES"].probe_servo_name %} {% set probe_servo_angle_retracted = printer["gcode_macro _USER_VARIABLES"].probe_servo_angle_retracted %} SET_SERVO SERVO={probe_servo_name} ANGLE={probe_servo_angle_retracted} - G4 P500 + M400 + G4 P1000 + SET_SERVO SERVO={probe_servo_name} WIDTH=0 {% elif item == "purge" or item == "clean" %} {% if verbose %} @@ -73,7 +79,9 @@ gcode: {% set purgeclean_servo_name = printer["gcode_macro _USER_VARIABLES"].purgeclean_servo_name %} {% set purgeclean_servo_angle_retracted = printer["gcode_macro _USER_VARIABLES"].purgeclean_servo_angle_retracted %} SET_SERVO SERVO={purgeclean_servo_name} ANGLE={purgeclean_servo_angle_retracted} - G4 P500 + M400 + G4 P1000 + SET_SERVO SERVO={purgeclean_servo_name} WIDTH=0 {% else %} { action_raise_error("Servo ITEM must be specified!") } From 1737c95d07add68cbd91dec3944d12b712106872 Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Mon, 17 Jul 2023 20:36:58 +0200 Subject: [PATCH 21/39] added DS18B20 chamber temperature sensor --- .../chamber_temp_ds18b20.cfg | 17 +++++++++++++++++ user_templates/printer.cfg | 1 + 2 files changed, 18 insertions(+) create mode 100644 config/hardware/temperature_sensors/chamber_temp_ds18b20.cfg diff --git a/config/hardware/temperature_sensors/chamber_temp_ds18b20.cfg b/config/hardware/temperature_sensors/chamber_temp_ds18b20.cfg new file mode 100644 index 000000000..a6e2f7cb7 --- /dev/null +++ b/config/hardware/temperature_sensors/chamber_temp_ds18b20.cfg @@ -0,0 +1,17 @@ +# If the machine is equiped by a temperature sensor in the chamber +# it will be used to measure and control the chamber heatsoak + +# This file is very specific to DS18B20 sensors connected to the Pi 1Wire interface +# See: https://forum.vorondesign.com/threads/adding-a-temperature-sensor-when-youre-out-of-thermistor-ports.186/ + +[gcode_macro _USER_VARIABLES] +variable_chamber_temperature_sensor_enabled: True +variable_chamber_temperature_sensor_name: "Chamber" +gcode: + +[include ../../mcu_definitions/rpi.cfg] + +[temperature_sensor Chamber] +sensor_type: DS18B20 +sensor_mcu: rpi +serial_no: override-me-to-the-correct-serial diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index a16c8a215..f0f50a3d8 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -139,6 +139,7 @@ # [include config/hardware/temperature_sensors/toolhead_mcu_temp.cfg] # [include config/hardware/temperature_sensors/cabinet_temp.cfg] # [include config/hardware/temperature_sensors/chamber_temp.cfg] +# [include config/hardware/temperature_sensors/chamber_temp_ds18b20.cfg] # Specific for DS18B20 directly connected to the Pi # [include config/hardware/temperature_sensors/chamber_temp_toolhead.cfg] # This is not recommended as toolhead board temperature sensors are not accurate # ---------------------------------------------------------------------------------------- From e3d834171ff78f2ac7f7e3e1eb2b549e7c6c7740 Mon Sep 17 00:00:00 2001 From: Felix Boisselier Date: Mon, 17 Jul 2023 21:00:25 +0200 Subject: [PATCH 22/39] updated MCU templates to allow SPI driver connection (and missing servo pin) --- config/hardware/extruder/TMC/TMC2240.cfg | 9 +++++---- user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.0.cfg | 8 +++++++- user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.1.cfg | 8 +++++++- user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg | 1 + user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg | 4 ++++ user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg | 4 ++++ 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/config/hardware/extruder/TMC/TMC2240.cfg b/config/hardware/extruder/TMC/TMC2240.cfg index 4886f9ec7..913c77acd 100644 --- a/config/hardware/extruder/TMC/TMC2240.cfg +++ b/config/hardware/extruder/TMC/TMC2240.cfg @@ -4,10 +4,11 @@ variable_e_driver: "tmc2240" gcode: [tmc2240 extruder] -cs_pin: E_CS -spi_software_sclk_pin: E_SCLK -spi_software_mosi_pin: E_MOSI -spi_software_miso_pin: E_MISO +cs_pin: E_TMCUART +spi_speed: 500000 +spi_software_sclk_pin: DRIVER_SPI_SCK +spi_software_mosi_pin: DRIVER_SPI_MOSI +spi_software_miso_pin: DRIVER_SPI_MISO run_current: 0.6 stealthchop_threshold: 0 spi_speed: 500000 diff --git a/user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.0.cfg b/user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.0.cfg index 4c5709967..618cae430 100644 --- a/user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.0.cfg +++ b/user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.0.cfg @@ -26,8 +26,12 @@ aliases: E_STEP=MCU_M7_STEP , E_DIR=MCU_M7_DIR , E_ENABLE=MCU_M7_EN , E_TMCUART=MCU_M7_CS , + DRIVER_SPI_MOSI=MCU_SPI2_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_SPI2_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_SPI2_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + X_STOP=MCU_M1_STOP , Y_STOP=MCU_M2_STOP , Z_STOP=MCU_M3_STOP , - PROBE_INPUT=MCU_PROBE1 , + PROBE_INPUT=MCU_PROBE2 , RUNOUT_SENSOR=MCU_FIL_DET1 , E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_TH0 , @@ -45,3 +49,5 @@ aliases: LIGHT_OUTPUT=MCU_HE2 , STATUS_NEOPIXEL=MCU_RGB1 , LIGHT_NEOPIXEL=MCU_RGB2 , + + SERVO_PIN=MCU_PROBE1 , diff --git a/user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.1.cfg b/user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.1.cfg index 026e11039..9030e9b78 100644 --- a/user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.1.cfg +++ b/user_templates/mcu_defaults/main/BTT_Manta_M8P_v1.1.cfg @@ -26,8 +26,12 @@ aliases: E_STEP=MCU_M7_STEP , E_DIR=MCU_M7_DIR , E_ENABLE=MCU_M7_EN , E_TMCUART=MCU_M7_CS , + DRIVER_SPI_MOSI=MCU_SPI2_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_SPI2_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_SPI2_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + X_STOP=MCU_M1_STOP , Y_STOP=MCU_M2_STOP , Z_STOP=MCU_M3_STOP , - PROBE_INPUT=MCU_PROBE1 , + PROBE_INPUT=MCU_PROBE2 , RUNOUT_SENSOR=MCU_FWS1 , E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_TH0 , @@ -45,3 +49,5 @@ aliases: LIGHT_OUTPUT=MCU_HE2 , STATUS_NEOPIXEL=MCU_RGB1 , LIGHT_NEOPIXEL=MCU_RGB2 , + + SERVO_PIN=MCU_PROBE1 , diff --git a/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg b/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg index 9205dad94..2c890d285 100644 --- a/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg +++ b/user_templates/mcu_defaults/main/BTT_Octopus_Max.cfg @@ -44,3 +44,4 @@ aliases: LIGHT_NEOPIXEL=MCU_STOP5 , STATUS_NEOPIXEL=MCU_NEOPIXEL , + SERVO_PIN=MCU_SERVOS , diff --git a/user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg b/user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg index 8a36a5a81..84d632764 100644 --- a/user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg +++ b/user_templates/mcu_defaults/main/Fysetc_Spider_v1.x.cfg @@ -26,6 +26,10 @@ aliases: E_STEP=MCU_E0_MOT_STEP , E_DIR=MCU_E0_MOT_DIR , E_ENABLE=MCU_E0_MOT_ENABLE , E_TMCUART=MCU_E0_MOT_CS_PDN , + DRIVER_SPI_MOSI=MCU_TMC_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_TMC_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_TMC_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + X_STOP=MCU_X_MAX , Y_STOP=MCU_Y_MAX , Z_STOP=MCU_Z_MIN , PROBE_INPUT=MCU_Z_MAX , RUNOUT_SENSOR=MCU_Y_MIN , # If using sensorless homing: you will need to move the runout sensor on another pin diff --git a/user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg b/user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg index 6ffd36e4c..2c5e4a7e6 100644 --- a/user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg +++ b/user_templates/mcu_defaults/main/Fysetc_Spider_v2.x.cfg @@ -26,6 +26,10 @@ aliases: E_STEP=MCU_E0_MOT_STEP , E_DIR=MCU_E0_MOT_DIR , E_ENABLE=MCU_E0_MOT_ENABLE , E_TMCUART=MCU_E0_MOT_CS_PDN , + DRIVER_SPI_MOSI=MCU_SPI4_MOSI , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_MISO=MCU_SPI4_MISO , # Used in case of SPI drivers such as TMC2240 or TMC5160 + DRIVER_SPI_SCK=MCU_SPI4_SCK , # Used in case of SPI drivers such as TMC2240 or TMC5160 + X_STOP=MCU_X_MAX , Y_STOP=MCU_Y_MAX , Z_STOP=MCU_Z_MIN , PROBE_INPUT=MCU_Z_MAX , RUNOUT_SENSOR=MCU_Y_MIN , # If using sensorless homing: you will need to move the runout sensor on another pin From ebec9f22c7cd995302c4f1fec424caeced126480 Mon Sep 17 00:00:00 2001 From: Surion79 <102791900+Surion79@users.noreply.github.com> Date: Mon, 17 Jul 2023 23:04:56 +0200 Subject: [PATCH 23/39] system info raspberry pi --- scripts/system_info.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/system_info.py b/scripts/system_info.py index 03ab8852b..1995944d4 100755 --- a/scripts/system_info.py +++ b/scripts/system_info.py @@ -42,12 +42,11 @@ def check_wsl(): return False def get_pi_model(): - if "arm" in platform.machine(): - try: - model_info = subprocess.check_output(['cat', '/sys/firmware/devicetree/base/model'], universal_newlines=True) - return model_info - except subprocess.CalledProcessError: - return None + try: + model_info = subprocess.check_output(['cat', '/sys/firmware/devicetree/base/model'], universal_newlines=True) + if 'raspberry pi' in model_info.lower(): return model_info + except subprocess.CalledProcessError: + return None else: return None From 8f9a8049f6963a6aabf4ef129f5948446f657d39 Mon Sep 17 00:00:00 2001 From: Surion79 <102791900+Surion79@users.noreply.github.com> Date: Tue, 25 Jul 2023 09:58:49 +0200 Subject: [PATCH 24/39] custom filter time on end print (#260) --- macros/base/end_print.cfg | 3 ++- user_templates/variables.cfg | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/macros/base/end_print.cfg b/macros/base/end_print.cfg index 05f5bc04c..4f1a5f23f 100644 --- a/macros/base/end_print.cfg +++ b/macros/base/end_print.cfg @@ -11,6 +11,7 @@ gcode: {% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} + {% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %} PARK @@ -47,7 +48,7 @@ gcode: # If a filter is connected, filter the air at full power # for a couple of min before stopping everything {% if filter_enabled %} - {% set FILTER_TIME = params.FILTER_TIME|default(600)|int %} + {% set FILTER_TIME = params.FILTER_TIME|default(filter_default_time)|int %} START_FILTER SPEED=1 UPDATE_DELAYED_GCODE ID=_STOP_FILTER_DELAYED DURATION={FILTER_TIME} {% endif %} diff --git a/user_templates/variables.cfg b/user_templates/variables.cfg index 68bd45f12..392a14fef 100644 --- a/user_templates/variables.cfg +++ b/user_templates/variables.cfg @@ -182,6 +182,12 @@ variable_ercf_unload_on_cancel_print: False variable_ercf_unload_on_end_print: True variable_ercf_reset_stats_on_start_print: False +################################################ +## Filter specific variables +################################################ +## This section is only considered if a filter is available (and enabled) + +variable_filter_default_time_on_end_print = 600 # seconds ################################################ # Other hardware options used in the macros From 59f218a7e3c62c74e1186a48d4c30e44236ca431 Mon Sep 17 00:00:00 2001 From: Surion79 <102791900+Surion79@users.noreply.github.com> Date: Wed, 26 Jul 2023 01:26:17 +0200 Subject: [PATCH 25/39] fixed check on startup for ercf --- macros/miscs/startup.cfg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/macros/miscs/startup.cfg b/macros/miscs/startup.cfg index ea9e9d66a..2ffd2719d 100644 --- a/macros/miscs/startup.cfg +++ b/macros/miscs/startup.cfg @@ -127,11 +127,10 @@ gcode: [gcode_macro _INIT_CHECK_ERCF] gcode: - {% if not printer.ercf.enabled %} + {% if printer.ercf is not defined %} { action_raise_error("ERCF is enabled in Klippain, but Happy Hare, the supported ERCF backend software is not detected. Please install it now from https://github.com/moggieuk/ERCF-Software-V3 !") } {% endif %} - [gcode_macro _INIT_USERCUSTOM] gcode: # ---- CUSTOM Macro section From 96cda006fc8eecc71576a7def79fd376029f8f15 Mon Sep 17 00:00:00 2001 From: Jan-Gerrit Drexhage <102791900+Surion79@users.noreply.github.com> Date: Tue, 1 Aug 2023 11:35:43 +0200 Subject: [PATCH 26/39] added check for exclude_object availability (#269) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Félix Boisselier --- macros/calibration/adaptive_bed_mesh.cfg | 30 ++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/macros/calibration/adaptive_bed_mesh.cfg b/macros/calibration/adaptive_bed_mesh.cfg index 5e3e21ea2..11915d85f 100644 --- a/macros/calibration/adaptive_bed_mesh.cfg +++ b/macros/calibration/adaptive_bed_mesh.cfg @@ -69,22 +69,28 @@ gcode: # 2 ----- GET FIRST LAYER COORDINATES and SIZE ------------------------------------- # If the SIZE parameter is defined and not a dummy placeholder, we use it to do the adaptive bed mesh logic + {% set coordinatesFound = false %} {% if params.SIZE is defined and params.SIZE != "0_0_0_0" %} RESPOND MSG="Got a SIZE parameter for the adaptive bed mesh" {% set xMinSpec, yMinSpec, xMaxSpec, yMaxSpec = params.SIZE.split('_')|map('trim')|map('int') %} + {% set coordinatesFound = true %} + + {% elif printer.exclude_object is defined %} + {% if printer.exclude_object.objects %} + # Else if SIZE is not defined, we fallback to use the [exclude_object] tags + # This method is derived from Kyleisah KAMP repository: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging) + RESPOND MSG="No SIZE parameter, using the [exclude_object] tags for the adaptive bed mesh" + {% set eo_points = printer.exclude_object.objects|map(attribute='polygon')|sum(start=[]) %} + {% set xMinSpec = eo_points|map(attribute=0)|min %} + {% set yMinSpec = eo_points|map(attribute=1)|min %} + {% set xMaxSpec = eo_points|map(attribute=0)|max %} + {% set yMaxSpec = eo_points|map(attribute=1)|max %} + {% set coordinatesFound = true %} + {% endif %} + {% endif %} - {% elif printer.exclude_object.objects %} - # Else if SIZE is not defined, we fallback to use the [exclude_object] tags - # This method is derived from Kyleisah KAMP repository: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging) - RESPOND MSG="No SIZE parameter, using the [exclude_object] tags for the adaptive bed mesh" - {% set eo_points = printer.exclude_object.objects|map(attribute='polygon')|sum(start=[]) %} - {% set xMinSpec = eo_points|map(attribute=0)|min %} - {% set yMinSpec = eo_points|map(attribute=1)|min %} - {% set xMaxSpec = eo_points|map(attribute=0)|max %} - {% set yMaxSpec = eo_points|map(attribute=1)|max %} - - {% else %} - # Else if no SIZE parameter and no [exclude_object] tags, then we want to do a nominal bed mesh + {% if not coordinatesFound %} + # If no SIZE parameter and no [exclude_object] tags, then we want to do a nominal bed mesh # so nothing to do here... RESPOND MSG="No info about the first layer coordinates, doing a nominal bed mesh instead of adaptive" {% endif %} From 5f1c39b2908bbfd579c594515360d2efa9eeb5cb Mon Sep 17 00:00:00 2001 From: Matt Polito Date: Thu, 3 Aug 2023 14:50:49 -0400 Subject: [PATCH 27/39] Add switch sensor config --- config/hardware/filament_sensors/switch_sensor.cfg | 12 ++++++++++++ user_templates/printer.cfg | 1 + 2 files changed, 13 insertions(+) create mode 100644 config/hardware/filament_sensors/switch_sensor.cfg diff --git a/config/hardware/filament_sensors/switch_sensor.cfg b/config/hardware/filament_sensors/switch_sensor.cfg new file mode 100644 index 000000000..73e51d2da --- /dev/null +++ b/config/hardware/filament_sensors/switch_sensor.cfg @@ -0,0 +1,12 @@ +[filament_switch_sensor runout_sensor] +extruder: extruder +# The name of the extruder section this sensor is associated with. +# This parameter must be provided. +switch_pin:RUNOUT_SENSOR +pause_on_runout:False +#runout_gcode: +#insert_gcode: +#event_delay: +#pause_delay: +# See the "filament_switch_sensor" section for a description of the +# above parameters. diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index f0f50a3d8..8f9b69fe6 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -155,6 +155,7 @@ # ------------------------------------------------------------------ FILAMENT SENSORS ----> Select only one line ### -------------------------------------------------------------------------------------- # [include config/hardware/filament_sensors/motion_sensor.cfg] +# [include config/hardware/filament_sensors/switch_sensor.cfg] # ---------------------------------------------------------------------------------------- From 8d1fc056d12f33e13a0b3f676bcddc5579706e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Fri, 4 Aug 2023 09:10:05 +0000 Subject: [PATCH 28/39] generalize the filament sensor enabled variable for both motion and switch sensors --- .../filament_sensors/motion_sensor.cfg | 2 +- .../filament_sensors/switch_sensor.cfg | 13 +++++++------ macros/helpers/filament_swap.cfg | 18 +++++++++--------- macros/helpers/nozzle_cleaning.cfg | 6 +++--- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/config/hardware/filament_sensors/motion_sensor.cfg b/config/hardware/filament_sensors/motion_sensor.cfg index 2e46f05e2..e918be2bb 100644 --- a/config/hardware/filament_sensors/motion_sensor.cfg +++ b/config/hardware/filament_sensors/motion_sensor.cfg @@ -1,5 +1,5 @@ [gcode_macro _USER_VARIABLES] -variable_motion_sensor_enabled: True +variable_filament_sensor_enabled: True gcode: diff --git a/config/hardware/filament_sensors/switch_sensor.cfg b/config/hardware/filament_sensors/switch_sensor.cfg index 73e51d2da..1bc5f2401 100644 --- a/config/hardware/filament_sensors/switch_sensor.cfg +++ b/config/hardware/filament_sensors/switch_sensor.cfg @@ -1,12 +1,13 @@ +[gcode_macro _USER_VARIABLES] +variable_filament_sensor_enabled: True +gcode: + + [filament_switch_sensor runout_sensor] extruder: extruder -# The name of the extruder section this sensor is associated with. -# This parameter must be provided. -switch_pin:RUNOUT_SENSOR -pause_on_runout:False +switch_pin: RUNOUT_SENSOR +pause_on_runout: True #runout_gcode: #insert_gcode: #event_delay: #pause_delay: -# See the "filament_switch_sensor" section for a description of the -# above parameters. diff --git a/macros/helpers/filament_swap.cfg b/macros/helpers/filament_swap.cfg index 83f2878b5..398e2df4b 100644 --- a/macros/helpers/filament_swap.cfg +++ b/macros/helpers/filament_swap.cfg @@ -16,10 +16,10 @@ gcode: {% set DISTANCE = params.DISTANCE|default(105)|float %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} - {% set motion_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].motion_sensor_enabled %} + {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} - {% if motion_sensor_enabled %} + {% if filament_sensor_enabled %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 {% if verbose %} RESPOND MSG="Runout sensor deactivated to unload filament" @@ -48,7 +48,7 @@ gcode: RESTORE_GCODE_STATE NAME=UNLOAD_FILAMENT_state - {% if motion_sensor_enabled %} + {% if filament_sensor_enabled %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% if verbose %} RESPOND MSG="Filament unloaded, runout sensor reactivated" @@ -74,10 +74,10 @@ gcode: {% set DISTANCE = params.DISTANCE|default(105)|float %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} - {% set motion_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].motion_sensor_enabled %} + {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} - {% if motion_sensor_enabled %} + {% if filament_sensor_enabled %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 {% if verbose %} RESPOND MSG="Runout sensor deactivated to load filament" @@ -105,7 +105,7 @@ gcode: G92 E0 RESTORE_GCODE_STATE NAME=LOAD_FILAMENT_state - {% if motion_sensor_enabled %} + {% if filament_sensor_enabled %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% if verbose %} RESPOND MSG="Filament loaded, runout sensor reactivated" @@ -130,10 +130,10 @@ gcode: {% set TEMP = params.TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_extruder_temp)|float %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} - {% set motion_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].motion_sensor_enabled %} + {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} - {% if motion_sensor_enabled %} + {% if filament_sensor_enabled %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 {% if verbose %} RESPOND MSG="Runout sensor deactivated for filament tip shaping" @@ -171,7 +171,7 @@ gcode: SET_PRESSURE_ADVANCE ADVANCE={old_pressure_advance} RESTORE_GCODE_STATE NAME=TIP_SHAPING_state - {% if motion_sensor_enabled %} + {% if filament_sensor_enabled %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% if verbose %} RESPOND MSG="Filament tip shaping done, runout sensor reactivated" diff --git a/macros/helpers/nozzle_cleaning.cfg b/macros/helpers/nozzle_cleaning.cfg index 7df560814..40f6cbbfd 100644 --- a/macros/helpers/nozzle_cleaning.cfg +++ b/macros/helpers/nozzle_cleaning.cfg @@ -76,7 +76,7 @@ gcode: {% set purge_and_brush_enabled = printer["gcode_macro _USER_VARIABLES"].purge_and_brush_enabled %} {% set purgeclean_servo_enabled = printer["gcode_macro _USER_VARIABLES"].purgeclean_servo_enabled %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} - {% set motion_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].motion_sensor_enabled %} + {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% if purge_and_brush_enabled %} @@ -91,7 +91,7 @@ gcode: RESPOND MSG="Purge filament..." {% endif %} - {% if motion_sensor_enabled %} + {% if filament_sensor_enabled %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 {% endif %} @@ -113,7 +113,7 @@ gcode: # Wait some time to let the nozzle ooze before cleaning G4 P{OOZE_TIME * 1000} - {% if motion_sensor_enabled %} + {% if filament_sensor_enabled %} SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 {% endif %} From b692497f15ba881d8287f6837ce5fff668add8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Fri, 4 Aug 2023 09:26:01 +0000 Subject: [PATCH 29/39] Vz HextrudORT support added --- config/hardware/extruder/vz_hextrudort.cfg | 28 ++++++++++++++++++++++ user_templates/printer.cfg | 1 + 2 files changed, 29 insertions(+) create mode 100644 config/hardware/extruder/vz_hextrudort.cfg diff --git a/config/hardware/extruder/vz_hextrudort.cfg b/config/hardware/extruder/vz_hextrudort.cfg new file mode 100644 index 000000000..02daec05e --- /dev/null +++ b/config/hardware/extruder/vz_hextrudort.cfg @@ -0,0 +1,28 @@ +[gcode_macro _USER_VARIABLES] +variable_extruder_enabled: True +gcode: + + +[extruder] +# Vz-HextrudORT Gear Ratio +# new_rd = previous_rd * mesured_distance / requested_distance +rotation_distance: 22 +gear_ratio: 50:10 +microsteps: 32 +full_steps_per_rotation: 200 + +nozzle_diameter: 0.400 +filament_diameter: 1.75 +max_extrude_only_distance: 110 +max_extrude_cross_section: 5 +sensor_type: ATC Semitec 104GT-2 +min_temp: 10 +max_temp: 270 +max_power: 1.0 +min_extrude_temp: 172 +pressure_advance: 0.0475 +pressure_advance_smooth_time: 0.040 + +# We also include the default wiring and low thermal hotend patch +[include default_wiring.cfg] +[include ../../../macros/helpers/hotend_heater_ctrl.cfg] diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index 8f9b69fe6..f73c64e7a 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -68,6 +68,7 @@ # [include config/hardware/extruder/lgx_heavy.cfg] # [include config/hardware/extruder/lgx_lite.cfg] # [include config/hardware/extruder/orbiter2.0.cfg] +# [include config/hardware/extruder/vz_hextrudort.cfg] # ---------------------------------------------------------------------------------------- From 869809e4a7f76408fb1c78eafb5643e0afb3b2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Fri, 4 Aug 2023 09:59:10 +0000 Subject: [PATCH 30/39] updated mainpage to remove the CoreXY restriction --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f22176671..bde7fae88 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ > Klippain - The pain-free recipe for (french)bread and butter Klipper configuration! -Klippain is a generic, modular, and highly customizable Klipper configuration for CoreXY 3D printers. Designed for use on various machines, it has been reported working correctly on Voron V2.4, Voron Trident, Voron V0, TriZero, VZbot, Ender5, etc... I even use it myself on an heavily modified Prusa i3 MK3s. +Klippain is a generic, modular, and highly customizable Klipper configuration for 3D printers. Designed for use on various machines such as Cartesian, CoreXY and CoreXZ, it has been reported working correctly on Voron V2.4, Voron Trident, Voron V0, Voron SwitchWire, TriZero, VZbot, Ender5, Ender3, Prusas, etc... ![Klippain](./docs/klippain.png) -The configuration is regularly updated with new features and merged PRs from users. You can reach me on the Voron Discord as **Frix_x#0161**. +Klippain is regularly updated with new features and merged PRs from users. You can reach me on the Voron Discord as **Frix_x#0161**. Fun fact: "pain" \pɛ̃\ is the French word for bread, so there's no pain in this pain—only joy! Thanks to the French channel "honhonhonbaguette-FR" on the Voron Discord for the joke and name suggestion! From 2514b894b7f881bc60c6d5c3d777ac37cab57811 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Fri, 4 Aug 2023 11:35:15 +0000 Subject: [PATCH 31/39] added another warning before Klippain install --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index ed78abcf8..dc9e22b29 100755 --- a/install.sh +++ b/install.sh @@ -49,6 +49,7 @@ function preflight_checks { if [ ! -f "${USER_CONFIG_PATH}/.VERSION" ]; then echo "[PRE-CHECK] New installation of Klippain detected!" echo "[PRE-CHECK] This install script will WIPE AND REPLACE your current Klipper config with the full Klippain system (a backup will be kept)" + echo "[PRE-CHECK] Be sure that the printer is idle before continuing!" read < /dev/tty -rp "[PRE-CHECK] Are you sure want to proceed and install Klippain? (y/N) " install_klippain_answer if [[ -z "$install_klippain_answer" ]]; then From 84aba96cce4aba8f3c53fd676fd36787b3944674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Mon, 7 Aug 2023 14:14:23 +0000 Subject: [PATCH 32/39] fixed Orbiter2.0 config --- config/hardware/extruder/orbiter2.0.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/config/hardware/extruder/orbiter2.0.cfg b/config/hardware/extruder/orbiter2.0.cfg index 5bb47aaed..98ab31ff1 100644 --- a/config/hardware/extruder/orbiter2.0.cfg +++ b/config/hardware/extruder/orbiter2.0.cfg @@ -7,7 +7,6 @@ gcode: # Orbiter 2.0 Gear Ratio # new_rd = previous_rd * mesured_distance / requested_distance rotation_distance: 4.637 -gear_ratio: 7.5:1 microsteps: 32 full_steps_per_rotation: 200 From f6a8f688851cb3df86720b27f58d495c261389b7 Mon Sep 17 00:00:00 2001 From: Nick Danyluk Date: Sun, 6 Aug 2023 02:08:47 -0700 Subject: [PATCH 33/39] Support for sensorless homing on corexz/cartesian --- macros/base/homing/homing_override.cfg | 168 +++++++++++++++++++------ 1 file changed, 128 insertions(+), 40 deletions(-) diff --git a/macros/base/homing/homing_override.cfg b/macros/base/homing/homing_override.cfg index 142cfa3ec..4b8c76fa2 100644 --- a/macros/base/homing/homing_override.cfg +++ b/macros/base/homing/homing_override.cfg @@ -3,6 +3,7 @@ axes: xyz gcode: {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} + {% set kinematics = printer["configfile"].config["printer"]["kinematics"] %} {% set probe_type_enabled = printer["gcode_macro _USER_VARIABLES"].probe_type_enabled %} {% set homing_zhop = printer["gcode_macro _USER_VARIABLES"].homing_zhop|float %} {% set homing_travel_speed = printer["gcode_macro _USER_VARIABLES"].homing_travel_speed * 60 %} @@ -11,6 +12,7 @@ gcode: {% set sensorless_current_factor = printer["gcode_macro _USER_VARIABLES"].sensorless_current_factor / 100 %} {% set x_driver = printer["gcode_macro _USER_VARIABLES"].x_driver %} {% set y_driver = printer["gcode_macro _USER_VARIABLES"].y_driver %} + {% set z_driver = printer["gcode_macro _USER_VARIABLES"].z_driver %} {% set z_drop_speed = printer["gcode_macro _USER_VARIABLES"].z_drop_speed * 60 %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} @@ -98,6 +100,10 @@ gcode: {% endif %} SET_KINEMATIC_POSITION X=0 Y=0 Z=0 G0 Z{homing_zhop} F{z_drop_speed} + {% if sensorless_homing_enabled and kinematics == "corexz" %} + # Wait for 2s for stallguard registers to clear + G4 P2000 + {% endif %} {% set X, Y, Z = True, True, True %} {% endif %} {% endif %} @@ -108,20 +114,43 @@ gcode: { action_respond_info("Homing X") } {% endif %} {% if sensorless_homing_enabled %} - {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} - {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} - {% set new_current_x = sensorless_current_factor * old_current_x %} - {% set new_current_y = sensorless_current_factor * old_current_y %} - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} - M400 + {% if kinematics == "corexy" %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} + {% set new_current_x = sensorless_current_factor * old_current_x %} + {% set new_current_y = sensorless_current_factor * old_current_y %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 + {% elif kinematics == "corexz" %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_z = printer.configfile.config[z_driver ~ ' stepper_z'].run_current|float %} + {% set new_current_x = sensorless_current_factor * old_current_x %} + {% set new_current_z = sensorless_current_factor * old_current_z %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} + SET_TMC_CURRENT STEPPER=stepper_z CURRENT={new_current_z} + M400 + {% elif kinematics == "cartesian" %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set new_current_x = sensorless_current_factor * old_current_x %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} + M400 + {% endif %} {% endif %} G28 X0 G1 X{x_position_endstop + x_homing_backoff} F{homing_travel_speed} {% if sensorless_homing_enabled %} - G4 P1000 - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% if kinematics == "corexy" %} + G4 P2000 + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% elif kinematics == "corexz" %} + G4 P2000 + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} + SET_TMC_CURRENT STEPPER=stepper_z CURRENT={old_current_z} + {% elif kinematics == "cartesian" %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} + {% endif %} {% endif %} {% endif %} {% if Y %} # Home y @@ -129,20 +158,38 @@ gcode: { action_respond_info("Homing Y") } {% endif %} {% if sensorless_homing_enabled %} - {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} - {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} - {% set new_current_x = sensorless_current_factor * old_current_x %} - {% set new_current_y = sensorless_current_factor * old_current_y %} - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} - M400 + {% if kinematics == "corexy" %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} + {% set new_current_x = sensorless_current_factor * old_current_x %} + {% set new_current_y = sensorless_current_factor * old_current_y %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 + {% elif kinematics == "corexz" %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} + {% set new_current_y = sensorless_current_factor * old_current_y %} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 + {% elif kinematics == "cartesian" %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} + {% set new_current_y = sensorless_current_factor * old_current_y %} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 + {% endif %} {% endif %} G28 Y0 G1 Y{y_position_endstop + y_homing_backoff} F{homing_travel_speed} {% if sensorless_homing_enabled %} - G4 P1000 - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% if kinematics == "corexy" %} + G4 P2000 + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% elif kinematics == "corexz" %} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% elif kinematics == "cartesian" %} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% endif %} {% endif %} {% endif %} @@ -152,20 +199,38 @@ gcode: { action_respond_info("Homing Y") } {% endif %} {% if sensorless_homing_enabled %} - {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} - {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} - {% set new_current_x = sensorless_current_factor * old_current_x %} - {% set new_current_y = sensorless_current_factor * old_current_y %} - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} - M400 + {% if kinematics == "corexy" %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} + {% set new_current_x = sensorless_current_factor * old_current_x %} + {% set new_current_y = sensorless_current_factor * old_current_y %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 + {% elif kinematics == "corexz" %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} + {% set new_current_y = sensorless_current_factor * old_current_y %} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 + {% elif kinematics == "cartesian" %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} + {% set new_current_y = sensorless_current_factor * old_current_y %} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 + {% endif %} {% endif %} G28 Y0 G1 Y{y_position_endstop + y_homing_backoff} F{homing_travel_speed} {% if sensorless_homing_enabled %} - G4 P1000 - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% if kinematics == "corexy" %} + G4 P2000 + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% elif kinematics == "corexz" %} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% elif kinematics == "cartesian" %} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% endif %} {% endif %} {% endif %} {% if X %} # Home x @@ -173,20 +238,43 @@ gcode: { action_respond_info("Homing X") } {% endif %} {% if sensorless_homing_enabled %} - {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} - {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} - {% set new_current_x = sensorless_current_factor * old_current_x %} - {% set new_current_y = sensorless_current_factor * old_current_y %} - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} - M400 + {% if kinematics == "corexy" %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_y = printer.configfile.config[y_driver ~ ' stepper_y'].run_current|float %} + {% set new_current_x = sensorless_current_factor * old_current_x %} + {% set new_current_y = sensorless_current_factor * old_current_y %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={new_current_y} + M400 + {% elif kinematics == "corexz" %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set old_current_z = printer.configfile.config[z_driver ~ ' stepper_z'].run_current|float %} + {% set new_current_x = sensorless_current_factor * old_current_x %} + {% set new_current_z = sensorless_current_factor * old_current_z %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} + SET_TMC_CURRENT STEPPER=stepper_z CURRENT={new_current_z} + M400 + {% elif kinematics == "cartesian" %} + {% set old_current_x = printer.configfile.config[x_driver ~ ' stepper_x'].run_current|float %} + {% set new_current_x = sensorless_current_factor * old_current_x %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={new_current_x} + M400 + {% endif %} {% endif %} G28 X0 G1 X{x_position_endstop + x_homing_backoff} F{homing_travel_speed} {% if sensorless_homing_enabled %} - G4 P1000 - SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} - SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% if kinematics == "corexy" %} + G4 P2000 + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={old_current_y} + {% elif kinematics == "corexz" %} + G4 P2000 + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} + SET_TMC_CURRENT STEPPER=stepper_z CURRENT={old_current_z} + {% elif kinematics == "cartesian" %} + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={old_current_x} + {% endif %} {% endif %} {% endif %} From ac7eba11541fd5fbe0b12116bd93562a977dfe14 Mon Sep 17 00:00:00 2001 From: Nick Danyluk Date: Tue, 8 Aug 2023 12:51:31 -0700 Subject: [PATCH 34/39] Added Bed Mesh Config for MK52 bed --- config/software/bed_mesh/bed_mesh_120mm.cfg | 2 +- config/software/bed_mesh/bed_mesh_250mm.cfg | 2 +- config/software/bed_mesh/bed_mesh_300mm.cfg | 2 +- config/software/bed_mesh/bed_mesh_350mm.cfg | 2 +- config/software/bed_mesh/bed_mesh_mk52.cfg | 20 ++++++++++++++++++++ user_templates/overrides.cfg | 11 +++++++++++ user_templates/printer.cfg | 1 + 7 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 config/software/bed_mesh/bed_mesh_mk52.cfg diff --git a/config/software/bed_mesh/bed_mesh_120mm.cfg b/config/software/bed_mesh/bed_mesh_120mm.cfg index 834ac4293..a49908760 100644 --- a/config/software/bed_mesh/bed_mesh_120mm.cfg +++ b/config/software/bed_mesh/bed_mesh_120mm.cfg @@ -12,7 +12,7 @@ gcode: [bed_mesh] speed: 350 -horizontal_move_z: 12 +horizontal_move_z: 20 mesh_min: 7, 21.75 mesh_max: 105, 113 probe_count: 5, 5 diff --git a/config/software/bed_mesh/bed_mesh_250mm.cfg b/config/software/bed_mesh/bed_mesh_250mm.cfg index 613a9da5b..15a68ad24 100644 --- a/config/software/bed_mesh/bed_mesh_250mm.cfg +++ b/config/software/bed_mesh/bed_mesh_250mm.cfg @@ -12,7 +12,7 @@ gcode: [bed_mesh] speed: 350 -horizontal_move_z: 12 +horizontal_move_z: 20 mesh_min: 25, 25 mesh_max: 225, 225 probe_count: 7, 7 diff --git a/config/software/bed_mesh/bed_mesh_300mm.cfg b/config/software/bed_mesh/bed_mesh_300mm.cfg index 956ee4b85..d2b8e062e 100644 --- a/config/software/bed_mesh/bed_mesh_300mm.cfg +++ b/config/software/bed_mesh/bed_mesh_300mm.cfg @@ -12,7 +12,7 @@ gcode: [bed_mesh] speed: 350 -horizontal_move_z: 12 +horizontal_move_z: 20 mesh_min: 25, 25 mesh_max: 275, 275 probe_count: 9, 9 diff --git a/config/software/bed_mesh/bed_mesh_350mm.cfg b/config/software/bed_mesh/bed_mesh_350mm.cfg index 6328567a9..ae6728ec6 100644 --- a/config/software/bed_mesh/bed_mesh_350mm.cfg +++ b/config/software/bed_mesh/bed_mesh_350mm.cfg @@ -12,7 +12,7 @@ gcode: [bed_mesh] speed: 350 -horizontal_move_z: 12 +horizontal_move_z: 20 mesh_min: 25, 25 mesh_max: 325, 325 probe_count: 9, 9 diff --git a/config/software/bed_mesh/bed_mesh_mk52.cfg b/config/software/bed_mesh/bed_mesh_mk52.cfg new file mode 100644 index 000000000..3c7d4ce2f --- /dev/null +++ b/config/software/bed_mesh/bed_mesh_mk52.cfg @@ -0,0 +1,20 @@ +# If this files is included, then it also activate the bed_mesh +# automatically in the START_PRINT macro +[gcode_macro _USER_VARIABLES] +variable_bed_mesh_enabled: True +gcode: + +# Also include directly the dockable probe overide of BED_MESH_CALIBRATE from here +[include ../../../macros/base/probing/overides/bed_mesh_calibrate.cfg] +# And also include the adaptive mesh macro at the same time +[include ../../../macros/calibration/adaptive_bed_mesh.cfg] + +[bed_mesh] +speed: 350 +horizontal_move_z: 20 +mesh_min: 25, 35 +mesh_max: 225, 215 +probe_count: 7, 7 +fade_start: 0.6 +fade_end: 10.0 +algorithm: bicubic diff --git a/user_templates/overrides.cfg b/user_templates/overrides.cfg index 1e0f10a82..2b540fffe 100644 --- a/user_templates/overrides.cfg +++ b/user_templates/overrides.cfg @@ -64,3 +64,14 @@ # [stepper_z3] # dir_pin: !Z3_DIR + +#-------------------------# +# Probe Offsets # +#-------------------------# + +## Here is an example of some overrides for bed probes. These frequently have calibrated offsets for xyz, +## and many will need them during setup. If you need to set these, just uncomment the following lines. +# [probe] +# x_offset: -1.85 +# y_offset: 29.3 +# z_offset: 12.6 \ No newline at end of file diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index f73c64e7a..a69b4a94b 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -204,6 +204,7 @@ # [include config/software/bed_mesh/bed_mesh_250mm.cfg] # [include config/software/bed_mesh/bed_mesh_300mm.cfg] # [include config/software/bed_mesh/bed_mesh_350mm.cfg] +# [include config/software/bed_mesh/bed_mesh_mk52.cfg] ### If you need to specify a bed mesh configuration for a custom sized printer, use your ### overrides.cfg file instead. These defaults are only made for common machines sizes From 5f9f38a7e2adc3f6df0c20d885ee30ee462da4dc Mon Sep 17 00:00:00 2001 From: Fragmon <50713890+Fragmon@users.noreply.github.com> Date: Thu, 10 Aug 2023 15:20:48 +0200 Subject: [PATCH 35/39] Safer clean_nozzle macro (#279) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Félix Boisselier --- macros/helpers/nozzle_cleaning.cfg | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/macros/helpers/nozzle_cleaning.cfg b/macros/helpers/nozzle_cleaning.cfg index 40f6cbbfd..3f7fb2061 100644 --- a/macros/helpers/nozzle_cleaning.cfg +++ b/macros/helpers/nozzle_cleaning.cfg @@ -32,8 +32,8 @@ gcode: G90 _CONDITIONAL_MOVE_TO_PURGE_BUCKET Z_DROP=1 # Move to center of the brush - G1 X{Bx} Y{By} Z{Bz} F{St} - + G1 X{Bx} Y{By} F{St} + G1 Z{Bz} F{St} # Wipe procedure G91 {% if brush_over_y_axis %} @@ -148,7 +148,8 @@ gcode: G1 Z{Pz} F{Sz} # Secure the Z before deploying the servo _SERVO_DEPLOY ITEM="purge" {% endif %} - G1 X{Px} Y{Py} Z{Pz} F{St} + G1 X{Px} Y{Py} F{St} + G1 Z{Pz} F{St} {% else %} # If Z_DROP=0 there is probably some parts on the bed: we do not move the # Z axis and purge from an higher position. Also it's risky to use the From c510dfd63d010254ae352cc774c6e633d72cf797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Fri, 11 Aug 2023 08:40:51 +0000 Subject: [PATCH 36/39] deactivated filament sensor during prime line --- macros/helpers/prime_line.cfg | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/macros/helpers/prime_line.cfg b/macros/helpers/prime_line.cfg index 032654927..9815179da 100644 --- a/macros/helpers/prime_line.cfg +++ b/macros/helpers/prime_line.cfg @@ -14,6 +14,7 @@ gcode: {% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %} {% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %} + {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} {% set max_extrude_cross_section = printer["configfile"].config["extruder"]["max_extrude_cross_section"]|float %} {% set filament_diameter = printer["configfile"].config["extruder"]["filament_diameter"]|float %} @@ -64,6 +65,10 @@ gcode: {% endif %} {% endif %} + {% if filament_sensor_enabled %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=0 + {% endif %} + G91 M83 G1 Z5 F{Sz} @@ -104,3 +109,7 @@ gcode: {% endif %} {% endif %} {% endif %} + + {% if filament_sensor_enabled %} + SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1 + {% endif %} From 6cc5d8748dd718c0f07556fedf015ffba27bc3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Fri, 11 Aug 2023 09:53:59 +0000 Subject: [PATCH 37/39] going over the purge bucket when doing M600 --- macros/helpers/filament_swap.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/helpers/filament_swap.cfg b/macros/helpers/filament_swap.cfg index 398e2df4b..10a981c0e 100644 --- a/macros/helpers/filament_swap.cfg +++ b/macros/helpers/filament_swap.cfg @@ -5,6 +5,7 @@ gcode: SAVE_GCODE_STATE NAME=CHANGE_FILAMENT_state PAUSE + _CONDITIONAL_MOVE_TO_PURGE_BUCKET Z_DROP=0 UNLOAD_FILAMENT RESTORE_GCODE_STATE NAME=CHANGE_FILAMENT_state From c02862d2504d4226f7f8c82508edb3b394e5062a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Fri, 11 Aug 2023 11:54:35 +0000 Subject: [PATCH 38/39] added issue templates for bugs and feature requests --- .github/ISSUE_TEMPLATE/bug_report.yml | 44 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 5 +++ .github/ISSUE_TEMPLATE/feature_request.yml | 29 ++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..f61b7a073 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,44 @@ +name: "\U0001F41B Bug report" +description: Report a bug or problem with Klippain. +labels: ["bug", "triage"] + +body: +- type: markdown + attributes: + value: | + This issue form is for reporting bugs only! + If you have a feature request, please use [feature_request](/new?template=feature_request.yml) instead. +- type: checkboxes + id: klippain-branch + attributes: + label: Klippain branch + description: By submitting this issue, you confirm using a "public" release of Klippain from the main branch. We do not provide support for the dev version from other branches as they are known to be unstable. + options: + - label: I confirm using the main branch + required: true +- type: input + id: klippain-version + attributes: + label: Version + description: Specify the version of Klippain used on your printer. You can find this in the update section of Mainsail/Fluidd. + placeholder: ex. v4.0.1-44-g84aba96 + validations: + required: true +- type: textarea + id: what-happened + attributes: + label: Describe the bug and expected behavior + description: >- + Provide a clear and concise description of the bug and why it's problematic. + If applicable, suggest a desired solution. + validations: + required: true +- type: textarea + id: additional-info + attributes: + label: Additional information and klippy.log + description: | + If possible, attach a klippy.log to help us diagnose your issue! + You can also provide any additional helpful details. + + Please note, you can attach files or screenshots by dragging and dropping them directly in the field. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..8604104f7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Public \#Klippain thread in the Voron Discord + url: https://discord.com/channels/460117602945990666/1096701708643614820 + about: Quickest way to get in contact if you just want to have a chat diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..68eac1c77 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,29 @@ +name: "\U0001F680 Feature request" +description: Suggest a new feature or hardware support for Klippain. +labels: ["enhancement", "triage"] + +body: +- type: markdown + attributes: + value: | + This issue form is for suggesting features or hardware support only! + If you're facing a bug, please use the [bug_report](/new?template=bug_report.yml) instead. +- type: textarea + id: feature-description + attributes: + label: Describe the feature or hardware support you'd like + description: >- + Provide a clear and detailed description of the feature, mod, macro, or hardware you'd like to see in Klippain. + Also do not hesistate to explain how your suggestion can enhance Klippain and benefit its users. + placeholder: E.g., "I'd love to see support for this XXX new MCU model..." + validations: + required: true +- type: textarea + id: additional-context + attributes: + label: Additional context or information + description: | + If you have any more information, references, or context about your suggestion, please provide it here. + This can include use-cases, diagrams, documentation, links or any other helpful details. + + Please note, you can attach files or screenshots by dragging and dropping them directly in the field. From 397a75c1386f91d92b5b439d38830bdca1aede19 Mon Sep 17 00:00:00 2001 From: Nick Danyluk Date: Tue, 8 Aug 2023 23:24:40 -0700 Subject: [PATCH 39/39] Add SKR Mini E3 V3 SPI and IO pins --- config/mcu_definitions/main/BTT_SKR_Mini_E3_v3.cfg | 12 +++++++++--- docs/pinout.md | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/config/mcu_definitions/main/BTT_SKR_Mini_E3_v3.cfg b/config/mcu_definitions/main/BTT_SKR_Mini_E3_v3.cfg index edaf0dde8..c9be84c1f 100644 --- a/config/mcu_definitions/main/BTT_SKR_Mini_E3_v3.cfg +++ b/config/mcu_definitions/main/BTT_SKR_Mini_E3_v3.cfg @@ -17,10 +17,10 @@ aliases: MCU_FAN0=PC6 , MCU_FAN1=PC7 , MCU_FAN2=PB15 , - MCU_SERVOS=PA1 , - - MCU_PROBE=PC14 , + # Z-Probe Header + MCU_SERVOS=PA1 , MCU_PROBE=PC14 , + # Neopixel1 Header MCU_NEOPIXEL=PA8 , # EXP1 header @@ -29,3 +29,9 @@ aliases: EXP1_5=PB9 , EXP1_6=PA10 , # Key in the socket on this side EXP1_7= , EXP1_8=PA9 , EXP1_9=PA15 , EXP1_10=PB5 , + + # SPI1 header + MCU_SPI1_MOSI=PA7 , MCU_SPI1_MISO=PA6 , MCU_SPI1_SCK=PA5 , MCU_SPI1_CS=PD9 , + + # I/O header + MCU_IO0=PD0 , MCU_IO1=PD2 , MCU_IO2=PD3 , MCU_IO3=PD4 , MCU_IO4=PD5 diff --git a/docs/pinout.md b/docs/pinout.md index 9f33381d9..8e0101db8 100644 --- a/docs/pinout.md +++ b/docs/pinout.md @@ -77,3 +77,4 @@ For more information on the boards and pinouts, please see directly the manufact - [BTT Manta 8P](https://github.com/bigtreetech/Manta-M8P) - [Fly SHT](https://mellow.klipper.cn/#/board/fly_sht36_42/) - [BTT EBB](https://github.com/bigtreetech/EBB) + - [BTT SKR Mini E3](https://github.com/bigtreetech/BIGTREETECH-SKR-mini-E3) \ No newline at end of file