Skip to content

Commit 16f5ce4

Browse files
authored
Merge pull request #685 from Frix-x/main-backport
Backport main to develop
2 parents dc01ae0 + 280bca5 commit 16f5ce4

22 files changed

+284
-36
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This LIS2DW file is dedicated to be used with LIS2DW boards
2+
# connected over the software SPI bus of the MCU boards
3+
4+
# This include toolhead boards such as Mellow SHTv3 boards
5+
# If using a toolhead board, be sure to have the pin override in your mcu.cfg (toolhead:LIS2DW_CS)
6+
7+
[lis2dw]
8+
cs_pin: LIS2DW_CS
9+
spi_software_sclk_pin: LIS2DW_SCLK
10+
spi_software_mosi_pin: LIS2DW_MOSI
11+
spi_software_miso_pin: LIS2DW_MISO
12+
axes_map: x,y,z
13+
14+
[resonance_tester]
15+
accel_chip: lis2dw
16+
probe_points:
17+
-1,-1,-1
18+
19+
20+
# Include the IS calibration macros to unlock them when
21+
# an accelerometer is installed on the machine
22+
[include ../../../../macros/helpers/resonance_override.cfg]
23+
[include ../../../../scripts/K-ShakeTune/K-SnT_*.cfg]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[include generics/lis2dw_software_spi.cfg]
2+
3+
[lis2dw]
4+
cs_pin: toolhead:LIS2DW
5+
spi_software_sclk_pin: toolhead:SCK
6+
spi_software_mosi_pin: toolhead:MOSI
7+
spi_software_miso_pin: toolhead:MISO
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[board_pins mcu_manufacturer]
2+
aliases:
3+
MCU_M1_STEP=PA14, MCU_M1_DIR=PA10, MCU_M1_EN=PA13, MCU_M1_CS=PB8,
4+
MCU_M2_STEP=PC8, MCU_M2_DIR=PA15, MCU_M2_EN=PC14, MCU_M2_CS=PC9,
5+
MCU_M3_STEP=PD2, MCU_M3_DIR=PD4, MCU_M3_EN=PD3, MCU_M3_CS=PD0,
6+
MCU_M4_STEP=PD5, MCU_M4_DIR=PD6, MCU_M4_EN=PB3, MCU_M4_CS=PD1,
7+
MCU_M5_STEP=PB7, MCU_M5_DIR=PB6, MCU_M5_EN=PB4, MCU_M5_CS=PB5,
8+
9+
MCU_M1_STOP=PC4, MCU_M2_STOP=PB0, MCU_M3_STOP=PC6, MCU_M4_STOP=PC5, MCU_M5_STOP=PB1,
10+
11+
MCU_HE0=PB11 , MCU_HE1=PB10 ,
12+
13+
MCU_BED_OUT=PB2 ,
14+
15+
MCU_THB=PA3 , MCU_TH0=PA4 , MCU_TH1=PA5 ,
16+
17+
MCU_FAN0=PA8 , MCU_FAN1=PB15 , MCU_FAN2=PB14 ,
18+
19+
MCU_RGB1=PC7 ,
20+
21+
MCU_PROBE1=PA6 , MCU_PROBE2=PA7 ,
22+
23+
MCU_PS_ON=PA9 ,
24+
MCU_POWER_DET=PB9 ,
25+
26+
27+
MCU_SPI3_MOSI=PC12 , MCU_SPI3_MISO=PC11 , MCU_SPI3_SCK=PC10 , MCU_SPI3_CS=PC15 ,
28+
29+
30+
# EXP1 header
31+
EXP1_1=PC1 , EXP1_2=PC2 ,
32+
EXP1_3=PC3 , EXP1_4=RST ,
33+
EXP1_5=PC0 , EXP1_6=PA0 , # Slot in the socket on this side
34+
EXP1_7=PA2 , EXP1_8=PA1 ,
35+
EXP1_9=<GND> , EXP1_10=<5V> ,
36+
37+

config/mcu_definitions/main/BTT_Manta_M8P_v2.0.cfg

+11-10
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ aliases:
1818

1919
MCU_THB=PB1 , MCU_TH0=PB0 , MCU_TH1=PC5 , MCU_TH2=PC4 , MCU_TH3=PA7 ,
2020

