-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNZL_PID.cfg
More file actions
110 lines (109 loc) · 6.74 KB
/
Copy pathNZL_PID.cfg
File metadata and controls
110 lines (109 loc) · 6.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#.................................................................................................................
# NZL_PID - Optional parameters: BED_TEMP{float_value}, NZL_TEMP{float_value},
# FAN_SPEED{float_value between 0-1}, SOAK_MINUTES{float_value},
# ENCLOSURE_TEMP{float_value}, ZERO_OVERSHOOT{0,1},
# WRITE_FILE{0,1}
#
# / Usage:
# NZL_PID,
# NZL_PID NZL_TEMP=240 BED_TEMP=110
# NZL_PID NZL_TEMP=240 BED_TEMP=110.0 FAN_SPEED=0.64 SOAK_MINUTES=12.5 ENCLOSURE_TEMP=40.0
# NZL_PID NZL_TEMP=240 BED_TEMP=110.0 FAN_SPEED=0.64 SOAK_MINUTES=12.5 ENCLOSURE_TEMP=40.0 WRITE_FILE=1
# NZL_PID NZL_TEMP=240 BED_TEMP=110.0 FAN_SPEED=0.64 SOAK_MINUTES=12.5 ENCLOSURE_TEMP=40.0 WRITE_FILE=1 ZERO_OVERSHOOT=1
#
# It performs bed heat soak and then nozzle PID tune. If no parameters are specified, BED_TEMP will be
# [defaultTempBed], and NZL_TEMP will be [defaultTempNozzle].
#
# Usage: NZL_PID BED_TEMP=95 NZL_TEMP=238
#.................................................................................................................
# Required variable(s) to be set. Add the following to your global variable dictionary block as:
#
# [gcode_macro _USER_VARIABLE]
# variable_filament.profile.defaultTempNozzle
# variable_filament.profile.defaultTempBed
# variable_filament.filament.profile.defaultEnclosure
# variable_filament.profile.PostPrintParkCool
# variable_filament.profile.defaultEnclosure
# variable_hw.chamber.fan
#
#.................................................................................................................
# Required external macro(s) used by this macro.
#
# _general_Debug
# STATUS_HOMING
# STATUS_BUSY
# STATUS_READY
# _COOL_WAIT
# _HEAT_WAIT
# PARK_UpperRight
# M117
# TURN_OFF_HEATERS
# G32
# M190
# M106
# _USER_VARIABLE
# M141
# FILTER
#
#.................................................................................................................
#.................................................................................................................
#
## URL Resources: https://github.com/rkolbi/voron2.4/blob/main/MY_V24-350/ACTIVE/MACRO-NZL_PID_TUNE.cfg
#
#.................................................................................................................
[gcode_macro NZL_PID]
# Usage: NZL_PID BED_TEMP=110 NZL_TEMP=245 FAN_SPEED=85 SOAK_MINUTES=10
# Fan speed, from 0 to 255. S255 provides 100% duty cycle; S128 produces 50%.
description: Helper: Performs NOZZLE PID tune
gcode:
_general_Debug msg="NZL_PID - entering"
{% set user = printer['gcode_macro _USER_VARIABLE'] %}
{% if printer.idle_timeout.state == "Printing" or printer.pause_resume.is_paused %}
{action_respond_info("Cannot do that while printing")}
{% else %}
{% set defaultTN = user.filament.profile.defaultTempNozzle|float %}
{% set defaultTB = user.filament.profile.defaultTempBed|float %}
{% if printer.configfile.config['zero_overshoot extruder'].zero_overshoot |string in ['True','true'] %}
{% set defaultOverShoot = 1 %}
{% endif %}
{action_respond_info("defaultOverShoot for extruder = %s;" % defaultOverShoot)}
{% set Z_OVER = params.ZERO_OVERSHOOT|default(defaultOverShoot)|int %}
{action_respond_info("Z_OVER for extruder = %s;" % Z_OVER)}
{% set FAN_SPEED = params.FAN_SPEED|default(0.64)|float %}
{% set SOAK_MINUTES = params.SOAK_MINUTES|default(12)|float %}
{% set BED_TEMP = params.BED_TEMP|default(defaultTB)|float %}
{% set NZL_TEMP = params.NZL_TEMP|default(defaultTN)|float %}
{% set X_MID = printer.configfile.config.stepper_x.position_max|float / 2.0 %}
{% set Y_MID = printer.configfile.config.stepper_y.position_max|float / 2.0 %}
{% set defaultENCLOSURE = user.filament.profile.defaultEnclosure|float %}
{% set ENCLOSURE_TEMP = params.ENCLOSURE_TEMP|default(defaultENCLOSURE)|float %}
{% set WRITE_FILE = params.WRITE_FILE|default(0)|int %}
# if WRITE_FILE = 1 then file is saved to `/tmp/heattest.txt` on raspberry pi
{action_respond_info("WRITE_FILE for heater_bed = %s;" % WRITE_FILE)}
G90 ;Absolute Positioning
M117 Performing initial homing.
G32 ;Clears bed-mesh and performs G28, ATTACH_PROBE, QGL, DOCK_PROBE
G1 Z5 Y{Y_MID} X{X_MID} F4000 ;move to center of bed
M117 Bringing bed to temperature.
{% if user.hw.chamber.fan %} M141 S{ENCLOSURE_TEMP} {% endif %} ;set chamber temperature for Exhaust fan and Bed fans
FILTER ;Toggle Nevermore Filter
M106 S{(FAN_SPEED*255)} ;Part Cooling Fan On and start monitoring the tach signal
M190 S{BED_TEMP} ;Wait for bed temp within 5 degrees
_HEAT_WAIT MINUTES={SOAK_MINUTES} MSG="Pre NZL_PID Soaking..." ;Heating cycle waiting routine
SET_LED LED=sb_leds INDEX=17 RED=.5 GREEN=.5 BLUE=0
SET_LED LED=sb_leds INDEX=18 RED=.5 GREEN=.5 BLUE=0
M117 Starting PID calibration.
PID_CALIBRATE HEATER=extruder TARGET={NZL_TEMP} ZERO_OVERSHOOT={Z_OVER} WRITE_FILE={WRITE_FILE} ;PID tune the extruder
M117 Finished PID calibration.
TURN_OFF_HEATERS ;Turn off all heaters and reset the chamber temperature for Exhaust fan
FILTER ;Toggle Nevermore Filter
G90 ;Absolute Positioning
PARK_UpperRight ;Parks nozzle at top front-right
M18 X Y E ;Disable Stepper motor
SET_LED LED=sb_leds INDEX=17 RED=.2 GREEN=.5 BLUE=.2
SET_LED LED=sb_leds INDEX=18 RED=.2 GREEN=.5 BLUE=.2
_COOL_WAIT MINUTES={user.filament.profile.PostPrintParkCool|float} ;Cooling cycle waiting routine
STATUS_READY ;SB LED status
SAVE_CONFIG
{% endif %}
_general_Debug msg="NZL_PID - exiting"