Skip to content

Commit

Permalink
Happy hare v2.5 merge (#8)
Browse files Browse the repository at this point in the history
* make Klippain compatible with HH v2.5

* start print for HH > v2.5

* move HHv2.5 init in _KLIPPAIN_MMU_INIT

* add some info in mmu.md for 2.5

* add sync fonction with HH>2.5

* add eject slicer option for HH>2.5

* typo error

* Update end_print.cfg

Change EJECT to boolean for MMU_END

* show HH version on startup

* added custom4..9 in start_print (Frix-x#539)

* updated beeper sections (Frix-x#549)

by switching to pwm_cycle_time instead of output pin

* removed M204 in favor of SET_VELOCITY_LIMIT (Frix-x#555)

* support for LDO Picobilical (Frix-x#533)

* removed M204 for SET_VELOCITY_LIMIT (Frix-x#554)

* removed last M204 for SET_VELOCITY_LIMIT (Frix-x#553)

* added Beacon accelerometer support (Frix-x#552)

* deprecate HH<v2.5 and small typos

* removed old artifacts from TMC2240 init feature

Please use https://github.com/andrewmcgr/klipper_tmc_autotune instead!

* error on changes in _INIT_CHECK_MMU

---------

Co-authored-by: Benoitone <63300355+Benoitone@users.noreply.github.com>
Co-authored-by: Félix Boisselier <felix@fboisselier.fr>
Co-authored-by: Jan-Gerrit Drexhage <102791900+Surion79@users.noreply.github.com>
Co-authored-by: Colten Edwards <cd.edwards@sasktel.net>
Co-authored-by: Nick Danyluk <ndanyluk7@gmail.com>
Co-authored-by: Svennixx <xsvenhd@hotmail.com>
  • Loading branch information
7 people authored Mar 21, 2024
1 parent 10183c0 commit bdeb902
Show file tree
Hide file tree
Showing 22 changed files with 510 additions and 188 deletions.
13 changes: 13 additions & 0 deletions config/hardware/accelerometers/beacon_accelerometer.cfg
Original file line number Diff line number Diff line change
@@ -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]
6 changes: 5 additions & 1 deletion config/hardware/displays/BTT_mini12864.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion config/hardware/displays/BTT_mini12864_inversed.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion config/hardware/displays/Fysetc_mini12864.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion config/hardware/displays/Fysetc_mini12864_inversed.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion config/hardware/displays/Fysetc_mini12864_v1.2_v2.0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions config/mcu_definitions/toolhead/LDO_Picobilical_vA1.3.cfg
Original file line number Diff line number Diff line change
@@ -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 ,
38 changes: 34 additions & 4 deletions docs/mmu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
20 changes: 16 additions & 4 deletions macros/base/cancel_print.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 %}
Expand All @@ -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!"
13 changes: 11 additions & 2 deletions macros/base/end_print.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion macros/base/homing/homing_override.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 25 additions & 4 deletions macros/base/pause_resume.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}


Expand All @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions macros/base/probing/dockable_probe.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion macros/base/probing/overrides/qgl.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
2 changes: 1 addition & 1 deletion macros/base/probing/overrides/z_tilt.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}

Expand Down
Loading

0 comments on commit bdeb902

Please sign in to comment.