21-
MCU_FAN0=PF7 , MCU_FAN1=PF9 , MCU_FAN2=PF6 , MCU_FAN3=PA8 , MCU_FAN4=PA4 ,
21+
MCU_FAN0=PF7 , MCU_FAN1=PF9 , MCU_FAN2=PF6 , MCU_FAN3=PF8 , MCU_FAN4=PA4 ,
2222
MCU_FAN5=PA6 , MCU_FAN5_TACH=PC2 ,
2323
MCU_FAN6=PA2 , MCU_FAN6_TACH=PC1 ,
2424

@@ -38,12 +38,13 @@ aliases:
3838
MCU_FWS1=PC0 , MCU_FWS=PF10 ,
3939

4040
# EXP ribbon
41-
EXP1_1=<5V> , EXP1_2=<G> ,
42-
EXP1_3=PF11 , EXP1_4=PF12 ,
43-
EXP1_5=PF13 , EXP1_6=PF14 ,
44-
EXP1_7=PF15 , EXP1_8=PG0 ,
45-
EXP1_9=PG1 , EXP1_10=PE7 ,
46-
EXP1_11=<RST> , EXP1_12=PE8 ,
47-
EXP1_13=PE14 , EXP1_14=PE10 ,
48-
EXP1_15=PE11 , EXP1_16=PE15 ,
49-
EXP1_17=PE12 , EXP1_18=PE13
41+
EXP1_1=PE7, EXP1_2=PG1,
42+
EXP1_3=PG0, EXP1_4=PF15,
43+
EXP1_5=PF14, EXP1_6=PF13,
44+
EXP1_7=PF12, EXP1_8=PF11,
45+
EXP1_9=<GND>, EXP1_10=<5V>,
46+
EXP2_1=PE13, EXP2_2=PE12,
47+
EXP2_3=PE15, EXP2_4=PE11,
48+
EXP2_5=PE10, EXP2_6=PE14,
49+
EXP2_7=PE8, EXP2_8=<RST>,
50+
EXP2_9=<GND>, EXP2_10=<NC>

config/mcu_definitions/toolhead/BTT_SB2209_RP2040_v1.0.cfg

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ aliases:
1010
MCU_HE0=gpio7 ,
1111
MCU_TH0=gpio27 ,
1212

13+
MCU_ONBOARD_NTCK100K=gpio28 ,
14+
1315
MCU_IND_FAN=gpio6 ,
1416
MCU_FAN1_PWM=gpio14 , MCU_FAN2_PWM=gpio13 ,
1517
MCU_4WFAN_TACH=gpio12 , MCU_4WFAN_PWM=gpio15 ,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[board_pins toolhead_manufacturer]
2+
mcu: toolhead
3+
aliases:
4+
MCU_EXT_EN=gpio14 , MCU_EXT_STEP=gpio7 , MCU_EXT_DIR=gpio6 , MCU_EXT_UART=gpio15 , MCU_EXT_DIAG= ,
5+
6+
MCU_LIMIT_0=gpio20 , MCU_LIMIT_1=gpio16 ,
7+
8+
MCU_PROBE_1=gpio22 , MCU_PROBE_2=gpio24 ,
9+
10+
MCU_FAN0=gpio13 , MCU_FAN1=gpio21 ,
11+
12+
MCU_TH0=gpio27 , MCU_PT100=gpio17 , MCU_TC0= ,
13+
14+
MCU_HE0=gpio23 ,
15+
16+
MCU_RGBLED=gpio26 ,
17+
18+
MCU_SW_SCK=gpio2 , MCU_SW_MISO=gpio4 , MCU_SW_MOSI=gpio3 ,
19+
MCU_LIS2DW_CS=gpio12 ,
20+
MCU_MAX31865_CS=gpio17 ,

