viesturz / klipper-toolchanger

Toolcahnging extension for Klipper
GNU General Public License v3.0
49 stars 16 forks source link

mcu crashing mid print #9

Closed Marshalldog closed 2 months ago

Marshalldog commented 6 months ago

been having a weird issue and I think it may be related to the new updates. Screenshot 2024-01-26 170216 I previously had no issues and but since last week (or two weeks ago (not sure exactly)) the printer repeatedly crash mid print. moonraker (7).log klippy (7).log crowsnest (4).log

at the time of the crash the load spiked and then crashed (note the secomd toolhead was idle) mainboard image3 active toolhead board image2 inactive toolhead board image1

Marshalldog commented 6 months ago

Screenshot 2024-01-27 164807 printer.cfg


[include mainsail.cfg] #fixed for my setup
[include timelapse.cfg]
[exclude_object]

[include mcu.cfg]
#[include adxlmcu.cfg]

#my shit
[include FilaSenManagement.cfg]
#[include LEDManagement.cfg]

#[include KAMP/Adaptive_Meshing.cfg]
#[include KAMP/Line_Purge.cfg]] 

#[include leds.cfg]

[include tool_detection.cfg]
[include toolchanger.cfg]

[include T0-burner-dragon.cfg]
[include T1-Rapid-Burner.cfg]

[include homing.cfg]
[include calibrate-offsets.cfg]
[include macros.cfg]

#fix shit
## Add virtual_sdcard
[virtual_sdcard]
path: /home/pi/printer_data/gcodes
on_error_gcode: CANCEL_PRINT

### Add support for respond
[respond]

### Add support for pause_resume
[pause_resume]

### Add support for save variables
[save_variables]
filename:  ~/variables.cfg
[gcode_arcs]
#resolution: 1.0
#   An arc will be split into segments. Each segment's length will
#   equal the resolution in mm set above. Lower values will produce a
#   finer arc, but also more work for your machine. Arcs smaller than
#   the configured value will become straight lines. The default is
#   1mm.
resolution: 0.2

[rounded_path]
resolution: 0.2
#replace_g0: True
replace_g0: False

[printer] #fixed for my setup
kinematics: corexy
max_velocity: 300  
max_accel: 3000             #Max 4000
max_z_velocity: 15          #Max 15 for 12V TMC Drivers, can increase for 24V
max_z_accel: 350
square_corner_velocity: 5.0

[force_move] #fixed for my setup
enable_force_move: True 

#[ktamv] #fixed for my setup
#nozzle_cam_url: http://localhost/webcam2/snapshot?max_delay=0
#server_url: http://localhost:8085
#move_speed: 1800
#send_frame_to_cloud: true
#detection_tolerance: 0

[quad_gantry_level]
##  Gantry Corners for 350mm Build
gantry_corners:
    -70,-10
    420,410
#   Probe points
points:
    50,50
    50,300
    300,300
    300,50
#   Probe points
speed: 350
horizontal_move_z: 10
max_adjust: 20

[bed_mesh]
speed: 150
horizontal_move_z: 10
mesh_min: 20, 20
mesh_max: 320, 320
probe_count: 5,5

#[resonance_tester]
# accel_chip: adxl345
# probe_points:
#     175, 175, 20 

[input_shaper]
shaper_freq_x: 55.8
shaper_type_x: mzv
shaper_freq_y: 74.0
shaper_type_y: 3hump_ei

