Skip to content

Commit

Permalink
Merge pull request #209 from stereotech/STEAPP-571
Browse files Browse the repository at this point in the history
STEAPP-571, STEAPP-576, STEAPP-725, STEAPP-573: step4: Added servo and macros for change extruders for v750
  • Loading branch information
frylock34 authored Oct 31, 2023
2 parents 47aaea9 + 3e9c5ca commit 74da841
Show file tree
Hide file tree
Showing 49 changed files with 1,575 additions and 285 deletions.
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,26 @@
// "-l",
// "/tmp/dev_klipper_log.log"
]
},
{
"name": "Run klipper 750",
"type": "python",
"request": "launch",
"env": {
"PYTHONPATH": "${workspaceRoot}"
},
"stopOnEntry": false,
"console": "integratedTerminal",
"cwd": "${workspaceRoot}",
"program": "${workspaceFolder}/klippy/klippy.py",
"args": [
"${workspaceFolder}/HTE750-0-0-23.cfg",
"-v",
"-a",
"/tmp/klipper_uds",
// "-l",
// "/tmp/dev_klipper_log.log"
]
}
]
}
8 changes: 3 additions & 5 deletions HTE530-5-4-22.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ path: /home/ste/uploads
[include stereotech_config/common/variables.cfg]
[include stereotech_config/common/diagnostics.cfg]

[probe basic_distances]
wcs_probe_1 = 159, 246.5, 120
wcs_probe_2 = 159, 235, 120
offsets_sensor = -42.3, -48.14, 0.0

[gcode_macro CONSTANTS]
description: Holds printer constants
variable_wcs_probe_1: 159, 246.5, 40
variable_wcs_probe_2: 159, 235, 85
variable_offsets_sensor: -42.3, -48.14, 20.2
variable_extruder_load_length: 130
variable_extruder1_load_length: 1600
variable_path_to_model_nozzle_offset: '/home/ste/klippy_dev/klipper/stereotech_config/common/model_hybrid_nozzle_offset.gcode'
Expand Down
69 changes: 42 additions & 27 deletions HTE750-0-0-23.cfg
Original file line number Diff line number Diff line change
@@ -1,37 +1,52 @@
[mcu]
serial: /dev/ttyACM1
# serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_410046000451303431333234-if00
serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_1D002D001550535556323420-if00

