Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2. STEAPP-915: added probe_servo, for manage the probe sensor and second extruder. Printer v630 #252

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
6 changes: 4 additions & 2 deletions stereotech_config/630/board_stm32f4.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ aliases:
y_step_pin=PG0, y_dir_pin=PG1, y_en_pin=PF15, y_endstop_pin=PG9,
z_step_pin=PF11, z_dir_pin=PG3, z_en_pin=PG5, z_endstop_pin=PG10,
a_step_pin=PG4, a_dir_pin=PC1, a_en_pin=PA0, a_endstop_pin=PG11,
c_step_pin=PF9, c_dir_pin=PF10, c_en_pin=PG2, c_endstop_pin=PB7,
c_step_pin=PF9, c_dir_pin=PF10, c_en_pin=PG2, c_endstop_pin=PG12,
bed_heater=PA1, bed_sensor=PF5,
five_axis_pin=PG12, heatsink_fan_pin=PD12,
five_axis_pin=PB12,
main_extruder_step_pin=PC13, main_extruder_dir_pin=PF0,
main_extruder_enable_pin=PF1, main_extruder_heater_pin=PA2,
main_extruder_sensor_pin=PF3,
Expand All @@ -18,5 +18,7 @@ aliases:
fiber_cut_step_pin=PE6, fiber_cut_dir_pin=PA14,
fiber_cut_enable_pin=PE0,
case_led=PE5, status_led=PB0,
heatsink_fan_pin=PD12, heatsink_sensor_pin=PF7, heatsink_servo_pin=PD7,
probe_pin=PG13, probe_servo=PB7,
# for debug
fan_pin=PD15,
98 changes: 98 additions & 0 deletions stereotech_config/630/calibrate/probe_630.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
[probe]
pin: !probe_pin
samples: 4
samples_tolerance_retries: 1
samples_result: median
lift_speed: 10.0
x_offset: 0.0
y_offset: 0.0
z_offset: 0.0
activate_gcode:
PUSH_PROBE_SENSOR

[bed_mesh]
speed: 120
horizontal_move_z: 30
mesh_min: 10, -97
mesh_max: 310, 133
probe_count: 6, 6
fade_start: 1
fade_end: 10
fade_target: 0
algorithm: bicubic
mesh_pps: 1, 1

[bed_mesh module_3d]
version = 1
points =
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
0.0, 0.0, 0.0, 0.0, 0.0, 0.0
x_count = 6
y_count = 6
mesh_x_pps = 1
mesh_y_pps = 1
algo = bicubic
tension = 0.2
min_x = 10.0
max_x = 261.0
min_y = 10.0
max_y = 253.0

[skew_correction]

[b_axis_compensation]

[c_axis_align]

[auto_wcs]

[skew_correction module_3d]
xy_skew = 0.0
xz_skew = 0.0
yz_skew = 0.0

[skew_correction module_5d]
xy_skew = 0.0
xz_skew = 0.0
yz_skew = 0.0

[gcode_macro TEST_PROBE]
gcode:
PUSH_PROBE_SENSOR ENABLE=1
QUERY_PROBE
UPDATE_DELAYED_GCODE ID=test_probe_loop DURATION=1.0

[gcode_macro CANCEL_TEST_PROBE]
gcode:
UPDATE_DELAYED_GCODE ID=test_probe_loop DURATION=0.0
{action_respond_info('Abort check loop')}

[delayed_gcode test_probe_loop]
gcode:
{% if printer["probe"].last_query %}
UPDATE_DELAYED_GCODE ID=test_probe_loop DURATION=0.0
{action_respond_info('Probe pressed, abort check loop')}
{% else %}
{action_respond_info('Probe not pressed')}
QUERY_PROBE
UPDATE_DELAYED_GCODE ID=test_probe_loop DURATION=1.0
{% endif %}

[gcode_macro AUTO_WCS]
gcode:
AUTO_WCS_OFFSET_V2
PUSH_PROBE_SENSOR ENABLE=0

[gcode_macro AUTO_BASEMENT_WCS]
gcode:
AUTO_BASEMENT_WCS_V2 {rawparams}
MOVE_SERVICE_POSITION_HEAD PARKING=0
PUSH_PROBE_SENSOR ENABLE=0

[gcode_macro ADJUST_BASEMENT_WCS]
gcode:
; pass
28 changes: 3 additions & 25 deletions stereotech_config/630/chamber.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[fan]
pin: fan_pin

[fan_generic chamber_fan]
pin: PA8

Expand All @@ -14,31 +17,6 @@ target_temp: 45.0
min_speed: 0.0
gcode_id: E

[gcode_macro M106]
rename_existing: M106.1
gcode:
{% set p = params.P|default(0)|int %}
{% set s = params.S|default(0)|int %}
{% if p > 0 %}
{% if p == 3 %}
SET_FAN_SPEED FAN=chamber_fan SPEED={params.S|default(0)|int / 255}
{% endif %}
{% else %}
M106.1 S{s}
{% endif %}