[gcode_macro _CLIENT_VARIABLE]
variable_use_custom_pos   : True ; use custom park coordinates for x,y [True/False]
variable_custom_park_x    : 175.0   ; custom x position; value must be within your defined min and max of X
variable_custom_park_y    : 300.0   ; custom y position; value must be within your defined min and max of Y
variable_custom_park_dz   : 2.0   ; custom dz value; the value in mm to lift the nozzle when move to park position
variable_retract          : 1.0   ; the value to retract while PAUSE
variable_cancel_retract   : 5.0   ; the value to retract while CANCEL_PRINT
variable_speed_retract    : 35.0  ; retract speed in mm/s
variable_unretract        : 1.0   ; the value to unretract while RESUME
variable_speed_unretract  : 35.0  ; unretract speed in mm/s
variable_speed_hop        : 15.0  ; z move speed in mm/s
variable_speed_move       : 100.0 ; move speed in mm/s
variable_park_at_cancel   : True ; allow to move the toolhead to park while execute CANCEL_PRINT [True/False]
variable_park_at_cancel_x : 175.0  ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True
variable_park_at_cancel_y : 300.0  ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True
# !!! Caution [firmware_retraction] must be defined in the printer.cfg if you set use_fw_retract: True !!!
variable_use_fw_retract   : False ; use fw_retraction instead of the manual version [True/False]
variable_idle_timeout     : 0     ; time in sec until idle_timeout kicks in. Value 0 means that no value will be set or restored
gcode:

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 39.480
#*# pid_ki = 1.393
#*# pid_kd = 279.814
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 37.715
#*# pid_ki = 5.466
#*# pid_kd = 65.059
#*#
#*# [extruder1]
#*# control = pid
#*# pid_kp = 23.728
#*# pid_ki = 1.738
#*# pid_kd = 80.972
#*#
#*# [bed_mesh T0100C]
#*# version = 1
#*# points =
#*#     0.127496, 0.163746, 0.199996, 0.196246, 0.146246
#*#     0.038746, 0.052496, 0.083746, 0.072496, 0.024996
#*#     -0.040004, -0.016254, -0.002504, -0.013754, -0.057504
#*#     -0.012504, 0.013746, 0.064996, 0.038746, -0.022504
#*#     0.154996, 0.158746, 0.176246, 0.172496, 0.107496
#*# x_count = 5
#*# y_count = 5
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = lagrange
#*# tension = 0.2
#*# min_x = 20.0
#*# max_x = 320.0
#*# min_y = 20.0
#*# max_y = 320.0
#*#
#*# [bed_mesh T055C]
#*# version = 1
#*# points =
#*#       0.164887, 0.172387, 0.193637, 0.188637, 0.128637
#*#       0.067387, 0.073637, 0.092387, 0.069887, 0.037387
#*#       -0.005113, 0.026137, 0.032387, 0.018637, -0.011363
#*#       0.038637, 0.034887, 0.076137, 0.046137, 0.021137
#*#       0.096137, 0.116137, 0.142387, 0.119887, 0.099887
#*# x_count = 5
#*# y_count = 5
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = lagrange
#*# tension = 0.2
#*# min_x = 20.0
#*# max_x = 320.0
#*# min_y = 20.0
#*# max_y = 320.0

mcu.cfg

#close to fixed, minor adjustments