docs/configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Klippain will work out of the box with most slicers on the market and your profi
4343
|[PrusaSlicer](https://github.com/prusa3d/PrusaSlicer)|`START_PRINT EXTRUDER_TEMP={first_layer_temperature[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]} INITIAL_TOOL={initial_extruder}`|
4444

4545
In addition, there are a few other optional parameters that are supported in Klippain (they must be added on the same line after the first parameters):
46-
- `CHAMBER=[chamber_temperature]` *(for SuperSlicer and OrcaSlicer)* or `CHAMBER=[idle_temperature]` *(for PrusaSlicer)* to set a target heatsoak temperature during the START_PRINT sequence.
46+
- `CHAMBER=[chamber_temperature]` to set a target heatsoak temperature during the START_PRINT sequence.
4747
- `TOTAL_LAYER=[total_layer_count]` to be able to set the PRINT_STATS_INFOS in Klipper. If you use this, you will also need to add the corresponding `SET_PRINT_STATS_INFO CURRENT_LAYER={layer_num}` to your slicer custom layer change gcode.
4848
- `TOOLS_USED=!referenced_tools!` *(only for MMU users)* is highly recommended to check only the used tools with the HappyHare [Moonraker gcode preprocessor](https://github.com/moggieuk/Happy-Hare/blob/main/doc/gcode_preprocessing.md).
4949
- `CHECK_GATES=0` or `1` *(only for MMU users)* that will override the corresponding variable defined in Klippain `variables.cfg` for this specific print.

docs/mmu.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ If you want to print without using the MMU features, you can use the MMU bypass
6565
1. Select the bypass mode with `MMU_SELECT_BYPASS`.
6666
1. Finally, manually insert the filament into the bowden tube up to the extruder gears and load the filament with the `MMU_LOAD` command or start the print (the `START_PRINT` sequence will automatically try to load the filament into the toolhead).
6767

68-
At the end of the print, you can use the `MMU_EJECT` command (if `variable_mmu_unload_on_end_print` is set to False in Klippain `variables.cfg`, otherwise it is ejected automatically) to unload the filament from the extruder and then manually pull it out of the bowden tube.
68+
At the end of the print, you can use the `MMU_UNLOAD` command (if `variable_mmu_unload_on_end_print` is set to False in Klippain `variables.cfg`, otherwise it is unloaded automatically) to unload the filament from the extruder and then manually pull it out of the bowden tube.
6969

7070
### Spoolman support with MMU
7171

macros/base/cancel_print.cfg

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,19 @@ gcode:
1414
{% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %}
1515
{% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %}
1616
{% set hotend_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].hotend_fan_tach_enabled %}
17-
17+
{% set retract_length = printer["gcode_macro _USER_VARIABLES"].retract_length|default(20)|float %}
18+
1819
PARK
1920

2021
{% if klippain_mmu_enabled and mmu_unload_on_cancel_print %}
2122
{% if printer.mmu.enabled and printer.mmu.tool|int != -2 %}
2223
# Unload filament and park the MMU
23-
MMU_EJECT
24+
MMU_UNLOAD
2425
{% endif %}
2526
{% elif printer.extruder.can_extrude %}
2627
# Pull back the filament a little bit
2728
G92 E0
28-
G1 E-10 F2100
29+
G1 E-{retract_length} F2100
2930
{% endif %}
3031

3132
{% if turn_off_heaters_in_end_print %}

macros/base/end_print.cfg

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ gcode:
1616
{% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %}
1717
{% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %}
1818
{% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %}
19+
{% set hotend_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].hotend_fan_tach_enabled %}
20+
{% set retract_length = printer["gcode_macro _USER_VARIABLES"].retract_length|default(20)|float %}
1921

2022
PARK
2123

@@ -103,7 +105,7 @@ gcode:
103105
{% elif printer.extruder.can_extrude %}
104106
# pull back the filament a little bit
105107
G92 E0
106-
G1 E-10 F2100
108+
G1 E-{retract_length} F2100
107109
{% endif %}
108110

109111
[gcode_macro _MODULE_TURN_OFF_HEATERS]

macros/base/homing/homing_override.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ gcode:
8989
{% endif %}
9090
G91
9191
G0 Z{homing_zhop} F{z_drop_speed}
92+
M400
9293
G90
9394
{% else %}
9495
{% if verbose %}

macros/base/pause_resume.cfg

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ description: Pause the print and park
44
gcode:
55
{% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %}
66
{% set light_intensity_start_print = printer["gcode_macro _USER_VARIABLES"].light_intensity_start_print %}
7+
{% set idle_timeout_on_pause = printer["gcode_macro _USER_VARIABLES"].idle_timeout_on_pause|default(0)|int %}
78
{% set turn_off_extruder = printer["gcode_macro _USER_VARIABLES"].turn_off_extruder_on_pause %}
89

910
{% if printer.pause_resume.is_paused %}
@@ -17,6 +18,10 @@ gcode:
1718
BASE_PAUSE
1819
PARK
1920