[mcu second_mcu]
serial: /dev/ttyACM0
[mcu manta_mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32g0b1xx_580023000A504B4633373520-if00

[virtual_sdcard]
path: /home/ste/uploads

[display_status]

[include stereotech_config/750/kinematics_none.cfg]
# [include stereotech_config/750/board_stm32f4.cfg]
# [include stereotech_config/750/board_stm32g1b0.cfg]
# [include stereotech_config/750/kinematics.cfg]
# [include stereotech_config/750/kinematics_tmc.cfg]
# [include stereotech_config/750/chamber.cfg]
# [include stereotech_config/750/printhead.cfg]
# [include stereotech_config/750/main_extruder.cfg]
# [include stereotech_config/750/second_extruder.cfg]
# [include stereotech_config/750/fiber_extruder.cfg]
# [include stereotech_config/750/filament_control_2.cfg]
# [include stereotech_config/750/filament_control_second_2.cfg]
# [include stereotech_config/750/module_3d.cfg]
# [include stereotech_config/750/module_5d.cfg]
# not defined
# [include stereotech_config/750/homing.cfg]
# [include stereotech_config/750/probe.cfg]
# [include stereotech_config/750/probe_hybrid_printer.cfg]
# [include stereotech_config/750/nozzle_offset.cfg]
# [include stereotech_config/750/extruder_macros.cfg]
[include stereotech_config/750/board_stm32f4.cfg]
[include stereotech_config/750/board_stm32g1b0.cfg]

[include stereotech_config/750/kinematics.cfg]
[include stereotech_config/750/kinematics_tmc.cfg]
[include stereotech_config/750/homing_override.cfg]
[include stereotech_config/common/homing_macros.cfg]

[include stereotech_config/750/chamber.cfg]

[include stereotech_config/750/printhead.cfg]

[include stereotech_config/750/main_extruder.cfg]
[include stereotech_config/750/second_extruder.cfg]
[include stereotech_config/750/fiber_extruder.cfg]
[include stereotech_config/750/nozzle_offset.cfg]
[include stereotech_config/common/extruder_macros.cfg]
[include stereotech_config/common/filament_control.cfg]
[include stereotech_config/common/filament_control_second.cfg]
# [include stereotech_config/750/power_control.cfg]
# [include stereotech_config/750/module_3d_macros.cfg]
# [include stereotech_config/750/print_macros.cfg]
# [include stereotech_config/750/variables.cfg]

[include stereotech_config/750/module_3d.cfg]
[include stereotech_config/750/module_3d_macros.cfg]
[include stereotech_config/750/module_5d.cfg]

[include stereotech_config/750/probe_main.cfg]
[include stereotech_config/750/probe_v3.cfg]

[include stereotech_config/750/print_macros.cfg]
[include stereotech_config/common/variables.cfg]
# [include stereotech_config/750/diagnostics.cfg]

[gcode_macro CONSTANTS]
description: Holds printer constants
variable_wcs_probe_1: 294, 327, 57
variable_wcs_probe_2: 294, 327, 107
variable_offsets_sensor: -60, -6, 29.0
variable_extruder_load_length: 210
variable_extruder1_load_length: 1650
# variable_path_to_model_nozzle_offset: '/home/ste/klipper/stereotech_config/common/model_hybrid_nozzle_offset.gcode'
gcode:
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions klippy/extras/auto_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ def _calc_wcs_2_new_sensor(self, len_thickness):
thickness = len_thickness / 2.
x = (self.point_coords[8][0] + self.point_coords[9][0]) / 2.
y = (self.point_coords[5][1] + self.point_coords[6][1]) / 2. - thickness
z = self.point_coords[4][2] - len_thickness
z = self.point_coords[4][2] - 10
return x, y, z

def calculate_probe_backlash(self, x1, y1, y2):
self.probe_backlash_x = abs(self.point_coords[3][0] - (x1 + 55))
# distance between points
distance = 55
if abs(self.point_coords[3][0] - x1) < 10:
distance = 5
self.probe_backlash_x = abs(self.point_coords[3][0] - (x1 + distance))
self.probe_backlash_y = abs(self.point_coords[5][1] - y2)
self.probe_backlash_y_2 = abs(self.point_coords[1][1] - (y1 - 5))
logging.info("""Probe backlash is set:\nprobe_backlash_x=%f,
Expand Down
20 changes: 6 additions & 14 deletions klippy/extras/probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,14 @@ def __init__(self, config, mcu_probe):
self.mcu_probe = mcu_probe
self.speed = config.getfloat('speed', 5.0, above=0.)
self.lift_speed = config.getfloat('lift_speed', self.speed, above=0.)
# load section for get basic distances
basic_distances = config.getsection('probe basic_distances')
# get the template center points
self.wcs_probe_1 = basic_distances.getlists(
'wcs_probe_1', seps=',', parser=float)
self.wcs_probe_2 = basic_distances.getlists(
'wcs_probe_2', seps=',', parser=float)
# load section for get the basic distances
basic_distances = config.getsection('gcode_macro CONSTANTS')
# get the offset between sensor_probe and nozzle
offsets = basic_distances.getlists(
'offsets_sensor', seps=',', parser=float)
'variable_offsets_sensor', seps=',', parser=float)
self.x_offset = offsets[0]
self.y_offset = offsets[1]
self.z_offset = offsets[2]

self.probe_calibrate_z = 0.
self.multi_probe_pending = False
self.last_state = False
Expand Down Expand Up @@ -225,9 +219,7 @@ def cmd_QUERY_PROBE(self, gcmd):
def get_status(self, eventtime):
return {'last_query': self.last_state,
'last_result': self.last_result,
'offsets': self.get_offsets(),
'wcs_probe_1': self.wcs_probe_1,
'wcs_probe_2': self.wcs_probe_2,
'offsets': self.get_offsets()
}
cmd_PROBE_ACCURACY_help = "Probe Z-height accuracy at current XY position"
def cmd_PROBE_ACCURACY(self, gcmd):
Expand Down Expand Up @@ -340,10 +332,10 @@ class ProbeEndstopWrapper:
def __init__(self, config):
self.printer = config.get_printer()
# load section for get basic distances
basic_distances = config.getsection('probe basic_distances')
basic_distances = config.getsection('gcode_macro CONSTANTS')
# get the offset between sensor_probe and nozzle
offsets = basic_distances.getlists(
'offsets_sensor', seps=',', parser=float)
'variable_offsets_sensor', seps=',', parser=float)
self.position_endstop = offsets[2]
self.stow_on_each_sample = config.getboolean(
'deactivate_on_each_sample', True)
Expand Down
71 changes: 33 additions & 38 deletions stereotech_config/5xx/module_5d.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,26 @@ gcode:
[a_axis_offset]

[gcode_macro MOVE_WCS_ZERO]
description: The macro for manual calibration of the 5_d module using the tool, makes movements to determine the points wcs_1 and wcs_2
gcode:
G54
{% if printer.toolhead.axis_maximum[0] > 250 %}
G0 Z150 F6000
{% else %}
G0 Z100 F6000
{% endif %}
{% set current_wcs = params.WCS|default(1)|int %}
{% set offsets = printer.gcode_move.wcs_offsets[current_wcs] %}
{% if offsets[0] == 0 and offsets[1] == 0 %}
{% if printer.toolhead.axis_maximum[0] > 250 %}
G0 X162 Y242 F6000
{% else %}
G0 X107 Y137 F6000
{% endif %}
{% else %}
G0 X{offsets[0]} Y{offsets[1]} F6000
{% endif %}
{% if current_wcs == 1 %}
G0 A0
{% elif current_wcs == 2 %}
{% if printer.toolhead.axis_maximum[0] > 250 %}
G0 Y192 A90 F6000
{% else %}
G0 Y87 A90 F6000
{% endif %}
{% set wcs_probe_1 = printer["gcode_macro CONSTANTS"].wcs_probe_1 %}
{% set wcs_probe_2 = printer["gcode_macro CONSTANTS"].wcs_probe_2 %}
{% set x = wcs_probe_1[0] if (offsets[0] == 0 and offsets[1] == 0) else offsets[0] %}
{% set y = wcs_probe_1[1] if (offsets[0] == 0 and offsets[1] == 0) else offsets[1] %}
{% set z = printer.toolhead.axis_maximum[0] / 2 %}
{% set a = 0 if current_wcs == 1 else 90 %}
G54
G0 Z{z} F3600
G0 X{x} Y{y} A{a} F3600
{% if current_wcs == 2 %}
{% set y = wcs_probe_2[1] - 45 %}
G0 Y{y} F3600
{% endif %}

[gcode_macro SET_WCS_OFFSET]
description: The macro for the set wcs after manual calibrate 5d module
gcode:
G54
G90
Expand Down Expand Up @@ -75,25 +66,29 @@ gcode:
G10 L2 P3 X{wcs4[0] - delta_x + params.X|float} Y{wcs4[1] + delta_z + params.Z|float} Z{wcs4[2] - delta_y + params.Y|float}

[gcode_macro MOVE_CALIBRATION_POINT]
description: movements for calibration of the 5d module
gcode:
G54
{% set point = params.POINT|default(0)|int %}
{% set x = 162 if printer.toolhead.axis_maximum[0] > 250 else 108 %}
{% set y = 242 if printer.toolhead.axis_maximum[0] > 250 else 137 %}
{% if point == 3 or point == 4 %}
{% set y = 192 if printer.toolhead.axis_maximum[0] > 250 else 87 %}
{% endif %}
{% set wcs_1 = printer["gcode_macro CONSTANTS"].wcs_probe_1 %}
{% set wcs_2 = printer["gcode_macro CONSTANTS"].wcs_probe_2 %}
{% set x = wcs_1[0] + 2 %}
{% set y = wcs_1[1] %}
{% set z = wcs_2[2] + 30 %}
{% set a = 0 %}
G54
{% if point == 1 %}
{% set x = 112 if printer.toolhead.axis_maximum[0] > 250 else 58 %}
{% endif %}
{% if point == 2 %}
{% set x = 212 if printer.toolhead.axis_maximum[0] > 250 else 158 %}
{% endif %}
G0 A0
G0 X{x} Y{y} Z110 F3600
{% if point > 3 %}
G0 Z70 A90 F3600
{% set x = wcs_1[0] - 55 %}
{% elif point == 2 %}
{% set x = wcs_1[0] + 55 %}
{% elif point == 3 %}
{% set y = wcs_1[1] - 50 %}
{% elif point == 4 %}
{% set y = wcs_2[1] - 40 %}
G0 X{x} Y{y} Z{z} A{a} F3600
{% set z = wcs_2[2] - 15 %}
{% set a = 90 %}
{% endif %}
G0 X{x} Y{y} Z{z} A{a} C0 F3600

[gcode_macro SET_A_AXIS_OFFSET_POINT]
gcode:
Expand Down
3 changes: 2 additions & 1 deletion stereotech_config/750/board_stm32g1b0.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ aliases:
e2_heater_pin=PB6, e2_sensor_pin=PA2,
air_pump_pin=PC12, heater_bed_heater_pin=PE4, heater_bed_heater_pin1=PB8,
chamber_heater_pin1=PB9,
chamber_led_pin=PB7, e_valve_pin=PE5, e1_valve_pin=PE6, cooling_valve_pin=PE0
chamber_led_pin=PB7, e_valve_pin=PE5, e1_valve_pin=PE6, cooling_valve_pin=PE0,
probe_pin=PB1

[multi_pin heater_bed_heater]
pins: manta_mcu:heater_bed_heater_pin, manta_mcu:heater_bed_heater_pin1
1 change: 1 addition & 0 deletions stereotech_config/750/chamber.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ heater_temp: 40
#ONLY FOR DEBUG
[verify_heater chamber_heater]
check_gain_time: 1000

[output_pin chamber_led]
pin: manta_mcu:chamber_led_pin
pwm: True
Expand Down
44 changes: 37 additions & 7 deletions stereotech_config/750/fiber_extruder.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ heater_pin: manta_mcu:e2_heater_pin
sensor_type: ATC Semitec 104GT-2#Trianglelab T-D500
sensor_pin: manta_mcu:e2_sensor_pin
control: pid
pid_Kp: 8.683
pid_Ki: 0.306
pid_Kd: 61.541
pid_Kp: 13.164
pid_Ki: 0.516
pid_Kd: 83.922
min_temp: -150
max_temp: 500
max_extrude_only_distance: 300.0
Expand All @@ -28,13 +28,32 @@ variable_flow: 100.0
variable_t2_offset_enabled: 0.0
gcode:
M117 set_extruder2
SET_GCODE_VARIABLE MACRO=T1 VARIABLE=t1_offset_enabled VALUE=1
SET_GCODE_OFFSET X_ADJUST={printer["gcode_macro SET_NOZZLE_OFFSET"].offset_x2|default(0.0)} Y_ADJUST={printer["gcode_macro SET_NOZZLE_OFFSET"].offset_y2|default(0.0)}
# reset nozzle offset for the extruder1
{% if printer["gcode_macro T1"].t1_offset_enabled > 0 %}
SET_GCODE_OFFSET X_ADJUST={0.0 - printer["gcode_macro SET_NOZZLE_OFFSET"].offset_x|default(0.0)} Y_ADJUST={0.0 - printer["gcode_macro SET_NOZZLE_OFFSET"].offset_y|default(0.0)} Z_ADJUST={0.0 - printer["gcode_macro SET_NOZZLE_OFFSET"].offset_z|default(0.0)}
SET_GCODE_VARIABLE MACRO=T1 VARIABLE=t1_offset_enabled VALUE=0
{% endif %}
# set nozzle offset if needed
{% if printer["gcode_macro T2"].t2_offset_enabled < 1 %}
SET_GCODE_OFFSET X_ADJUST={printer["gcode_macro SET_NOZZLE_OFFSET"].offset_x2|default(0.0)} Y_ADJUST={printer["gcode_macro SET_NOZZLE_OFFSET"].offset_y2|default(0.0)} Z_ADJUST={0.0 + printer["gcode_macro SET_NOZZLE_OFFSET"].offset_z2|default(0.0)}
{% endif %}
SET_GCODE_VARIABLE MACRO=T2 VARIABLE=t2_offset_enabled VALUE=1
{% set current_wcs = printer.gcode_move.current_wcs %}
{% if "x" in printer.toolhead.homed_axes and "y" in printer.toolhead.homed_axes and "z" in printer.toolhead.homed_axes and printer.toolhead.extruder != 'extruder1' %}
{% if "xyz" in printer.toolhead.homed_axes and printer.toolhead.extruder != 'extruder2' %}
G54
MOVE_DOWN_Z_AXIS Z=5
G0 X10 Y2 F3600
{% if printer["servo tool_change_servo"] %}
# disabled current extruder if macro CHANGE_EXTRUDER1 exist
{% set current_ex = printer.toolhead.extruder %}
{% if printer["gcode_macro CHANGE_" ~ current_ex|upper] and printer["gcode_macro T1"].t1_offset_enabled > 0 %}
CHANGE_{current_ex|upper}
G4 P1500
{% endif %}
# enabled servo for extruder2
CHANGE_EXTRUDER2
{% else %}
G0 X10 Y2 F3600
{% endif %}
{% endif %}
SAVE_EXTRUDER_FLOW
ACTIVATE_EXTRUDER extruder=extruder2
Expand Down Expand Up @@ -65,3 +84,14 @@ gcode:
RESTORE_GCODE_STATE NAME=prime_fiber_state
M400
{% endif %}

[gcode_macro CHANGE_EXTRUDER2]
variable_coordinates_servo: 495, 490
gcode:
{% set coordinates_servo = printer["gcode_macro CHANGE_EXTRUDER2"].coordinates_servo %}
G0 X{coordinates_servo[0]} Y{coordinates_servo[1]}
M400
SET_SERVO SERVO=tool_change_servo ANGLE=15
G4 P1500
SET_SERVO SERVO=tool_change_servo ANGLE=150
M400
13 changes: 6 additions & 7 deletions stereotech_config/750/kinematics.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ homing_speed: 20

[stepper_c]
step_pin: c_step_pin
dir_pin: c_dir_pin
dir_pin: !c_dir_pin
enable_pin: !c_en_pin
microsteps: 128
rotation_distance: 120
gear_ratio: 7:1
#can_home: false
endstop_pin: !c_endstop_pin
position_endstop: 0
position_min: 0
position_max: 120
can_home: false
# endstop_pin: !c_endstop_pin
# position_endstop: 0
# position_min: 0
# position_max: 120
homing_speed: 20

Loading

0 comments on commit 74da841

Please sign in to comment.