[gcode_macro M107]
rename_existing: M107.1
gcode:
{% set p = params.P|default(0)|int %}
{% if p > 0 %}
{% if p == 3 %}
SET_FAN_SPEED FAN=chamber_fan SPEED=0.0
{% endif %}
{% else %}
M107.1
{% endif %}

# LED Light controls

[led case_led]
Expand Down
3 changes: 2 additions & 1 deletion stereotech_config/630/main_extruder.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pid_Kp: 13.509
pid_Ki: 0.566
pid_Kd: 80.549
min_temp: -150
max_temp: 500
max_temp: 450
min_extrude_temp: 100
max_extrude_only_distance: 300.0
max_extrude_cross_section: 2.56
Expand All @@ -37,6 +37,7 @@ gcode:
G0 X10 Y2 F3600
{% endif %}
{% endif %}
PUSH_SECOND_EXTRUDER ENABLE=0
SAVE_EXTRUDER_FLOW
ACTIVATE_EXTRUDER extruder=extruder
RESTORE_EXTRUDER_FLOW EXTRUDER=extruder
Expand Down
107 changes: 107 additions & 0 deletions stereotech_config/630/module_5d.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
[gcode_button five_axis_module]
pin: five_axis_pin
press_gcode:
QUERY_BUTTON BUTTON=five_axis_module
; if the 3d module is changed to 5d, need to reset the offset. Duration is the 5 sec, for run code after LOAD_VARIABLES
UPDATE_DELAYED_GCODE ID=RESET_GCODE_OFFSET DURATION=5.0

[delayed_gcode RESET_GCODE_OFFSET]
gcode:
{action_respond_info("Reset gcode_offset")}
SET_GCODE_OFFSET X=0.0 Y=0.0 Z=0.0