21+
{% if idle_timeout_on_pause > 0 %}
22+
SET_IDLE_TIMEOUT TIMEOUT={idle_timeout_on_pause}
23+
{% endif %}
24+
2025
{% if turn_off_extruder %}
2126
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=extruder_target_temp VALUE={printer.extruder.target}
2227
M104 S0
@@ -33,6 +38,7 @@ gcode:
3338
{% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %}
3439
{% set light_intensity_printing = printer["gcode_macro _USER_VARIABLES"].light_intensity_printing %}
3540
{% set klippain_mmu_enabled = printer["gcode_macro _USER_VARIABLES"].klippain_mmu_enabled %}
41+
{% set idle_timeout_on_pause = printer["gcode_macro _USER_VARIABLES"].idle_timeout_on_pause|default(0)|int %}
3642
{% set turn_off_extruder = printer["gcode_macro _USER_VARIABLES"].turn_off_extruder_on_pause %}
3743

3844
{% if not printer.pause_resume.is_paused %}
@@ -52,6 +58,10 @@ gcode:
5258
LIGHT_ON S={light_intensity_printing}
5359
{% endif %}
5460

61+
{% if idle_timeout_on_pause > 0%}
62+
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}
63+
{% endif %}
64+
5565
{% if turn_off_extruder and extruder_target_temp > 0 %}
5666
M109 S{extruder_target_temp|int}
5767
{% endif %}

macros/hardware_functions/mmu.cfg

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ gcode:
3838
RESPOND PREFIX='MMU info:' MSG="<span class="success"--text> You are planning a multi-filament print. The tool(s): {TOOLS_USED} will be checked to limit the risk of errors.</span>"
3939
{% endif %}
4040

41-
# First eject in case a bad tool is already loaded, then check the gates and select the initial tool
42-
MMU_EJECT
41+
# First unload in case a bad tool is already loaded, then check the gates and select the initial tool
42+
MMU_UNLOAD
4343
MMU_CHECK_GATE TOOLS={TOOLS_USED}
4444
MMU_SELECT TOOL={INITIAL_TOOL}
4545

@@ -53,8 +53,8 @@ gcode:
5353
{% endif %}
5454
{% endif %}
5555

56-
# First eject in case a bad tool is already loaded, then check the initial tool gate
57-
MMU_EJECT
56+
# First unload in case a bad tool is already loaded, then check the initial tool gate
57+
MMU_UNLOAD
5858
MMU_CHECK_GATE TOOLS={INITIAL_TOOL}
5959
{% endif %}
6060

@@ -118,7 +118,7 @@ gcode:
118118
{% endif %}
119119
{% else %}
120120
{% if printer.mmu.tool|int != INITIAL_TOOL %}
121-
MMU_EJECT
121+
MMU_UNLOAD
122122
MMU_SELECT TOOL={INITIAL_TOOL}
123123
MMU_PRELOAD
124124
{% endif %}

macros/helpers/nozzle_cleaning.cfg

+4-3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ gcode:
8181
{% set OOZE_TIME = params.OOZE_TIME|default(printer["gcode_macro _USER_VARIABLES"].purge_ooze_time)|int %}
8282
{% set TEMP = params.TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_extruder_temp)|float %}
8383
{% set Z_DROP = params.Z_DROP|default(1)|int %}
84+
{% set RETRACT = params.RETRACT|default(printer["gcode_macro _USER_VARIABLES"].retract_length)|default(20)|float %}
8485

8586
{% set purge_and_brush_enabled = printer["gcode_macro _USER_VARIABLES"].purge_and_brush_enabled %}
8687
{% set purgeclean_servo_enabled = printer["gcode_macro _USER_VARIABLES"].purgeclean_servo_enabled %}
@@ -119,8 +120,8 @@ gcode:
119120

120121
# Retract
121122
G92 E0
122-
G1 E-1.7 F2100
123-
G1 E-18.3 F150
123+
G1 E-{RETRACT * 0.1} F2100
124+
G1 E-{RETRACT - (RETRACT * 0.1)} F150
124125
G92 E0
125126

126127
# Wait some time to let the nozzle ooze before cleaning
@@ -172,4 +173,4 @@ gcode:
172173
{% endif %}
173174

174175
RESTORE_GCODE_STATE NAME=CONDITIONAL_MOVE_TO_PURGE_BUCKET_STATE
175-
{% endif %}
176+
{% endif %}

macros/helpers/prime_line.cfg