[mcu] #updated for my setup
##  Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify
##--------------------------------------------------------------------
serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_530027000551313133353932-if00
restart_method: command
##--------------------------------------------------------------------
[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100

[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100

## X Stepper on Motor1(B Motor)
[stepper_x] #fixed????
step_pin: PF13 #fixed for my setup
dir_pin: PF12 #fixed for my setup
enable_pin: !PF14 #fixed for my setup
microsteps: 32 #fixed for my setup
rotation_distance: 40 #fixed for my setup
full_steps_per_rotation:400  #set to 200 for 1.8 degree stepper
#endstop_pin: ^PF3
endstop_pin: tmc2209_stepper_x:virtual_endstop #fixed for my setup
position_min: -0.2
position_endstop: 350.4
position_max: 350.4
homing_speed: 20 #was 40
second_homing_speed: 10 #was 20
homing_retract_dist: 0
homing_positive_dir: true

[tmc2209 stepper_x]
uart_pin: PC4 #fixed for my setup
interpolate: false #fixed for my setup
run_current: 0.8 #fixed for my setup
sense_resistor: 0.110 #fixed for my setup
stealthchop_threshold: 0 #fixed for my setup
diag_pin: ^PG6 #fixed for my setup
driver_SGTHRS: 95 #fixed for my setup (I think) #was 80

## Y Stepper on Motor2 (A Motor)
[stepper_y]
step_pin: PG0 #fixed for my setup
dir_pin: PG1 #fixed for my setup
enable_pin: !PF15 #fixed for my setup
microsteps: 32 #fixed for my setup

rotation_distance: 40 #fixed for my setup
full_steps_per_rotation:400  #set to 200 for 1.8 degree stepper
endstop_pin: PG9 #fixed for my setup
position_min: -9.5
position_endstop: 350
position_max: 350
homing_speed: 40
second_homing_speed: 20
homing_retract_dist: 5 #fixed for my setup
homing_positive_dir: true #fixed for my setup

##  Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_y]
uart_pin: PD11 #fixed for my setup
interpolate: false #fixed for my setup
run_current: 0.8 #fixed for my setup
sense_resistor: 0.110 #fixed for my setup
stealthchop_threshold: 0 #fixed for my setup

#####################################################################
#   Z Stepper Settings
#####################################################################

## Z0 Stepper - Front Left on MOTOR3_A
[stepper_z]
step_pin: PF11 #fixed for my setup
dir_pin: PG3 #fixed for my setup
enable_pin: !PG5 #fixed for my setup
rotation_distance: 40 #fixed for my setup
gear_ratio: 80:16 #fixed for my setup
microsteps: 32 #fixed for my setup
endstop_pin: probe:z_virtual_endstop
position_max: 351
position_min: -10
homing_speed: 20
second_homing_speed: 3
homing_retract_dist: 3

##  Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z] #fixed for my setup
uart_pin: PC6
interpolate: false
run_current: 0.8 #was 0.8
sense_resistor: 0.110
stealthchop_threshold: 999999

##  Z1 Stepper - Rear Left on Motor4
[stepper_z1] #fixed for my setup
step_pin: PG4
dir_pin: !PC1
enable_pin: !PA0
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32

##  Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z1] #fixed for my setup
uart_pin: PC7
interpolate: false
run_current: 0.8 #was 0.8
sense_resistor: 0.110
stealthchop_threshold: 999999

##  Z2 Stepper - Rear Right on Motor5
[stepper_z2]  #fixed for my setup
step_pin: PF9
dir_pin: PF10
enable_pin: !PG2
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32

##  Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z2] #fixed for my setup
uart_pin: PF2
interpolate: false
run_current: 0.8 #was 0.8
sense_resistor: 0.110
stealthchop_threshold: 999999

##  Z3 Stepper - Front Right on Motor6
[stepper_z3] #fixed for my setup
step_pin: PC13
dir_pin: !PF0
enable_pin: !PF1
rotation_distance: 40
gear_ratio: 80:16
microsteps: 32

##  Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 stepper_z3] #fixed for my setup
uart_pin: PE4
interpolate: false
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 999999

[heater_bed]
heater_pin: PA2 #fixed for my setup
sensor_type: ATC Semitec 104NT-4-R025H42G #fixed for my setup
sensor_pin: PF3 #fixed for my setup
max_power: 0.6 #fixed for my setup
min_temp: 0 #fixed for my setup
max_temp: 120 #fixed for my setup
#control: pid (not mine)
#pid_Kp=66.767 (not mine)
#pid_Ki=1.584 (not mine)
#pid_Kd=703.553 (not mine)

#[bed_thermal_adjust]
#chamber_temperature_sensor: temperature_sensor chamber
#temperature_drop_per_degree: 0.20

# [temperature_sensor buildplate]
# sensor_type: Generic 3950
# sensor_pin: PA1
# min_temp: -10
# max_temp: 120

#[temperature_fan buildplate]
#pin: PC12
#control: watermark
#target_temp: 60
#max_power: 0.6
#kick_start_time: 0.5
#shutdown_speed: 0

#sensor_type: Generic 3950
#sensor_pin: PA1
#min_temp: -10
#max_temp: 120

#[temperature_sensor chamber]
#sensor_type: Generic 3950
#sensor_pin: PA2
#min_temp: -10
#max_temp: 100

#[temperature_sensor PI]
#sensor_type: temperature_host

#[multi_pin controller_fans]
#pins: PE6,PE0

#[controller_fan case]
##  Controller fan
#pin: multi_pin:controller_fans
#heater:  
#max_power: 1.0
#fan_speed: 1.0
#kick_start_time: 0.5
[controller_fan controller_fan] #fixed for my setup
pin: PD12
kick_start_time: 0.5
heater: heater_bed
fan_speed: 0.5

[heater_fan nevermore] #fixed for my setup
pin: PD13
max_power: 1.0
shutdown_speed: 0.0
kick_start_time: 5.0
heater: heater_bed
heater_temp: 60
fan_speed: 1.0

[output_pin caselight] #fixed for my setup
## Chamber Lighting - CNC_FAN5
pin: PD15
pwm:true
shutdown_value: 0
value:0
cycle_time: 0.01

[board_pins] #updated for my setup
aliases:
    # EXP1 header
    EXP1_1=PE8, EXP1_2=PE7,
    EXP1_3=PE9, EXP1_4=PE10,
    EXP1_5=PE12, EXP1_6=PE13,    # Slot in the socket on this side
    EXP1_7=PE14, EXP1_8=PE15,
    EXP1_9=<GND>, EXP1_10=<5V>,

    # EXP2 header
    EXP2_1=PA6, EXP2_2=PA5,
    EXP2_3=PB1, EXP2_4=PA4,
    EXP2_5=PB2, EXP2_6=PA7,      # Slot in the socket on this side
    EXP2_7=PC15, EXP2_8=<RST>,
    EXP2_9=<GND>, EXP2_10=<5V>

include T0-burner-dragon.cfg

# This file contains common pin mappings for the BIGTREETECH EBBCan
# Canbus board. To use this config, the firmware should be compiled for the
# STM32G0B1 with "8 MHz crystal" and "USB (on PA11/PA12)" or "CAN bus (on PB0/PB1)".
# The "EBB Can" micro-controller will be used to control the components on the nozzle.

# See docs/Config_Reference.md for a description of parameters.

[mcu et0]
canbus_uuid:735a10a9ce3c

[extruder]
step_pin: et0:PD0
dir_pin: et0:PD1 #was !et0:PD1
enable_pin: !et0:PD2
microsteps: 32
#full_steps_per_rotation: 200
rotation_distance: 34.433 # 34.777
gear_ratio: 7.5:1 
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: et0:PB13
sensor_type: ATC Semitec 104NT-4-R025H42G
sensor_pin: et0:PA3
#spi_bus: spi1
#rtd_nominal_r: 100
#rtd_reference_r: 430
#rtd_num_of_wires: 2
#control: pid
#pid_Kp=28.698
#pid_Ki=1.952
#pid_Kd=105.465
min_temp: -10
max_temp: 300
min_extrude_temp: 180
pressure_advance: 0.1 #0.035                                               # See tuning pressure advance doc
pressure_advance_smooth_time: 0.040

[tmc2209 extruder]
uart_pin: et0:PA15
run_current: 0.45
hold_current: 0.1
sense_resistor: 0.11
driver_TPOWERDOWN: 20
stealthchop_threshold: 0

[multi_fan T0_partfan]
pin: et0:PA1

[heater_fan T0_hotend_fan]
pin: et0:PA0
heater: extruder
heater_temp: 50.0

#[adxl345]
#cs_pin: et0:PB12
#spi_software_sclk_pin: et0:PB10
#spi_software_mosi_pin: et0:PB11
#spi_software_miso_pin: et0:PB2
#axes_map: x,z,y

[gcode_macro T0]
variable_color: ""
gcode:
  SELECT_TOOL T=0

[tool T0]
tool_number: 0
extruder: extruder
params_type = 'rods_mini_hookon'
fan: multi_fan T0_partfan
gcode_x_offset: 0
gcode_y_offset: 0
gcode_z_offset: 0
params_park_x: 293.7
params_park_y: -5.5
params_park_z: 346.76 #346.85 #346.75
params_input_shaper_freq_x: 55.8
params_input_shaper_freq_y: 74.0

[tool_probe T0]
pin: et0:PB6 #correct
tool: 0
z_offset: -0.328 #-0.288 #-0.348 #was -0.948
speed: 5.0
samples: 3
samples_result: median
sample_retract_dist: 2.0
samples_tolerance: 0.02
samples_tolerance_retries: 3
activate_gcode:
    _TAP_PROBE_ACTIVATE HEATER=extruder

## RGB
[neopixel LED_T0]
pin: et0:PD3
chain_count: 3
color_order: GRBW
initial_RED: 1
initial_GREEN: 0.0
initial_BLUE: 0.0

[filament_switch_sensor filament_sensor_t0]
pause_on_runout: True
#   When set to True, a PAUSE will execute immediately after a runout
#   is detected. Note that if pause_on_runout is False and the
#   runout_gcode is omitted then runout detection is disabled. Default
#   is True.
runout_gcode:
#   A list of G-Code commands to execute after a filament runout is
#   detected. See docs/Command_Templates.md for G-Code format. If
#   pause_on_runout is set to True this G-Code will run after the
#   PAUSE is complete. The default is not to run any G-Code commands.
insert_gcode:
#   A list of G-Code commands to execute after a filament insert is
#   detected. See docs/Command_Templates.md for G-Code format. The
#   default is not to run any G-Code commands, which disables insert
#   detection.
event_delay: 3.0
#   The minimum amount of time in seconds to delay between events.
#   Events triggered during this time period will be silently
#   ignored. The default is 3 seconds.
pause_delay: 0.5
#   The amount of time to delay, in seconds, between the pause command
#   dispatch and execution of the runout_gcode. It may be useful to
#   increase this delay if OctoPrint exhibits strange pause behavior.
#   Default is 0.5 seconds.
switch_pin: et0:PB8 #or PB9
#   The pin on which the switch is connected. This parameter must be
#   provided.

include T1-Rapid-Burner.cfg

# This file contains common pin mappings for the BIGTREETECH EBBCan
# Canbus board. To use this config, the firmware should be compiled for the
# STM32G0B1 with "8 MHz crystal" and "USB (on PA11/PA12)" or "CAN bus (on PB0/PB1)".
# The "EBB Can" micro-controller will be used to control the components on the nozzle.

# See docs/Config_Reference.md for a description of parameters.

[mcu et1]
canbus_uuid: df84c43a3810

[extruder1]
step_pin: et1:PD0
dir_pin: et1:PD1 #was  !et1:PD1
enable_pin: !et1:PD2
microsteps: 32
rotation_distance: 34.433 # 34.777
gear_ratio: 7.5:1
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: et1:PB13
sensor_type: MAX31865
sensor_pin: et1:PA4

spi_bus: spi1
rtd_nominal_r: 100
rtd_reference_r: 430
rtd_num_of_wires: 2
max_extrude_only_distance: 100

#control: pid
#pid_Kp=21.499
#pid_Ki=1.078
#pid_Kd=107.228
min_temp: 0
max_temp: 350
min_extrude_temp: 180
pressure_advance: 0.035                                               # See tuning pressure advance doc
pressure_advance_smooth_time: 0.040

[tmc2209 extruder1]
uart_pin: et1:PA15
run_current: 0.5
sense_resistor: 0.11
hold_current: 0.1
stealthchop_threshold: 0

[multi_fan T1_partfan]
pin: et1:PA1

[heater_fan T1_hotend_fan]
pin: et1:PA0
heater: extruder1
heater_temp: 50.0

[temperature_sensor chamber_temp] #n 
## Chamber Temperature - T1
sensor_type: ATC Semitec 104NT-4-R025H42G #n 
sensor_pin: et1: PA3 #n 
min_temp: 0 #n 
max_temp: 100 #n 
gcode_id: chamber_th #n 

# [adxl345]
# cs_pin: et1:PB12
# spi_software_sclk_pin: et1:PB10
# spi_software_mosi_pin: et1:PB11
# spi_software_miso_pin: et1:PB2
# axes_map: z,-y,x

[gcode_macro T1]
variable_color: ""
gcode:
  SELECT_TOOL T=1

[tool T1]
tool_number: 1
extruder: extruder1
fan: multi_fan T1_partfan
gcode_x_offset: -0.531250
gcode_y_offset: 0.275000
gcode_z_offset: 0.3
params_park_x: 56.92
params_park_y: -5.8
params_park_z: 346.66  #346.75 #346.650 #346.050

[tool_probe T1]
pin: et1:PB6
tool: 1
z_offset:  -0.75 #-0.80
speed: 5.0
samples: 3
samples_result: median
sample_retract_dist: 2.0
samples_tolerance: 0.02
samples_tolerance_retries: 3

activate_gcode:
    _TAP_PROBE_ACTIVATE HEATER=extruder1

## RGB
[neopixel LED_T1]
pin: et1:PD3
chain_count: 3
color_order: GRBW
initial_RED: 1
initial_GREEN: 0.0
initial_BLUE: 0.0

[filament_switch_sensor filament_sensor_t1]
pause_on_runout: True
#   When set to True, a PAUSE will execute immediately after a runout
#   is detected. Note that if pause_on_runout is False and the
#   runout_gcode is omitted then runout detection is disabled. Default
#   is True.
runout_gcode:
#   A list of G-Code commands to execute after a filament runout is
#   detected. See docs/Command_Templates.md for G-Code format. If
#   pause_on_runout is set to True this G-Code will run after the
#   PAUSE is complete. The default is not to run any G-Code commands.
insert_gcode:
#   A list of G-Code commands to execute after a filament insert is
#   detected. See docs/Command_Templates.md for G-Code format. The
#   default is not to run any G-Code commands, which disables insert
#   detection.
event_delay: 3.0
#   The minimum amount of time in seconds to delay between events.
#   Events triggered during this time period will be silently
#   ignored. The default is 3 seconds.
pause_delay: 0.5
#   The amount of time to delay, in seconds, between the pause command
#   dispatch and execution of the runout_gcode. It may be useful to
#   increase this delay if OctoPrint exhibits strange pause behavior.
#   Default is 0.5 seconds.
switch_pin: et1:PB8 #or PB9
#   The pin on which the switch is connected. This parameter must be
#   provided.

include tool_detection.cfg

[tool_probe_endstop]
  crash_gcode:
    RESPOND TYPE=error MSG='Tool not detected, expected {printer.toolchanger.tool_number}. Pausing the print.' 
    M84
    TURN_OFF_HEATERS

toolchanger.cfg

[toolchanger]
  t_command_restore_axis: Z
  params_safe_y: 120
  params_close_y: 15  
  params_fast_speed: 30000 # Go as fast as we can
  params_path_speed: 900 # 20mm/s for the actual change
  params_type = 'rods_mini'   # See available paths below
  # The dropoff path of each tool type, pickup path is the same in reverse.
  params_pads_mini_path: [{'y':9 ,'z':2}, {'y':8, 'z':0}, {'y':0, 'z':0, 'f':0.5},{'y':0, 'z':-5}, {'y':1, 'z':-7}, {'y':3, 'z':-9}, {'y':7,'z':-11}]
  params_pads_sb_path: [{'y':9.5 ,'z':8}, {'y':9.5, 'z':2}, {'y':5.5, 'z':0}, {'y':0, 'z':0, 'f':0.5},{'y':0, 'z':-5}, {'y':1, 'z':-7}, {'y':3, 'z':-9}, {'y':7,'z':-11}]
  params_rods_mini_path: [{'z':0, 'y':4}, {'z':0, 'y':0, 'f':0.5}, {'z':-6, 'y':0}, {'z':-10, 'y':3}, {'z':-10, 'y':16}]
  params_rods_sb_path: [{'y':9.5 ,'z':8}, {'y':9.5, 'z':2}, {'y':5.5, 'z':0}, {'z':0, 'y':0, 'f':0.5}, {'z':-6, 'y':0}, {'z':-10, 'y':3}, {'z':-10, 'y':16}]
  params_rods_mini_hookon_path: [{'z':0, 'y':4}, {'z':0, 'y':0, 'f':0.5}, {'z':-7.3, 'y':0}, {'z':-12.3, 'y':3.5}, {'z':-12.3, 'y':16}]
  # Parking position - per tool
  #params_park_x = 142.2
  #params_park_y = -6.0
  #params_park_z = 308.2
  # Default shaper params
  params_input_shaper_freq_x: 62.4
  params_input_shaper_freq_y: 88.6
  initialize_on: manual
  initialize_gcode:
    DISABLE_ALL_FILA_SENSE
    DETECT_ACTIVE_TOOL_PROBE
    _INITIALIZE_FROM_DETECTED_TOOL
    ENABLE_CUR_FILA_SENSE

  before_change_gcode:
    DISABLE_CUR_FILA_SENSE
    {% set tn = "T"+(tool.tool_number|string) %}
    {% if printer["gcode_macro " + tn ] %}
       SET_GCODE_VARIABLE MACRO={tn} VARIABLE=color VALUE="''"
    {% endif %}

  after_change_gcode: 
    {% set tn = "T"+(tool.tool_number|string) %}
    {% if printer["gcode_macro " + tn ] %}
       SET_GCODE_VARIABLE MACRO={tn} VARIABLE=color VALUE="'c44'"
    {% endif %}    
    {% if tool.params_input_shaper_freq_x %}
      SET_INPUT_SHAPER SHAPER_FREQ_X={tool.params_input_shaper_freq_x} SHAPER_FREQ_Y={tool.params_input_shaper_freq_y}
    {% endif %}
    ENABLE_CUR_FILA_SENSE

  dropoff_gcode:
    {% set x = tool.params_park_x|float %} 
    {% set y = tool.params_park_y|float %} 
    {% set z = tool.params_park_z|float %} 
    {% set fast = tool.params_fast_speed|float %}
    {% set path = tool['params_' ~ tool.params_type ~ '_path'] %}
    {% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
    {% set cur_z = printer.toolhead.position[2]|float %}
    RESPOND TYPE=echo MSG='Dropping off {tool.name}'
    G90
    ; Move 1 mm up to avoid crashing into things
    G0 Z{ [cur_z+1.0, max_z]|min } F{fast}    
    #   ##############  Move up to the dock  ##############    
    ROUNDED_G0 Y={tool.params_safe_y} D=20 F={fast}
    ROUNDED_G0 X={x} D=150 F={fast}
    ROUNDED_G0 Z={z + path[0]['z']|float} D=20 F={fast}
    ROUNDED_G0 Y={y + path[0]['y']|float} D=0 F={fast}
    STOP_TOOL_PROBE_CRASH_DETECTION
    #  ############## Run the path ##############
    {% for pos in path %}
        G0 Y{y + pos['y']|float} Z{z + pos['z']|float} F{tool.params_path_speed|float * (pos.get('f', 1.0)|float) }
    {% endfor %}

  pickup_gcode:
    {% set x = tool.params_park_x|float %} 
    {% set y = tool.params_park_y|float %} 
    {% set z = tool.params_park_z|float %} 
    {% set fast = tool.params_fast_speed|float %}
    {% set path = tool['params_' ~ tool.params_type ~ '_path'] %}
    RESPOND TYPE=echo MSG='Picking up {tool.name}'
    G90
    #   ##############  Fast to the last point  ##############
    ROUNDED_G0 Y={tool.params_close_y} F={fast} D=5
    ROUNDED_G0 X={x} Z={z + path[-1]['z']|float} F={fast} D=5
    ROUNDED_G0 Y={y + path[-1]['y']|float} F={fast} D=0
    # Wait for temp before actually picking up the tool, while the nozzle is resting on it's pad.

    {% if tool.extruder %}
      M109 T{tool.tool_number} S{printer[tool.extruder].target|int}
    {% endif %}
    # Run the path in reverse
    {% for pos in path|reverse %}
      G0 Y{y + pos['y']|float} Z{z + pos['z']|float} F{tool.params_path_speed|float * (pos.get('f', 1.0)|float) }      
      {% if 'f' in pos %} # Use the f presence as marker that we have made contact with the tool.
        START_TOOL_PROBE_CRASH_DETECTION T={tool.tool_number}
      {% endif %}
    {% endfor %}
    # Restore the position with smooth rounded move.
    ROUNDED_G0 Y={tool.params_safe_y} F={fast} D=20
    {% if 'Z' in restore_position %}
      ROUNDED_G0 Z={restore_position.Z} F={fast} D=150
    {% endif %}
    {% if 'X' in restore_position %}
      ROUNDED_G0 X={restore_position.X} F={fast} D=1000
    {% endif %}
    {% if 'Y' in restore_position %}
      ROUNDED_G0 Y={restore_position.Y} F={fast} D=0
    {% endif %}
    ROUNDED_G0 D=0

[gcode_macro _INITIALIZE_FROM_DETECTED_TOOL]
gcode:
  {% if printer.tool_probe_endstop.active_tool_number | int == -1 %} 
    RESPOND TYPE=error MSG='Failed to detect active tool'
    PAUSE
  {% else %}
    INITIALIZE_TOOLCHANGER T={printer.tool_probe_endstop.active_tool_number}
  {% endif %}    

[gcode_macro TOOL_ALIGN_START]
gcode:    
    INITIALIZE_TOOLCHANGER # Detect current tool
    _TOOL_ALIGN_START

[gcode_macro _TOOL_ALIGN_START]
gcode:
    STOP_TOOL_PROBE_CRASH_DETECTION
    {% set tool = printer[printer.toolchanger.tool] %}
    SET_TOOL_PARAMETER PARAMETER='params_path_speed' VALUE=300
    SET_GCODE_OFFSET X=0 Y=0 Z=0
    G0 Y{tool.params_safe_y} F{tool.params_fast_speed}
    G0 X{tool.params_park_x} Z{tool.params_park_z}
    G0 Y{tool.params_park_y|float + 100.0}

[gcode_macro TOOL_ALIGN_TEST]
gcode:
    {% set curpos = printer.gcode_move.gcode_position %}
    {% if curpos[1] > 0 %} 
      # Check if Y is not too far, to very unrealistic tests.
      RESPOND TYPE=error MSG='Test aborted. Tool too far away from the dock.'
    {% else %}
      INITIALIZE_TOOLCHANGER # Detect current tool
      STOP_TOOL_PROBE_CRASH_DETECTION
      SET_TOOL_PARAMETER PARAMETER='params_park_x' VALUE={curpos[0]}
      SET_TOOL_PARAMETER PARAMETER='params_park_y' VALUE={curpos[1]}
      SET_TOOL_PARAMETER PARAMETER='params_park_z' VALUE={curpos[2]}
      TEST_TOOL_DOCKING RESTORE_AXIS=XYZ
      STOP_TOOL_PROBE_CRASH_DETECTION
    {% endif %}

[gcode_macro TOOL_ALIGN_DONE]
gcode:
    {% set tool = printer[printer.toolchanger.tool] %}
    SAVE_TOOL_PARAMETER PARAMETER='params_park_x'
    SAVE_TOOL_PARAMETER PARAMETER='params_park_y'
    SAVE_TOOL_PARAMETER PARAMETER='params_park_z'
    RESET_TOOL_PARAMETER PARAMETER='params_path_speed'
    G0 Y{tool.params_safe_y} F{tool.params_fast_speed}

[gcode_macro M104]
rename_existing: M104.1
description: [T<index>] [S<temperature>]
  Set tool temperature.
  T= Tool number, optional. If this parameter is not provided, the current tool is used.
  S= Target temperature
gcode:
  {% if params.T is defined %}
    {% set newparameters = " T="~params.T %}
    {% if params.S is defined %}
      {% set newparameters = newparameters ~ " TARGET="~params.S %}
    {% endif %}
    SET_TOOL_TEMPERATURE{newparameters}
  {% else %}
    M104.1 {rawparams}
  {% endif %}

[gcode_macro M109]
rename_existing: M109.1
description: [T<index>] [S<temperature>]
  Set tool temperature and wait.
  T= Tool number, optional. If this parameter is not provided, the current tool is used.
  S= Target temperature
gcode:
  {% if params.T is defined %}
    {% set newparameters = " T="~params.T %}
    {% if params.S is defined %}
      {% set newparameters = newparameters ~ " TARGET="~params.S %}
    {% endif %}
    SET_TOOL_TEMPERATURE WAIT=1 {newparameters}
  {% else %}
    M109.1 {rawparams}
  {% endif %}
Marshalldog commented 6 months ago

i even tried a completely new os image i installed 32bit lite, then used Kiauh to install the essentials and then installed klipper tool changer and this error still occurs mid print

Marshalldog commented 6 months ago

i've done a ton of testing on the canbus stuff and I'm pretty sure its not canbus

Marshalldog commented 6 months ago

The thing is I can replicate this on another Pi (with a fresh install) with 100% reliability

Surion79 commented 6 months ago

do you use both toolheads? maybe try it with one single Toolhead and then the other toolhead only to see if it is an issue with a toolhead? just an idea about process of elimination

viesturz commented 4 months ago

Can you still replicate with Klipper 0.12? Have not seen any issues around this. The toolchanger itslef is very light weight and only runs code on tool changes.