diff --git a/config/hardware/accelerometers/beacon_accelerometer.cfg b/config/hardware/accelerometers/beacon_accelerometer.cfg
new file mode 100644
index 000000000..bab7c50b8
--- /dev/null
+++ b/config/hardware/accelerometers/beacon_accelerometer.cfg
@@ -0,0 +1,13 @@
+# Only for Beacon REV H model, REV D does not have a build in accelerometer
+# You need to include beacon_virtual.cfg and set the correct serial in your overrides for this to work
+# Accelerometer pins etc are all handeled internally by the Beacon Klipper plugin.
+[resonance_tester]
+accel_chip: beacon
+probe_points:
+ -1,-1,-1
+
+
+# Include the IS calibration macros to unlock them when
+# an accelerometer is installed on the machine
+[include ../../../macros/helpers/resonance_override.cfg]
+[include ../../../scripts/K-ShakeTune/K-SnT_*.cfg]
diff --git a/config/hardware/displays/BTT_mini12864.cfg b/config/hardware/displays/BTT_mini12864.cfg
index 17be931f3..c8c2a2e14 100644
--- a/config/hardware/displays/BTT_mini12864.cfg
+++ b/config/hardware/displays/BTT_mini12864.cfg
@@ -27,8 +27,12 @@ spi_software_miso_pin: EXP2_1
spi_software_mosi_pin: EXP2_6
spi_software_sclk_pin: EXP2_2
-[output_pin beeper]
+[pwm_cycle_time beeper]
pin: EXP1_1
+value: 0
+shutdown_value: 0
+cycle_time: 0.0005
+scale: 1
[neopixel btt_mini12864]
# To control Neopixel RGB in mini12864 display
diff --git a/config/hardware/displays/BTT_mini12864_inversed.cfg b/config/hardware/displays/BTT_mini12864_inversed.cfg
index e85610c48..a4968a4e1 100644
--- a/config/hardware/displays/BTT_mini12864_inversed.cfg
+++ b/config/hardware/displays/BTT_mini12864_inversed.cfg
@@ -27,8 +27,12 @@ spi_software_miso_pin: EXP2_10
spi_software_mosi_pin: EXP2_5
spi_software_sclk_pin: EXP2_9
-[output_pin beeper]
+[pwm_cycle_time beeper]
pin: EXP1_10
+value: 0
+shutdown_value: 0
+cycle_time: 0.0005
+scale: 1
[neopixel btt_mini12864]
# To control Neopixel RGB in mini12864 display
diff --git a/config/hardware/displays/Fysetc_mini12864.cfg b/config/hardware/displays/Fysetc_mini12864.cfg
index fa295ecef..e6bc650d0 100644
--- a/config/hardware/displays/Fysetc_mini12864.cfg
+++ b/config/hardware/displays/Fysetc_mini12864.cfg
@@ -27,8 +27,12 @@ spi_software_miso_pin: EXP2_10
spi_software_mosi_pin: EXP2_5
spi_software_sclk_pin: EXP2_9
-[output_pin beeper]
+[pwm_cycle_time beeper]
pin: EXP1_10
+value: 0
+shutdown_value: 0
+cycle_time: 0.0005
+scale: 1
[neopixel fysetc_mini12864]
# To control Neopixel RGB in mini12864 display
diff --git a/config/hardware/displays/Fysetc_mini12864_inversed.cfg b/config/hardware/displays/Fysetc_mini12864_inversed.cfg
index 9aaafe815..e434a056e 100644
--- a/config/hardware/displays/Fysetc_mini12864_inversed.cfg
+++ b/config/hardware/displays/Fysetc_mini12864_inversed.cfg
@@ -27,8 +27,12 @@ spi_software_miso_pin: EXP2_1
spi_software_mosi_pin: EXP2_6
spi_software_sclk_pin: EXP2_2
-[output_pin beeper]
+[pwm_cycle_time beeper]
pin: EXP1_1
+value: 0
+shutdown_value: 0
+cycle_time: 0.0005
+scale: 1
[neopixel fysetc_mini12864]
# To control Neopixel RGB in mini12864 display
diff --git a/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg b/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg
index 98e25169f..5e7ff136e 100644
--- a/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg
+++ b/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg
@@ -24,8 +24,12 @@ spi_software_miso_pin: EXP2_10
spi_software_mosi_pin: EXP2_5
spi_software_sclk_pin: EXP2_9
-[output_pin beeper]
+[pwm_cycle_time beeper]
pin: EXP1_10
+value: 0
+shutdown_value: 0
+cycle_time: 0.0005
+scale: 1
[led fysetc_mini12864]
red_pin: EXP1_5
diff --git a/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0_inversed.cfg b/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0_inversed.cfg
index bc2fe543d..0e4dfa044 100644
--- a/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0_inversed.cfg
+++ b/config/hardware/displays/Fysetc_mini12864_v1.2_v2.0_inversed.cfg
@@ -24,8 +24,12 @@ spi_software_miso_pin: EXP2_1
spi_software_mosi_pin: EXP2_6
spi_software_sclk_pin: EXP2_2
-[output_pin beeper]
+[pwm_cycle_time beeper]
pin: EXP1_1
+value: 0
+shutdown_value: 0
+cycle_time: 0.0005
+scale: 1
[led fysetc_mini12864]
red_pin: EXP1_6
diff --git a/config/mcu_definitions/toolhead/LDO_Picobilical_vA1.3.cfg b/config/mcu_definitions/toolhead/LDO_Picobilical_vA1.3.cfg
new file mode 100644
index 000000000..d439157cb
--- /dev/null
+++ b/config/mcu_definitions/toolhead/LDO_Picobilical_vA1.3.cfg
@@ -0,0 +1,21 @@
+# Board pins configuration for the LDO Motors Picobilical Frame PCB vA1.3
+# This is the board that ships with the LDO V0.2-S1 and V0.1-S1 kits
+# to use pair with an umbilical and toolhead PCB (which is a pass-through)
+
+[board_pins toolhead_manufacturer]
+mcu: toolhead
+aliases:
+ MCU_XES=gpio0 ,
+
+ MCU_HE0=gpio4 ,
+
+ MCU_TH0=gpio29 ,
+ MCU_CT=gpio28 ,
+
+ MCU_PCF=gpio2 , MCU_HEF=gpio3 ,
+
+ MCU_BEEPER=gpio5 ,
+
+ MCU_NEOPIXEL_1=gpio1 , MCU_NEOPIXEL_2=gpio7 ,
+
+ MCU_FS=gpio6 , MCU_SU=gpio18 ,
\ No newline at end of file
diff --git a/docs/mmu.md b/docs/mmu.md
index 0e412cfde..a666075b7 100644
--- a/docs/mmu.md
+++ b/docs/mmu.md
@@ -31,13 +31,45 @@ Finally, enable Klippain's MMU feature by uncommenting the corresponding line in
HappyHare is a software with a lot of features and you should first have a look at how it works and its concepts [here](https://github.com/moggieuk/Happy-Hare?tab=readme-ov-file#---readme-table-of-contents) and its documentation section [here](https://github.com/moggieuk/Happy-Hare/tree/main/doc). On top of this, Klippain define a couple of things a bit differently to allow more flexibility and a better integration with it.
+### Happy_Hare v2.5 and higher
+
+HappyHare v2.5 and higher can natively manage all the initialisation and finalization of the MMU. Here are some recommendations for a good experience with klippain:
+
+#### Changes recommended in Happy_Hare configuration variables
+ 1. You can set `variable_user_pre_initialize_extension` like this:
+```yml
+# in [gcode_macro _MMU_SOFTWARE_VARS]
+variable_user_pre_initialize_extension: "_CG28" ; Executed at start of _MMU_INITIALIZE. Commonly G28 to home
+```
+ 2. Check the `variable_park_z_hop` you want to use with MMU macros:
+```yml
+# in [gcode_macro _MMU_SEQUENCE_VARS]
+variable_park_z_hop : 1.0 ; Additional Z_hop (mm) when toolchanging (works in and out of print)
+```
+ 3. Some MMU variables are overridden by klippain on startup to use the more global ones defined in klippain. So be aware that the following variables will have no effect if you have those defined in Klippain `variables.cfg`.
+```yml
+# in [gcode_macro _MMU_SEQUENCE_VARS]
+variable_park_xy : 50, 50 ; Coordinates of park position for toolchange
+variable_travel_speed : 200 ; XY travel speed in mm/s
+variable_lift_speed : 15 ; Z travel speed in mm/s
+```
+
+#### Custom start print gcode in your slicer
+Add the `MMU_START_SETUP` and `MMU_START_CHECK` as below, before your original `START_PRINT` call:
+```
+MMU_START_SETUP INITIAL_TOOL={initial_tool} REFERENCED_TOOLS=!referenced_tools! TOOL_COLORS=!colors! TOOL_TEMPS=!temperatures! TOOL_MATERIALS=!materials! PURGE_VOLUMES=!purge_volumes!
+MMU_START_CHECK
+# And followed by your standard START_PRINT call
+START_PRINT EXTRUDER_TEMP={first_layer_temperature[initial_extruder] + extruder_temperature_offset[initial_extruder]} BED_TEMP=[first_layer_bed_temperature] MATERIAL=[filament_type] SIZE={first_layer_print_min[0]}_{first_layer_print_min[1]}_{first_layer_print_max[0]}_{first_layer_print_max[1]}
+```
+
### Check gates on START_PRINT
If you want to check the gates at the start of a print to avoid an error when using a gate that was previously marked as empty, it is recommended to set `variable_mmu_check_gates_on_start_print: True` in your Klippain `variables.cfg`.
> **Note**:
>
- > Be sure to also include `TOOLS_USED=!referenced_tools!` in your slicer custom start print gcode in order to allow the [HappyHare Moonraker gcode preprocessor](https://github.com/moggieuk/Happy-Hare/blob/main/doc/gcode_preprocessing.md) to work correctly and and to ensure that all tools are checked.
+ > Be sure to also include `TOOLS_USED=!referenced_tools!` in your slicer custom start print gcode in order to allow the [HappyHare Moonraker gcode preprocessor](https://github.com/moggieuk/Happy-Hare/blob/main/doc/gcode_preprocessing.md) to work correctly and to ensure that all tools are checked.
### Early check errors during START_PRINT
@@ -86,9 +118,7 @@ You can also use the `MMU_GATE_MAP GATE=n SPOOLID=id` macro at runtime to change
### Variable check error
-```
-MMU support is enabled in Klippain, but some variables are missing from your variables.cfg. Please update your template or refer to the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md
-```
+ > MMU support is enabled in Klippain, but some variables are missing from your variables.cfg. Please update your template or refer to the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md
If you have the previous message in the console when Klippain is starting, you will want to update your Klippain `variables.cfg` template file or check that the MMU variables are set correctly in it:
- `variable_mmu_force_homing_in_start_print`: True or False
diff --git a/macros/base/cancel_print.cfg b/macros/base/cancel_print.cfg
index 82c3a8ade..0704c5e4b 100644
--- a/macros/base/cancel_print.cfg
+++ b/macros/base/cancel_print.cfg
@@ -17,10 +17,16 @@ gcode:
PARK
- {% if klippain_mmu_enabled and mmu_unload_on_cancel_print %}
- {% if printer.mmu.enabled and printer.mmu.tool|int != -2 %}
+ {% if klippain_mmu_enabled %}
+ {% if printer.mmu.enabled and printer.configfile.settings.mmu.happy_hare_version >= 2.5 %}
+ _MMU_CLEAR_POSITION
+ {% elif printer.mmu.enabled and mmu_unload_on_cancel_print and printer.mmu.tool|int != -2 %}
# Unload filament and park the MMU
MMU_EJECT
+ {% elif printer.extruder.can_extrude %}
+ # Pull back the filament a little bit
+ G92 E0
+ G1 E-10 F2100
{% endif %}
{% elif printer.extruder.can_extrude %}
# Pull back the filament a little bit
@@ -67,7 +73,11 @@ gcode:
{% endif %}
{% if klippain_mmu_enabled %}
- {% if printer.mmu.enabled and printer.mmu.print_start_detection|int == 0 %}
+ {% if printer.mmu.enabled and printer.configfile.settings.mmu.happy_hare_version >= 2.5 %} # reset mmu vars
+ {% set vars = printer['gcode_macro _MMU_CLIENT_VARS'] %}
+ {vars.user_cancel_extension|default("")}
+ _MMU_RUN_MARKERS
+ {% elif printer.mmu.enabled and printer.mmu.print_start_detection|int == 0 %}
_MMU_PRINT_END STATE=cancelled
{% endif %}
{% endif %}
@@ -76,5 +86,7 @@ gcode:
{% if filament_sensor_enabled %}
SET_FILAMENT_SENSOR SENSOR="runout_sensor" ENABLE=1
{% endif %}
-
+
BASE_CANCEL_PRINT
+
+ RESPOND MSG="Print cancelled!"
diff --git a/macros/base/end_print.cfg b/macros/base/end_print.cfg
index 5228ba43a..148d8fe85 100644
--- a/macros/base/end_print.cfg
+++ b/macros/base/end_print.cfg
@@ -18,7 +18,16 @@ gcode:
PARK
{% if klippain_mmu_enabled %}
- {% if printer.mmu.enabled and mmu_unload %}
+ {% if printer.mmu.enabled and printer.configfile.settings.mmu.happy_hare_version >= 2.5 %}
+ {% if printer['gcode_macro _MMU_RUN_MARKERS'].mmu_end_run == 1 %}
+ RESPOND MSG="MMU end already done"
+ {% elif mmu_unload %}
+ MMU_END EJECT=true
+ {% else %}
+ MMU_END
+ {% endif %}
+ _MMU_RUN_MARKERS
+ {% elif printer.mmu.enabled and mmu_unload %}
# unload filament and park into MMU. Or just unload filament out of extruder if using bypass.
MMU_EJECT
{% endif %}
@@ -68,7 +77,7 @@ gcode:
{% endif %}
{% if klippain_mmu_enabled %}
- {% if printer.mmu.enabled and printer.mmu.print_start_detection|int == 0 %}
+ {% if printer.mmu.enabled and printer.configfile.settings.mmu.happy_hare_version < 2.5 and printer.mmu.print_start_detection|int == 0 %}
_MMU_PRINT_END
{% endif %}
{% endif %}
diff --git a/macros/base/homing/homing_override.cfg b/macros/base/homing/homing_override.cfg
index 02f605d9b..3d76e77ea 100644
--- a/macros/base/homing/homing_override.cfg
+++ b/macros/base/homing/homing_override.cfg
@@ -73,7 +73,7 @@ gcode:
# Set the homing acceleration prior to any movement
{% set saved_accel = printer.toolhead.max_accel %}
- M204 S{homing_travel_accel}
+ SET_VELOCITY_LIMIT ACCEL={homing_travel_accel}
{% if bed_mesh_enabled %}
BED_MESH_CLEAR
diff --git a/macros/base/pause_resume.cfg b/macros/base/pause_resume.cfg
index 54b2af0bf..7e42f2cc0 100644
--- a/macros/base/pause_resume.cfg
+++ b/macros/base/pause_resume.cfg
@@ -4,16 +4,32 @@ description: Pause the print and park
gcode:
{% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %}
{% set light_intensity_start_print = printer["gcode_macro _USER_VARIABLES"].light_intensity_start_print %}
+ {% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %}
{% if printer.pause_resume.is_paused %}
RESPOND MSG="Print is already paused"
{% else %}
- SAVE_GCODE_STATE NAME=PAUSE_state
{% if light_enabled %}
LIGHT_ON S={light_intensity_start_print}
{% endif %}
- BASE_PAUSE
- PARK
+ {% if klippain_mmu_enabled %}
+ {% if printer.mmu.enabled and printer.configfile.settings.mmu.happy_hare_version >= 2.5 %}
+ {% set vars = printer['gcode_macro _MMU_CLIENT_VARS'] %}
+ _RETRACT
+ _MMU_SAVE_POSITION
+ BASE_PAUSE
+ _MMU_PARK
+ {vars.user_pause_extension|default("")}
+ {% else %}
+ SAVE_GCODE_STATE NAME=PAUSE_state
+ BASE_PAUSE
+ PARK
+ {% endif %}
+ {% else %}
+ SAVE_GCODE_STATE NAME=PAUSE_state
+ BASE_PAUSE
+ PARK
+ {% endif %}
{% endif %}
@@ -30,7 +46,12 @@ gcode:
RESPOND MSG="Print is not paused. Resume ignored"
{% else %}
{% if klippain_mmu_enabled %}
- {% if printer.mmu.enabled and printer.mmu.is_locked %}
+ {% if printer.mmu.enabled and printer.configfile.settings.mmu.happy_hare_version >= 2.5 %}
+ {% set vars = printer['gcode_macro _MMU_CLIENT_VARS'] %}
+ _MMU_RESTORE_POSITION
+ {vars.user_resume_extension|default("")}
+ _RETRACT
+ {% elif printer.mmu.enabled and printer.mmu.is_locked %}
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=0
{% else %}
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 MOVE_SPEED={St}
diff --git a/macros/base/probing/dockable_probe.cfg b/macros/base/probing/dockable_probe.cfg
index 5d3b68782..1541cfb46 100644
--- a/macros/base/probing/dockable_probe.cfg
+++ b/macros/base/probing/dockable_probe.cfg
@@ -138,7 +138,7 @@ gcode:
# Set the dock/undock acceleration prior to any movement
{% set saved_accel = printer.toolhead.max_accel %}
- M204 S{probe_dock_accel}
+ SET_VELOCITY_LIMIT ACCEL={probe_dock_accel}
# Probe entry location
_PROBE_MOVE_TO LOCATION={probe_before_attach_position} DISTANCE={probe_move_attach_length} SPEED={travel_speed}
@@ -246,7 +246,7 @@ gcode:
# Set the dock/undock acceleration prior to any movement
{% set saved_accel = printer.toolhead.max_accel %}
- M204 S{probe_dock_accel}
+ SET_VELOCITY_LIMIT ACCEL={probe_dock_accel}
# Move to probe entry location
_PROBE_MOVE_TO LOCATION={probe_before_dock_position} DISTANCE={probe_move_dock_length} SPEED={travel_speed}
diff --git a/macros/base/probing/overrides/qgl.cfg b/macros/base/probing/overrides/qgl.cfg
index 872b5f332..770a7cb31 100644
--- a/macros/base/probing/overrides/qgl.cfg
+++ b/macros/base/probing/overrides/qgl.cfg
@@ -25,7 +25,7 @@ gcode:
# Set the tilting acceleration prior to any movement
{% set saved_accel = printer.toolhead.max_accel %}
- M204 S{tilting_travel_accel}
+ SET_VELOCTITY_LIMIT ACCEL={tilting_travel_accel}
_BASE_QUAD_GANTRY_LEVEL {% for p in params %}{'%s=%s ' % (p, params[p])}{% endfor %}
diff --git a/macros/base/probing/overrides/z_tilt.cfg b/macros/base/probing/overrides/z_tilt.cfg
index 28b75b68a..70fb6a5d0 100644
--- a/macros/base/probing/overrides/z_tilt.cfg
+++ b/macros/base/probing/overrides/z_tilt.cfg
@@ -26,7 +26,7 @@ gcode:
# Set the tilting acceleration prior to any movement
{% set saved_accel = printer.toolhead.max_accel %}
- M204 S{tilting_travel_accel}
+ SET_VELOCITY_LIMIT ACCEL={tilting_travel_accel}
_BASE_Z_TILT_ADJUST {% for p in params %}{'%s=%s ' % (p, params[p])}{% endfor %}
diff --git a/macros/base/start_print.cfg b/macros/base/start_print.cfg
index b5f05a782..c7a8bce94 100644
--- a/macros/base/start_print.cfg
+++ b/macros/base/start_print.cfg
@@ -9,6 +9,7 @@ variable_chamber_maxtime: 0
variable_initial_tool: 0
variable_check_gates: 0
variable_tools_used: ""
+variable_referenced_tools: "!referenced_tools!"
variable_sync_mmu_extruder: 0
variable_material: "XXX"
variable_fl_size: "0_0_0_0"
@@ -23,14 +24,17 @@ gcode:
{% set SOAK = params.SOAK|default(printer["gcode_macro _USER_VARIABLES"].print_default_soak)|int %} # Heatsoak time of the bed in minutes
{% set CHAMBER_TEMP = params.CHAMBER|default(printer["gcode_macro _USER_VARIABLES"].print_default_chamber_temp)|int %} # Chamber temperature setpoint
{% set CHAMBER_MAXTIME = params.CHAMBER_MAXTIME|default(printer["gcode_macro _USER_VARIABLES"].print_default_chamber_max_heating_time)|int %} # Chamber heatsoak timeout in minutes
- {% set INITIAL_TOOL = params.INITIAL_TOOL|default(0)|int %} # Initial tool (for the MMU/ERCF initialization)
{% set MATERIAL = params.MATERIAL|default(printer["gcode_macro _USER_VARIABLES"].print_default_material)|string %} # Material type set in the slicer
{% set FL_SIZE = params.SIZE|default("0_0_0_0")|string %} # Get bounding box of the first layer for the adaptive bed mesh
+ {% set BED_MESH_PROFILE = params.MESH|default("")|string %} # Bed mesh profile to load
+ {% set ADAPTIVE_PRIMELINE = params.ADAPTIVE_PRIMELINE|default(1)|int %} # Weither to do or not an adaptive prime line near the real print zone
+
+ # Get all the specific MMU parameters passed from the slicer
+ {% set INITIAL_TOOL = params.INITIAL_TOOL|default(0)|int %} # Initial tool (for the MMU/ERCF initialization)
{% set CHECK_GATES = params.CHECK_GATES|default(printer['gcode_macro _USER_VARIABLES'].mmu_check_gates_on_start_print)|default(0)|int %} # Check if MMU gates are availables
{% set TOOLS_USED = params.TOOLS_USED|default("")|string %} # Check if MMU gates (used in gcode file) are availables
+ {% set REFERENCED_TOOLS = params.REFERENCED_TOOLS|default("!referenced_tools!")|string %} # same as TOOLS_USED for compatibility with HH macros
{% set SYNC_MMU_EXTRUDER = params.SYNC_MMU_EXTRUDER|default(0)|int %} # set MMU gear motor and extruder synchronization during print TODO
- {% set BED_MESH_PROFILE = params.MESH|default("")|string %} # Bed mesh profile to load
- {% set ADAPTIVE_PRIMELINE = params.ADAPTIVE_PRIMELINE|default(1)|int %} # Weither to do or not an adaptive prime line near the real print zone
# Set the variables to be used in all the modules based on the slicer parameters
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=bed_temp VALUE={BED_TEMP}
@@ -38,15 +42,16 @@ gcode:
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=soak VALUE={SOAK}
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=chamber_temp VALUE={CHAMBER_TEMP}
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=chamber_maxtime VALUE={CHAMBER_MAXTIME}
- SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=initial_tool VALUE={INITIAL_TOOL}
- SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=check_gates VALUE={CHECK_GATES}
- SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=tools_used VALUE='"{TOOLS_USED}"'
- SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=sync_mmu_extruder VALUE={SYNC_MMU_EXTRUDER}
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=material VALUE='"{MATERIAL}"'
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=fl_size VALUE='"{FL_SIZE}"'
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=bed_mesh_profile VALUE='"{BED_MESH_PROFILE}"'
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=adaptive_primeline VALUE={ADAPTIVE_PRIMELINE}
-
+ SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=initial_tool VALUE={INITIAL_TOOL}
+ SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=check_gates VALUE={CHECK_GATES}
+ SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=tools_used VALUE='"{TOOLS_USED}"'
+ SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=referenced_tools VALUE='"{REFERENCED_TOOLS}"'
+ SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=sync_mmu_extruder VALUE={SYNC_MMU_EXTRUDER}
+
{% if params.TOTAL_LAYER %} # total layers count (if provided by the slicer)
SET_PRINT_STATS_INFO TOTAL_LAYER={params.TOTAL_LAYER|int}
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=total_layer VALUE={params.TOTAL_LAYER|int}
@@ -168,6 +173,18 @@ gcode:
_MODULE_CUSTOM2 {rawparams}
{% elif action == "custom3" %}
_MODULE_CUSTOM3 {rawparams}
+ {% elif action == "custom4" %}
+ _MODULE_CUSTOM4 {rawparams}
+ {% elif action == "custom5" %}
+ _MODULE_CUSTOM5 {rawparams}
+ {% elif action == "custom6" %}
+ _MODULE_CUSTOM6 {rawparams}
+ {% elif action == "custom7" %}
+ _MODULE_CUSTOM7 {rawparams}
+ {% elif action == "custom8" %}
+ _MODULE_CUSTOM8 {rawparams}
+ {% elif action == "custom9" %}
+ _MODULE_CUSTOM9 {rawparams}
{% else %}
{ action_raise_error("Unknown module called in START_PRINT! Please verify your startprint_actions variable override!") }
{% endif %}
@@ -197,7 +214,7 @@ gcode:
{% endif %}
{% if klippain_mmu_enabled %}
- {% if printer.mmu.enabled and printer.mmu.print_start_detection|int == 0 %}
+ {% if printer.mmu.enabled and printer.configfile.settings.mmu.happy_hare_version < 2.5 and printer.mmu.print_start_detection|int == 0 %}
_MMU_PRINT_START
{% endif %}
{% endif %}
@@ -497,3 +514,63 @@ gcode:
# gcode:
# ## Your custom code here
+
+[gcode_macro _MODULE_CUSTOM4]
+gcode:
+ # ---- CUSTOM Macro section
+ # this section is reserved for personal customized start actions, which can be combined with all other start actions
+ # in order to use this, create a new macro in overrides.cfg
+ # [gcode_macro _MODULE_CUSTOM4]
+ # gcode:
+ # ## Your custom code here
+
+
+[gcode_macro _MODULE_CUSTOM5]
+gcode:
+ # ---- CUSTOM Macro section
+ # this section is reserved for personal customized start actions, which can be combined with all other start actions
+ # in order to use this, create a new macro in overrides.cfg
+ # [gcode_macro _MODULE_CUSTOM5]
+ # gcode:
+ # ## Your custom code here
+
+
+[gcode_macro _MODULE_CUSTOM6]
+gcode:
+ # ---- CUSTOM Macro section
+ # this section is reserved for personal customized start actions, which can be combined with all other start actions
+ # in order to use this, create a new macro in overrides.cfg
+ # [gcode_macro _MODULE_CUSTOM6]
+ # gcode:
+ # ## Your custom code here
+
+
+[gcode_macro _MODULE_CUSTOM7]
+gcode:
+ # ---- CUSTOM Macro section
+ # this section is reserved for personal customized start actions, which can be combined with all other start actions
+ # in order to use this, create a new macro in overrides.cfg
+ # [gcode_macro _MODULE_CUSTOM7]
+ # gcode:
+ # ## Your custom code here
+
+
+[gcode_macro _MODULE_CUSTOM8]
+gcode:
+ # ---- CUSTOM Macro section
+ # this section is reserved for personal customized start actions, which can be combined with all other start actions
+ # in order to use this, create a new macro in overrides.cfg
+ # [gcode_macro _MODULE_CUSTOM8]
+ # gcode:
+ # ## Your custom code here
+
+
+[gcode_macro _MODULE_CUSTOM9]
+gcode:
+ # ---- CUSTOM Macro section
+ # this section is reserved for personal customized start actions, which can be combined with all other start actions
+ # in order to use this, create a new macro in overrides.cfg
+ # [gcode_macro _MODULE_CUSTOM8]
+ # gcode:
+ # ## Your custom code here
+
diff --git a/macros/hardware_functions/mmu.cfg b/macros/hardware_functions/mmu.cfg
index 161db484f..515b1c987 100644
--- a/macros/hardware_functions/mmu.cfg
+++ b/macros/hardware_functions/mmu.cfg
@@ -10,124 +10,161 @@ gcode:
{% set INITIAL_TOOL = printer["gcode_macro START_PRINT"].initial_tool %}
{% set CHECK_GATES = printer["gcode_macro START_PRINT"].check_gates %}
{% set TOOLS_USED = printer["gcode_macro START_PRINT"].tools_used %}
+ {% set REFERENCED_TOOLS = printer["gcode_macro START_PRINT"].referenced_tools %}
{% set SYNC_MMU_EXTRUDER = printer["gcode_macro START_PRINT"].sync_mmu_extruder %}
{% if printer.mmu.enabled %}
- # Manually changing the MMU state to start print (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print)
- {% if printer.mmu.print_start_detection|int == 0 %}
- _MMU_PRINT_START
- {% endif %}
-
- # Park the toolhead to get on a safe place (without retracting the filament)
- PARK E=0
+ # Initilalize the MMU for Happy_Hare v2.5 and highter
+ {% if printer.configfile.settings.mmu.happy_hare_version >= 2.5 %}
+ {% if printer['gcode_macro _MMU_RUN_MARKERS'].mmu_start_setup_run == 1 %}
+ {% if verbose %}
+ RESPOND MSG="MMU start setup already done"
+ {% endif %}
+ {% else %}
+ {% if REFERENCED_TOOLS == "!referenced_tools!" %}
+ {% if TOOLS_USED != "" and TOOLS_USED != "!referenced_tools!" %}
+ MMU_START_SETUP INITIAL_TOOL={INITIAL_TOOL} REFERENCED_TOOLS={TOOLS_USED}
+ {% endif %}
+ {% else %}
+ MMU_START_SETUP {rawparams}
+ {% endif %}
+ {% endif %}
+ {% if printer['gcode_macro _MMU_RUN_MARKERS'].mmu_start_check_run == 1 %}
+ {% if verbose %}
+ RESPOND MSG="MMU check_gates already done"
+ {% endif %}
+ {% else %}
+ PARK E=0
+ MMU_START_CHECK
+ {% endif %}
+ # Set the sync_to_extruder mode of HH if wanted by the user for the print (set from the slicer custom start gcode)
+ {% if printer.configfile.config.mmu.sync_to_extruder == 0 and printer.mmu.tool|int != -2 %}
+ {% if SYNC_MMU_EXTRUDER == 1 %}
+ {% if verbose %}
+ RESPOND MSG="MMU gear motor will be synchronized with the extruder during the print"
+ {% endif %}
+ MMU_TEST_CONFIG sync_to_extruder=1
+ {% endif %}
+ {% endif %}
- # If the MMU is not in bypass mode
- {% if printer.mmu.tool|int != -2 %}
- # Home the MMU if necessary and pre select the initial tool
- {% if mmu_force_homing_in_start_print or printer.mmu.is_homed == 0 %}
- MMU_HOME TOOL={INITIAL_TOOL} FORCE_UNLOAD=1
+ {% else %}
+ # Initilalize the MMU for Happy_Hare versions lower than v2.5
+ {% if printer.mmu.print_start_detection|int == 0 %}
+ # Manually changing the MMU state to start print (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print)
+ _MMU_PRINT_START
{% endif %}
- # If we need to check the gates (specified by the slicer or the Klippain variable)
- {% if CHECK_GATES %}
- {% if TOOLS_USED != "!referenced_tools!" %}
+ # Park the toolhead to get on a safe place (without retracting the filament)
+ PARK E=0
- # If we are in the case of a multi-filament print
- {% if TOOLS_USED and printer.mmu.tool|string != TOOLS_USED %}
- {% if verbose %}
- RESPOND PREFIX='MMU info:' MSG=" You are planning a multi-filament print. The tool(s): {TOOLS_USED} will be checked to limit the risk of errors."
- {% endif %}
+ # If the MMU is not in bypass mode
+ {% if printer.mmu.tool|int != -2 %}
+ # Home the MMU if necessary and pre select the initial tool
+ {% if mmu_force_homing_in_start_print or printer.mmu.is_homed == 0 %}
+ MMU_HOME TOOL={INITIAL_TOOL} FORCE_UNLOAD=1
+ {% endif %}
- # First eject in case a bad tool is already loaded, then check the gates and select the initial tool
- MMU_EJECT
- MMU_CHECK_GATE TOOLS={TOOLS_USED}
- MMU_SELECT TOOL={INITIAL_TOOL}
+ # If we need to check the gates (specified by the slicer or the Klippain variable)
+ {% if CHECK_GATES %}
+ {% if TOOLS_USED != "!referenced_tools!" %}
- # Else if the TOOL_USED parameter is not valid... We can still start the print but only check the initial tool
- {% elif printer.mmu.tool|int != INITIAL_TOOL or (printer.mmu.tool|int == INITIAL_TOOL and printer.mmu.filament != "Loaded") %}
- {% if verbose %}
- {% if printer.mmu.tool|int != INITIAL_TOOL %}
- RESPOND PREFIX='Config info:' MSG=" Only T{INITIAL_TOOL} will be checked! You should consider using TOOLS_USED=!referenced_tools! in the custom start gcode of your slicer"
- {% elif printer.mmu.tool|int == INITIAL_TOOL and printer.mmu.filament != "Loaded" %}
- RESPOND PREFIX='Config info:' MSG=" T{INITIAL_TOOL} is selected but the filament is not loaded. In order to avoid a possible error if the initial tool is marked as empty in HappyHare, it will be checked!"
+ # If we are in the case of a multi-filament print
+ {% if TOOLS_USED and printer.mmu.tool|string != TOOLS_USED %}
+ {% if verbose %}
+ RESPOND PREFIX='MMU info:' MSG=" You are planning a multi-filament print. The tool(s): {TOOLS_USED} will be checked to limit the risk of errors."
+ {% endif %}
+
+ # First eject in case a bad tool is already loaded, then check the gates and select the initial tool
+ MMU_EJECT
+ MMU_CHECK_GATE TOOLS={TOOLS_USED}
+ MMU_SELECT TOOL={INITIAL_TOOL}
+
+ # Else if the TOOL_USED parameter is not valid... We can still start the print but only check the initial tool
+ {% elif printer.mmu.tool|int != INITIAL_TOOL or (printer.mmu.tool|int == INITIAL_TOOL and printer.mmu.filament != "Loaded") %}
+ {% if verbose %}
+ {% if printer.mmu.tool|int != INITIAL_TOOL %}
+ RESPOND PREFIX='Config info:' MSG=" Only T{INITIAL_TOOL} will be checked! You should consider using TOOLS_USED=!referenced_tools! in the custom start gcode of your slicer"
+ {% elif printer.mmu.tool|int == INITIAL_TOOL and printer.mmu.filament != "Loaded" %}
+ RESPOND PREFIX='Config info:' MSG=" T{INITIAL_TOOL} is selected but the filament is not loaded. In order to avoid a possible error if the initial tool is marked as empty in HappyHare, it will be checked!"
+ {% endif %}
{% endif %}
+
+ # First eject in case a bad tool is already loaded, then check the initial tool gate
+ MMU_EJECT
+ MMU_CHECK_GATE TOOLS={INITIAL_TOOL}
{% endif %}
- # First eject in case a bad tool is already loaded, then check the initial tool gate
- MMU_EJECT
- MMU_CHECK_GATE TOOLS={INITIAL_TOOL}
+ # Else if there was an error in the Moonraker gcode preprocessor (TOOL_USED is still equal to "!referenced_tools!")
+ {% else %}
+ {% if verbose %}
+ RESPOND PREFIX='MMU info:' MSG=" TOOLS_USED={TOOLS_USED} is likely not valid. Please check your slicer custom start gcode and verify that the HappyHare Moonraker gcode preprocessor is working! There will be no check on the gates and they will all be marked as available to avoid an error"
+ {% endif %}
+
+ # Reset the state status (Available or Empty) for all the MMU gates to avoid an error
+ {% set gate_str = printer.mmu.ttg_map|join(',') %}
+ MMU_GATE_MAP GATES={gate_str} AVAILABLE=-1
{% endif %}
-
- # Else if there was an error in the Moonraker gcode preprocessor (TOOL_USED is still equal to "!referenced_tools!")
+
+ # Else if no check of the gates is wanted (specified by the slicer or the Klippain variable)
{% else %}
{% if verbose %}
- RESPOND PREFIX='MMU info:' MSG=" TOOLS_USED={TOOLS_USED} is likely not valid. Please check your slicer custom start gcode and verify that the HappyHare Moonraker gcode preprocessor is working! There will be no check on the gates and they will all be marked as available to avoid an error"
+ RESPOND PREFIX='Config info:' MSG=" No gate check requested by the user. You should consider variable_mmu_check_gates_on_start_print: True in your Klippain variables.cfg or use the MMU_CHECK_GATES=1 parameter in your slicer custom start gcode"
+ {% endif %}
+ {% if printer.mmu.tool|int != INITIAL_TOOL %}
+ MMU_HOME FORCE_UNLOAD=1 TOOL={INITIAL_TOOL}
{% endif %}
+ {% endif %}
- # Reset the state status (Available or Empty) for all the MMU gates to avoid an error
- {% set gate_str = printer.mmu.ttg_map|join(',') %}
- MMU_GATE_MAP GATES={gate_str} AVAILABLE=-1
+ # First instance of the MMU error check (if enabled...) to stop the START_PRINT sequence earlier
+ {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %}
+ _MMU_ERROR_CHECK1
{% endif %}
- # Else if no check of the gates is wanted (specified by the slicer or the Klippain variable)
+ # Else if the MMU is in bypass mode, we just check for an error
{% else %}
- {% if verbose %}
- RESPOND PREFIX='Config info:' MSG=" No gate check requested by the user. You should consider variable_mmu_check_gates_on_start_print: True in your Klippain variables.cfg or use the MMU_CHECK_GATES=1 parameter in your slicer custom start gcode"
- {% endif %}
- {% if printer.mmu.tool|int != INITIAL_TOOL %}
- MMU_HOME FORCE_UNLOAD=1 TOOL={INITIAL_TOOL}
+ # First instance of the MMU error check (if enabled...) while in bypass mode to stop the START_PRINT sequence earlier
+ {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %}
+ _MMU_ERROR_CHECK1
{% endif %}
{% endif %}
- # First instance of the MMU error check (if enabled...) to stop the START_PRINT sequence earlier
- {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %}
- _MMU_ERROR_CHECK1
- {% endif %}
-
- # Else if the MMU is in bypass mode, we just check for an error
- {% else %}
- # First instance of the MMU error check (if enabled...) while in bypass mode to stop the START_PRINT sequence earlier
- {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %}
- _MMU_ERROR_CHECK1
- {% endif %}
- {% endif %}
+ # Set the sync_to_extruder mode of HH if wanted by the user for the print (set from the slicer custom start gcode)
+ {% if printer.configfile.config.mmu.sync_to_extruder == 0 and printer.mmu.tool|int != -2 %}
+ {% if SYNC_MMU_EXTRUDER == 1 %}
+ {% if verbose %}
+ RESPOND MSG="MMU gear motor will be synchronized with the extruder during the print"
+ {% endif %}
+ MMU_TEST_CONFIG sync_to_extruder=1
+ {% endif %}
- # Set the sync_to_extruder mode of HH if wanted by the user for the print (set from the slicer custom start gcode)
- {% if printer.configfile.config.mmu.sync_to_extruder == 0 and printer.mmu.tool|int != -2 %}
- {% if SYNC_MMU_EXTRUDER == 1 %}
+ # Force disable the sync_to_extruder mode of HH if the MMU is set in bypass mode
+ {% elif (printer.configfile.config.mmu.sync_to_extruder == 1 or SYNC_MMU_EXTRUDER == 1) and printer.mmu.tool|int == -2 %}
{% if verbose %}
- RESPOND MSG="MMU gear motor will be synchronized with the extruder during the print"
+ RESPOND MSG="MMU bypass mode is used so its gear motor cannot be synchronized with the extruder during the print"
{% endif %}
- MMU_TEST_CONFIG sync_to_extruder=1
+ MMU_TEST_CONFIG sync_to_extruder=0
{% endif %}
- # Force disable the sync_to_extruder mode of HH if the MMU is set in bypass mode
- {% elif (printer.configfile.config.mmu.sync_to_extruder == 1 or SYNC_MMU_EXTRUDER == 1) and printer.mmu.tool|int == -2 %}
- {% if verbose %}
- RESPOND MSG="MMU bypass mode is used so its gear motor cannot be synchronized with the extruder during the print"
- {% endif %}
- MMU_TEST_CONFIG sync_to_extruder=0
- {% endif %}
-
- # Preload the MMU gates if the filament is not already loaded and the MMU is set in normal mode
- {% if printer.mmu.tool|int != -2 %}
- {% if printer.mmu.filament != "Loaded" %}
- {% if printer.mmu.tool|int != INITIAL_TOOL %}
- MMU_SELECT TOOL={INITIAL_TOOL}
- MMU_PRELOAD
- {% endif %}
- {% else %}
- {% if printer.mmu.tool|int != INITIAL_TOOL %}
- MMU_EJECT
- MMU_SELECT TOOL={INITIAL_TOOL}
- MMU_PRELOAD
+ # Preload the MMU gates if the filament is not already loaded and the MMU is set in normal mode
+ {% if printer.mmu.tool|int != -2 %}
+ {% if printer.mmu.filament != "Loaded" %}
+ {% if printer.mmu.tool|int != INITIAL_TOOL %}
+ MMU_SELECT TOOL={INITIAL_TOOL}
+ MMU_PRELOAD
+ {% endif %}
+ {% else %}
+ {% if printer.mmu.tool|int != INITIAL_TOOL %}
+ MMU_EJECT
+ MMU_SELECT TOOL={INITIAL_TOOL}
+ MMU_PRELOAD
+ {% endif %}
{% endif %}
{% endif %}
- {% endif %}
- # Manually reset the MMU state to the initial state (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print)
- {% if printer.mmu.print_start_detection|int == 0 %}
- _MMU_PRINT_END STATE=standby
+ # Manually reset the MMU state to the initial state (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print)
+ {% if printer.mmu.print_start_detection|int == 0 %}
+ _MMU_PRINT_END STATE=standby
+ {% endif %}
{% endif %}
{% endif %}
@@ -138,27 +175,40 @@ gcode:
{% set INITIAL_TOOL = printer["gcode_macro START_PRINT"].initial_tool %}
{% if printer.mmu.enabled %}
- # Manually changing the MMU state to start print (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print)
- {% if printer.mmu.print_start_detection|int == 0 %}
- _MMU_PRINT_START
- {% endif %}
+ # For HH v2.5 and higher let HH manage initial tool loading
+ {% if printer.configfile.settings.mmu.happy_hare_version >= 2.5 %}
+ {% if printer['gcode_macro _MMU_RUN_MARKERS'].mmu_start_load_initial_tool_run == 1 %}
+ {% if verbose %}
+ RESPOND MSG="MMU start setup already done"
+ {% endif %}
+ {% else %}
+ MMU_START_LOAD_INITIAL_TOOL
+ {% endif %}
+ _MMU_RUN_MARKERS
- # If the MMU is not in bypass mode, we load the initial tool if not already loaded
- {% if printer.mmu.tool|int != -2 %}
- MMU_CHANGE_TOOL TOOL={INITIAL_TOOL} STANDALONE=1
-
- # Else if in bypass mode, then manually load the filament (that was manually inserted) to the nozzle
{% else %}
- MMU_LOAD
- {% endif %}
+ # Manually changing the MMU state to start print (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print)
+ {% if printer.mmu.print_start_detection|int == 0 %}
+ _MMU_PRINT_START
+ {% endif %}
- # Second instance of the MMU error check (if enabled...) to stop the START_PRINT sequence earlier
- {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %}
- _MMU_ERROR_CHECK2
- {% endif %}
- # And manually reset the MMU state to the initial state (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print)
- {% if printer.mmu.print_start_detection|int == 0 %}
- _MMU_PRINT_END STATE=standby
+ # If the MMU is not in bypass mode, we load the initial tool if not already loaded
+ {% if printer.mmu.tool|int != -2 %}
+ MMU_CHANGE_TOOL TOOL={INITIAL_TOOL} STANDALONE=1
+
+ # Else if in bypass mode, then manually load the filament (that was manually inserted) to the nozzle
+ {% else %}
+ MMU_LOAD
+ {% endif %}
+
+ # Second instance of the MMU error check (if enabled...) to stop the START_PRINT sequence earlier
+ {% if printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 0 %}
+ _MMU_ERROR_CHECK2
+ {% endif %}
+ # And manually reset the MMU state to the initial state (see https://github.com/Frix-x/klippain/blob/main/docs/mmu.md#early-check-errors-during-start_print)
+ {% if printer.mmu.print_start_detection|int == 0 %}
+ _MMU_PRINT_END STATE=standby
+ {% endif %}
{% endif %}
{% endif %}
@@ -237,7 +287,7 @@ gcode:
[gcode_macro _MMU_CHECK_STATE]
description: Display some MMU parameters to debug it
gcode:
- RESPOND PREFIX= MSG=" Klippain with Happy_Hare_V2.x support in main branch"
+ RESPOND PREFIX= MSG=" Klippain with Happy_Hare v{printer.configfile.settings.mmu.happy_hare_version} support in main branch"
RESPOND PREFIX= MSG=" mmu.print_state : {printer.mmu.print_state}"
RESPOND PREFIX= MSG=" mmu.is_locked : {printer.mmu.is_locked}"
RESPOND PREFIX= MSG=" mmu.tool : {printer.mmu.tool}"
@@ -247,3 +297,28 @@ gcode:
RESPOND PREFIX= MSG=" mmu.filament_pos : {printer.mmu.filament_pos}"
RESPOND PREFIX= MSG=" mmu.selector_touch_enable : {printer.configfile.config.mmu.selector_touch_enable}"
RESPOND PREFIX= MSG=" mmu.sync_drive : {printer.mmu.sync_drive}"
+
+[gcode_macro _RETRACT]
+description: Helper to retract filament in pause and cancel
+gcode:
+ {% if printer.configfile.settings.mmu.happy_hare_version >= 2.5 %}
+ {% set vars = printer['gcode_macro _MMU_CLIENT_VARS'] %}
+ {% set length = params.LENGTH|default(vars.retract)|default(1.0)|float %}
+ {% set speed = params.SPEED|default(vars.retract_speed)|default(1.0)|float %}
+
+ _UNRETRACT LENGTH=-{length|abs} SPEED={speed}
+ {% endif %}
+
+[gcode_macro _UNRETRACT]
+description: Helper to extruder filament in resume to undo retract
+gcode:
+ {% if printer.configfile.settings.mmu.happy_hare_version >= 2.5 %}
+ {% set vars = printer['gcode_macro _MMU_CLIENT_VARS'] %}
+ {% set length = params.LENGTH|default(vars.unretract)|default(1.0)|float %}
+ {% set speed = params.SPEED|default(vars.unretract_speed)|default(1.0)|float %}
+
+ {% if printer.extruder.can_extrude %}
+ M83 ; Extruder relative
+ G1 E{length} F{speed|abs * 60}
+ {% endif %}
+ {% endif %}
diff --git a/macros/helpers/nozzle_cleaning.cfg b/macros/helpers/nozzle_cleaning.cfg
index e2869681e..eb7050d88 100644
--- a/macros/helpers/nozzle_cleaning.cfg
+++ b/macros/helpers/nozzle_cleaning.cfg
@@ -25,7 +25,7 @@ gcode:
# Set the cleaning acceleration prior to any movement
{% set saved_accel = printer.toolhead.max_accel %}
- M204 S{brush_clean_accel}
+ SET_VELOCITY_LIMIT ACCEL={brush_clean_accel}
# Move to purge zone (left side)
G90
diff --git a/macros/miscs/startup.cfg b/macros/miscs/startup.cfg
index e9ebc2258..78a2897ce 100644
--- a/macros/miscs/startup.cfg
+++ b/macros/miscs/startup.cfg
@@ -29,12 +29,6 @@ gcode:
# Check the probe configuration and compatibility with current includes
_INIT_CHECKPROBECONF
- # If the extruder is running with a TMC2240, there is specific driver registers to set at Klipper startup
- {% set e_driver = printer["gcode_macro _USER_VARIABLES"].e_driver|string %}
- {% if e_driver == "TMC2240" %}
- _INIT_TMC2240
- {% endif %}
-
# If an MMU/ERCF is included in Klippain, we also check that the correct HH version is installed
{% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %}
{% set klippain_ercf_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_ercf_enabled %}
@@ -49,7 +43,7 @@ gcode:
_INIT_USERCUSTOM
{% if klippain_mmu_enabled %}
- RESPOND MSG="Klippain with MMU support started and ready!"
+ RESPOND MSG="Klippain with Happy_Hare v{printer.configfile.settings.mmu.happy_hare_version} MMU support started and ready!"
{% else %}
RESPOND MSG="Klippain started and ready!"
{% endif %}
@@ -66,41 +60,6 @@ gcode:
{% endif %}
-[gcode_macro _INIT_TMC2240]
-gcode:
- # This macro can be copied over to overrides.cfg and will allow the values to be defined automatically on klipper startup
- # TMC2240 extruder initialization macro to set the driver registers based on Esoterical's github page. These settings are not
- # universal and not necessary for all SB2240 owners. Adapt them to your needs!
- # https://github.com/Esoterical/voron_canbus/blob/main/toolhead_flashing/common_hardware/BigTreeTech%20SB2209%20and%20SB2240/SB2240%20Stepper%20Configuration%20and%20Undervoltage.md
-
- ## Enable accurate stall current measurement
- #SET_TMC_FIELD STEPPER=extruder FIELD=pwm_meas_sd_enable VALUE=1
- #SET_TMC_FIELD STEPPER=extruder FIELD=sg4_filt_en VALUE=1
- ## Set the StealthChop stall detection threshold (may not be completely necessary)
- #SET_TMC_FIELD STEPPER=extruder FIELD=SG4_THRS VALUE=10
- ## Set the hold current to zero, and completely switch off the motor when it is not in use
- #SET_TMC_FIELD STEPPER=extruder FIELD=IHOLD VALUE=0
- #SET_TMC_FIELD STEPPER=extruder FIELD=freewheel VALUE=1
- ## Set the max expected velocity to a value such that we are unlikely to switch to fullstepping except during a very fast retraction or prime
- #SET_TMC_FIELD STEPPER=extruder FIELD=THIGH VELOCITY=50
- ## Use CoolStep, but we need a certain step frequency for it to work
- #SET_TMC_FIELD STEPPER=extruder FIELD=TCOOLTHRS VALUE=4000
- ## But do switch to PWM autotuning when at high flow
- #SET_TMC_FIELD STEPPER=extruder FIELD=TPWMTHRS VELOCITY=1
- ## Allow the motor to freewheel when not in use, means it runs cooler
- #SET_TMC_FIELD STEPPER=extruder FIELD=freewheel VALUE=1
- ## Set the temperature prewarning to something reasonable. Cosmetic, Klipper does nothing with this
- #SET_TMC_FIELD STEPPER=extruder FIELD=OVERTEMPPREWARNING_VTH VALUE=2885 # 7.7 * 100 C + 2038
- ## The following is absolutely critical: set the overvoltage snubber to a sensible voltage.
- ## This should be set to about 0.8 V above your power supply's idle voltage.
- ## Your PSU voltage can be read from the TMC 2240 by issuing a GCODE command:
- ## DUMP_TMC stepper=extruder register=ADC_VSUPPLY_AIN
- ## The voltage is the value of adc_vsupply multiplied by 0.009732
- ## It is also possible to use adc_vsupply + 82 here, which works out to be the same.
- #{% set v = (24.7/0.009732)|int %}
- #SET_TMC_FIELD STEPPER=extruder FIELD=OVERVOLTAGE_VTH VALUE={ v }
-
-
[gcode_macro _INIT_CHECKPROBECONF]
gcode:
{% set probe_type_enabled = printer["gcode_macro _USER_VARIABLES"].probe_type_enabled|string %}
@@ -159,11 +118,25 @@ gcode:
{% else %}
{ action_raise_error("ERCF support is enabled in Klippain, but the old version of version of HappyHare (ie. ERCF-Software-V3) is installed. Please uninstall it and install the latest HappyHare instead. See the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md") }
{% endif %}
- {% elif printer['gcode_macro _USER_VARIABLES'].mmu_force_homing_in_start_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_unload_on_cancel_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_unload_on_end_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_check_gates_on_start_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print is not defined %}
- { action_raise_error("MMU support is enabled in Klippain, but some variables are missing from your variables.cfg. Please update your template or refer to the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md") }
- {% elif printer["gcode_macro _USER_VARIABLES"].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 1 %}
- RESPOND MSG="The HappyHare function to automatically detect the start and end of a print has been automatically disabled to allow early detection of an error during the Klippain START_PRINT sequence. This allow a more efficient debugging of the MMU. Refer to the Klippain MMU documentation"
- MMU_TEST_CONFIG print_start_detection=0 # Override this value to disable the HappyHare auto detection of start and end of print in order to call _MMU_PRINT_START and _MMU_PRINT_END manually
+ {% else %}
+ {% if printer.configfile.settings.mmu.happy_hare_version >= 2.5 %} ### _MMU_SEQUENCE_VARS overrides for HH v2.5 and higher
+ RESPOND MSG="The park_xy, travel_speed and lift_speed MMU's variables has been overrides to use Klippain ones!"
+ # RESPOND MSG="The park_xy, park_z_hop, travel_speed and lift_speed MMU's variables has been overridden to use Klippain ones!"
+ {% set Px, Py = printer["gcode_macro _USER_VARIABLES"].park_position_xy|map('int') %}
+ SET_GCODE_VARIABLE MACRO=_MMU_SEQUENCE_VARS VARIABLE=park_xy VALUE={Px},{Py}
+ # SET_GCODE_VARIABLE MACRO=_MMU_SEQUENCE_VARS VARIABLE=park_z_hop VALUE={printer["gcode_macro _USER_VARIABLES"].park_lift_z}
+ SET_GCODE_VARIABLE MACRO=_MMU_SEQUENCE_VARS VARIABLE=travel_speed VALUE={printer["gcode_macro _USER_VARIABLES"].travel_speed}
+ SET_GCODE_VARIABLE MACRO=_MMU_SEQUENCE_VARS VARIABLE=lift_speed VALUE={printer["gcode_macro _USER_VARIABLES"].z_drop_speed}
+ _MMU_RUN_MARKERS
+ {% elif printer.configfile.settings.mmu.happy_hare_version < 2.5 %}
+ RESPOND PREFIX='Warning:' MSG=" HappyHare <2.5 detected! Your version is deprecated in Klippain and its support will be dropped in the near future. Please update to HappyHare v2.5+"
+ {% if printer['gcode_macro _USER_VARIABLES'].mmu_force_homing_in_start_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_unload_on_cancel_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_unload_on_end_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_check_gates_on_start_print is not defined or printer['gcode_macro _USER_VARIABLES'].mmu_check_errors_on_start_print is not defined %}
+ { action_raise_error("MMU support is enabled in Klippain, but some variables are missing from your variables.cfg. Please update your template or refer to the corresponding documentation: https://github.com/Frix-x/klippain/blob/main/docs/mmu.md") }
+ {% elif printer["gcode_macro _USER_VARIABLES"].mmu_check_errors_on_start_print and printer.mmu.print_start_detection|int == 1 %}
+ RESPOND MSG="The HappyHare function to automatically detect the start and end of a print has been automatically disabled to allow early detection of an error during the Klippain START_PRINT sequence. This allow a more efficient debugging of the MMU. Refer to the Klippain MMU documentation"
+ MMU_TEST_CONFIG print_start_detection=0 # Override this value to disable the HappyHare auto detection of start and end of print in order to call _MMU_PRINT_START and _MMU_PRINT_END manually
+ {% endif %}
+ {% endif %}
{% endif %}
diff --git a/user_templates/mcu_defaults/toolhead/LDO_Picobilical_vA1.3.cfg b/user_templates/mcu_defaults/toolhead/LDO_Picobilical_vA1.3.cfg
new file mode 100644
index 000000000..02625ef6b
--- /dev/null
+++ b/user_templates/mcu_defaults/toolhead/LDO_Picobilical_vA1.3.cfg
@@ -0,0 +1,65 @@
+#-------------------------------------------------#
+#### LDO Picobilical Frame PCB A1.3 definition ####
+#-------------------------------------------------#
+
+[mcu toolhead]
+##--------------------------------------------------------------------
+serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path
+restart_method: command
+##--------------------------------------------------------------------
+
+# If you want to override the wiring of the LDO Picobilical, keep in mind that this
+# board is defined using the "toolhead" name. So you should use "pin: toolhead:PIN_NAME"
+# in your own overrides.cfg files.
+
+[include config/mcu_definitions/toolhead/LDO_Picobilical_vA1.3.cfg] # Do not remove this line
+[board_pins picobilical_mcu]
+mcu: toolhead
+aliases:
+ X_STOP=MCU_XES ,
+
+ RUNOUT_SENSOR=MCU_FS ,
+
+ E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_TH0 ,
+
+ PART_FAN=MCU_PCF , E_FAN=MCU_HEF ,
+
+ PB_PCB_TEMP=MCU_CT ,
+
+ # If you want to use both of the independent neopixel ports,
+ # LIGHT_NEOPIXEL is on the left when installed in a V0 and
+ # LIGHT_NEOPIXEL_2 is on the right. This can be useful for
+ # "Rainbow on a Matchstick" strips on opposite sides of the printer
+ LIGHT_NEOPIXEL=MCU_NEOPIXEL_1 , LIGHT_NEOPIXEL_2=MCU_NEOPIXEL_2
+
+#----------------------------------------#
+# LDO Picobilical vA1.3 pins remapping #
+#----------------------------------------#
+
+# These pins overrides are automatically added when you select a
+# toolhead MCU during the installation process. They should provide a
+# good base to work with. Feel free to adapt to your board if needed!
+
+[extruder]
+heater_pin: toolhead:E_HEATER
+sensor_pin: toolhead:E_TEMPERATURE
+pullup_resistor: 2200
+
+[fan]
+pin: toolhead:PART_FAN
+
+[heater_fan hotend_fan]
+pin: toolhead:E_FAN
+
+## Uncomment the following line if not using sensorless homing
+## and having the X endstop plugged to the toolhead MCU
+# [stepper_x]
+# endstop_pin: ^toolhead:X_STOP
+
+[temperature_sensor picobilical_temp]
+sensor_type: CMFB103F3950FANT
+sensor_pin: toolhead:PB_PCB_TEMP
+pullup_resistor: 2200
+min_temp: 0
+max_temp: 100
+
diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg
index 738bafea8..9db3d1afe 100644
--- a/user_templates/printer.cfg
+++ b/user_templates/printer.cfg
@@ -200,6 +200,8 @@
# [include config/hardware/accelerometers/adxl345_Fysetc_SB_Can_TH.cfg] # For ADXL plugged in Fysetc SB Can TH boards
# [include config/hardware/accelerometers/lis2dw_usb_rp2040_spi1.cfg] # For BTT S2DW V1.0, ...
+
+# [include config/hardware/accelerometers/beacon_accelerometer.cfg] # For Beacon Rev H make sure Beacon. Do not forget to include the beacon_virtual_probe in the PROBE section!
# ----------------------------------------------------------------------------------------