[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:
{% set current_wcs = params.WCS|default(1)|int %}
{% set offsets = printer.gcode_move.wcs_offsets[current_wcs] %}
{% set wcs_probe_1 = printer["gcode_macro CONSTANTS"].probe_a_horizontal %}
{% set wcs_probe_2 = printer["gcode_macro CONSTANTS"].probe_a_vertical %}
{% 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
{% set current_wcs = params.WCS|default(1)|int %}
SET_WCS WCS={current_wcs}
G10 L20 X{params.X} Y{params.Y} Z{params.Z}
G54
{% set adjust_wcs = params.ADJUST_WCS|default(0)|int %}
{% if adjust_wcs > 0 and adjust_wcs != current_wcs %}
{% if adjust_wcs == 1 %}
ADJUST_OFFSET_WCS1 X={params.X} Y={params.Y} Z={params.Z}
{% elif adjust_wcs == 2 %}
ADJUST_OFFSET_WCS2 X={params.X} Y={params.Y} Z={params.Z}
{% endif %}
{% endif %}

[gcode_macro ADJUST_OFFSET_WCS1]
gcode:
{% set wcs3 = printer.gcode_move.wcs_offsets[3] %}
{% set delta_x = printer.gcode_move.wcs_offsets[4][0] - printer.gcode_move.wcs_offsets[2][0] %}
{% set delta_y = printer.gcode_move.wcs_offsets[4][1] - printer.gcode_move.wcs_offsets[2][1] %}
{% set delta_z = printer.gcode_move.wcs_offsets[4][2] - printer.gcode_move.wcs_offsets[2][2] %}
G10 L2 P2 X{wcs3[0] - delta_x + params.X|float} Y{wcs3[1] - delta_z} Z{wcs3[2] + delta_y + params.Y|float}

[gcode_macro ADJUST_OFFSET_WCS2]
gcode:
{% set wcs4 = printer.gcode_move.wcs_offsets[4] %}
{% set delta_x = printer.gcode_move.wcs_offsets[3][0] - printer.gcode_move.wcs_offsets[1][0] %}
{% set delta_y = printer.gcode_move.wcs_offsets[3][1] - printer.gcode_move.wcs_offsets[1][1] %}
{% set delta_z = printer.gcode_move.wcs_offsets[3][2] - printer.gcode_move.wcs_offsets[1][2] %}
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:
{% set point = params.POINT|default(0)|int %}
{% set wcs_1 = printer["gcode_macro CONSTANTS"].probe_a_horizontal %}
{% set wcs_2 = printer["gcode_macro CONSTANTS"].probe_a_vertical %}
{% set x = wcs_1[0] + 2 %}
{% set y = wcs_1[1] %}
{% set z = wcs_1[2] + 50 %}
{% set a = 0 %}
G54
{% if point == 1 %}
{% 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] + 30 %}
{% set a = 90 %}
{% endif %}
G0 X{x} Y{y} Z{z} A{a} C0 F3600

[gcode_macro SET_A_AXIS_OFFSET_POINT]
gcode:
{% set point = params.POINT|default(0)|int %}
{% set coord_x = printer.gcode_move.position.x %}
{% set coord_y = printer.gcode_move.position.y %}
{% set coord_z = printer.gcode_move.position.z %}
SAVE_A_AXIS_POINT POINT={point} COORDS={coord_x},{coord_y},{coord_z}

[gcode_macro SAVE_STATE_MODULE]
gcode:
{% if printer["gcode_button five_axis_module"].state == "RELEASED" %}
SAVE_VARIABLE VARIABLE=5d_module_enabled VALUE=0
{% else %}
SAVE_VARIABLE VARIABLE=5d_module_enabled VALUE=1
{% endif %}
75 changes: 75 additions & 0 deletions stereotech_config/630/printhead.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[temperature_fan heatsink_fan]
pin: !heatsink_fan_pin
sensor_type: NTC 100K MGB18-104F39050L32
sensor_pin: heatsink_sensor_pin
control: pid
pid_Kp: 15
pid_Ki: 0.5
pid_Kd: 25
min_temp: 0
max_temp: 100
target_temp: 30.0
gcode_id: H
min_speed: 0.5
max_speed: 1.0

[servo heatsink_servo]
pin: heatsink_servo_pin
maximum_servo_angle: 180
minimum_pulse_width: 0.0003
maximum_pulse_width: 0.0026
initial_angle: 90

[servo probe_servo]
pin: probe_servo
initial_angle: 140
maximum_servo_angle: 180

[gcode_macro PUSH_PROBE_SENSOR]
gcode:
{% set enable = params.ENABLE|default(1)|int %}
{% if enable %}
{action_respond_info("----------PUSH_PROBE_SENSOR 1")}
SET_SERVO SERVO=probe_servo ANGLE=0
{% elif enable == 0 %}
{action_respond_info("----------PUSH_PROBE_SENSOR 2")}
SET_SERVO SERVO=probe_servo ANGLE=140
{% else %}
{action_respond_info("----------PUSH_PROBE_SENSOR 3")}
{% endif %}

[gcode_macro PUSH_SECOND_EXTRUDER]
gcode:
{% set enable = params.ENABLE|default(1)|int %}
{% if enable %}
{action_respond_info("----------PUSH_SECOND_EXTRUDER 1")}
SET_SERVO SERVO=probe_servo ANGLE=180
{% elif enable == 0 %}
{action_respond_info("----------PUSH_SECOND_EXTRUDER 2")}
SET_SERVO SERVO=probe_servo ANGLE=140
{% else %}
{action_respond_info("----------PUSH_SECOND_EXTRUDER 3")}
{% endif %}

[gcode_macro M106]
rename_existing: M106.1
gcode:
{% set curr_ex = printer.toolhead.extruder %}
{% set s = params.S|default(0)|int %}
# the angle of the blow hole (ex1 (0% - 100%): 75-0; ex2 (0% - 100%):105-180)
{% set angle_hole = 75.0 %}
{% set ko = angle_hole / 255 %}
{% set start_pos_extruder1 = 75 %}
{% set start_pos_extruder2 = 105 %}
{% if curr_ex == 'extruder' %}
{% set angle = (start_pos_extruder1 - (ko * s))|round %}
{% elif curr_ex == 'extruder1' %}
{% set angle = (start_pos_extruder2 + (ko * s))|round %}
{% endif %}
{ action_respond_info('----------ex=%s----SET_SERVO SERVO=heatsink_servo ANGLE=%s' % (curr_ex, angle)) }
SET_SERVO SERVO=heatsink_servo ANGLE={angle}

[gcode_macro M107]
rename_existing: M107.1
gcode:
SET_SERVO SERVO=heatsink_servo ANGLE=90
30 changes: 30 additions & 0 deletions stereotech_config/630/probe_3d.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[gcode_macro CALIBRATE_MODULE_THREE_D]
description: 3D module calibration
gcode:
{% if printer["gcode_button five_axis_module"].state == "RELEASED" %}
{% set axis_max = printer.toolhead.axis_maximum %}
{% set offsets = printer.probe.offsets %}
{% set center_probe_x = (axis_max[0] / 2.0) - offsets[0] %}
{% set center_probe_y = (axis_max[1] / 2.0) - offsets[1] %}
G0 X{center_probe_x} Y{center_probe_y - 150} F6000
G0 Z40 F3600
PROBE
G91
G0 Z30 F3600
G90
MODULE_THREE_D_MESH_CALIBRATE
G91
G0 Z30 F3600
G90
G0 X{center_probe_x + offsets[0]} Y50 F3600
PUSH_PROBE_SENSOR ENABLE=0
{% endif %}

[gcode_macro MODULE_THREE_D_MESH_CALIBRATE]
description: 3D module calibration
gcode:
{% if printer["gcode_button five_axis_module"].state == "RELEASED" %}
Z_OFFSET_APPLY_PROBE Z={printer.probe.last_result[2]}
BED_MESH_CALIBRATE PROFILE=module_3d
BED_MESH_CLEAR
{% endif %}
1 change: 1 addition & 0 deletions stereotech_config/630/second_extruder.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ gcode:
G0 X10 Y2 F3600
{% endif %}
{% endif %}
PUSH_SECOND_EXTRUDER
SAVE_EXTRUDER_FLOW
ACTIVATE_EXTRUDER extruder=extruder1
RESTORE_EXTRUDER_FLOW EXTRUDER=extruder1
Expand Down
Loading
Loading