+11-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ gcode:
77
{% set prime_line_height = params.LINE_HEIGHT|default(printer["gcode_macro _USER_VARIABLES"].prime_line_height)|default(0.6)|float %}
88
{% set prime_line_adaptive = params.ADAPTIVE_MODE|default(1)|int %}
99
{% set prime_line_margin = params.LINE_MARGIN|default(printer["gcode_macro _USER_VARIABLES"].prime_line_margin)|default(5.0)|float %} # Used only in adaptive mode
10-
10+
{% set prime_line_unretract_length = printer["gcode_macro _USER_VARIABLES"].unretract_length|default(23)|float %}
11+
{% set prime_line_wipe = printer["gcode_macro _USER_VARIABLES"].prime_line_wipe|default(False) %}
12+
{% set prime_line_wipe_length = prime_line_length * 0.8 %}
13+
1114
# If the SIZE parameter is defined and not a dummy placeholder, we use it to do the adaptive bed mesh logic
1215
{% set coordinatesFound = false %}
1316
{% if params.SIZE is defined and params.SIZE != "0_0_0_0" %}
@@ -110,14 +113,20 @@ gcode:
110113

111114
# Add pressure in the nozzle
112115
G92 E0
113-
G1 E18 F300
116+
G1 E{prime_line_unretract_length} F300
114117

115118
# Prime line
116119
G92 E0
117120
{% if prime_line_direction == "X" %}
118121
G1 X{prime_line_x + prime_line_way*prime_line_length} E{prime_line_purge_distance} F{speed}
122+
{% if prime_line_wipe %}
123+
G0 X{prime_line_x + prime_line_way*prime_line_wipe_length} F{St}
124+
{% endif %}
119125
{% elif prime_line_direction == "Y" %}
120126
G1 Y{prime_line_y + prime_line_way*prime_line_length} E{prime_line_purge_distance} F{speed}
127+
{% if prime_line_wipe %}
128+
G0 Y{prime_line_y + prime_line_way*prime_line_wipe_length} F{St}
129+
{% endif %}
121130
{% else %}
122131
{ action_respond_error("Prime line direction is not valid. Choose either X or Y in the variables.cfg file!") }
123132
{% endif %}

macros/miscs/startup.cfg

+6
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,14 @@ gcode:
5353
gcode:
5454
{% if printer["gcode_macro _USER_VARIABLES"].status_leds_enabled or printer["gcode_macro _USER_VARIABLES"].status_leds_caselight_enabled %}
5555
{% if printer["gcode_macro _USER_VARIABLES"].caselight_on_at_startup|default(False) %}
56+
{% if printer["gcode_macro _USER_VARIABLES"].light_enabled %}
57+
LIGHT_ON
58+
{% endif %}
5659
STATUS_LEDS COLOR="READY"
5760
{% else %}
61+
{% if printer["gcode_macro _USER_VARIABLES"].light_enabled %}
62+
LIGHT_OFF
63+
{% endif %}
5864
STATUS_LEDS COLOR="OFF"
5965
{% endif %}
6066
{% endif %}

scripts/system_info.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
###### BASIC SYSTEM INFO SCRIPT ######
55
######################################
66
# Written by Frix_x#0161 #
7-
# @version: 1.0
7+
# @version: 1.1
88

99
# CHANGELOG:
1010
# v1.0: first version of the script to get some system info printed in the klippy.log
11+
# v1.1: fix get_ram_info, Fixed an issue where Available RAM was displayed in "Used RAM".
1112

1213

1314
# Be sure to make this script executable using SSH: type 'chmod +x ./system_info.py' when in the folder !
@@ -72,8 +73,8 @@ def get_os_kernel_info():
7273
def get_ram_info():
7374
try:
7475
total_ram = subprocess.check_output(['free', '-m'], universal_newlines=True).split('\n')[1].split()[1]
75-
available_ram = subprocess.check_output(['free', '-m'], universal_newlines=True).split('\n')[1].split()[6]
76-
return total_ram, available_ram
76+
used_ram = subprocess.check_output(['free', '-m'], universal_newlines=True).split('\n')[1].split()[2]
77+
return total_ram, used_ram
7778
except subprocess.CalledProcessError:
7879
return None, None
7980

@@ -112,12 +113,13 @@ def print_system_info():
112113
print(f"System information: {get_unknown_board_info()}")
113114

114115

115-
total_ram, available_ram = future_ram_info.result()
116-
if total_ram is None or available_ram is None:
116+
total_ram, used_ram = future_ram_info.result()
117+
if total_ram is None or used_ram is None:
117118
print("RAM information not found...")
118119
else:
119-
print(f"Available RAM: {available_ram}/{total_ram} MB")
120+
print(f"Used RAM: {used_ram}/{total_ram} MB")
120121

121122

122123
if __name__ == "__main__":
123124
print_system_info()
125+

0 commit comments

Comments
 (0)