-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprinter.cfg
548 lines (466 loc) · 17.3 KB
/
printer.cfg
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
[gcode_macro TRUE_HOME]
gcode:
{action_respond_info("Performing True Home...")}
{action_respond_info("Current home status: %s" % printer.toolhead.homed_axes )}
{% if printer.toolhead.homed_axes != 'xyz' %}
G28
{% else %}
G0 X150 Y150 Z0.200
{% endif %}
# SAFETY MARGIN SET HERE
G0 Z0.300
UPDATE_DELAYED_GCODE ID=_TRUE_HOME_DELAY DURATION=0.2
[gcode_macro _TRUE_HOME]
description: attempt at using a config value + slow probe checks for very accurate z axis homing.
gcode:
{% set probeStatus = printer.probe.last_query %}
{action_respond_info("Probe status: %s" % probeStatus )}
{% if probeStatus == False %}
G91
G0 Z-0.005
G90
UPDATE_DELAYED_GCODE ID=_TRUE_HOME_DELAY DURATION=0.2
{% else %}
_UPDATE_PROBE_STATUS
{% endif %}
[gcode_macro _UPDATE_PROBE_STATUS]
gcode:
{% set Z_PROBE = printer.probe.last_z_result %}
G91
G0 Z+0.005 ; undo the last downward action
# SET ACTUAL PROBE PHYSICAL OFFSET SET HERE
# When set properly, this value will cause 0 to be at the first location where extrusion is very difficult,
# and high pressure will build.
# To come: I would like to produce a gauge block verification to the actual offset. Then, we'd know that
# the actual offset is correct, so relative calculations for flowrate, etc, which were often mixed with
# "squish" to get a nice finish, can be calculated for the actual height.
# Without this, the squish factor varies on height and flow, which is what leads to wild variation to
# first layer finish.
G0 Z+0.115
G90
G92 Z0
{action_respond_info("True Home Complete")}
[delayed_gcode _TRUE_HOME_DELAY]
gcode:
QUERY_PROBE
_TRUE_HOME
[gcode_macro STOP_TRUE_HOME]
gcode:
UPDATE_DELAYED_GCODE ID=_TRUE_HOME_DELAY DURATION=0
# ██████╗██████╗ ██╗ ██████╗ ███████╗███╗ ███╗ █████╗ ██████╗ ████████╗ ██╗███████╗██╗ ██╗
# ██╔════╝██╔══██╗ ███║██╔═══██╗ ██╔════╝████╗ ████║██╔══██╗██╔══██╗╚══██╔══╝ ██║██╔════╝██║ ██║
# ██║ ██████╔╝████╗╚██║██║ ██║ ███████╗██╔████╔██║███████║██████╔╝ ██║ ████ ██║███████╗███████║
# ██║ ██╔══██╗╚═══╝ ██║██║ ██║ ╚════██║██║╚██╔╝██║██╔══██║██╔══██╗ ██║ ╚══╝ ██║╚════██║██╔══██║
# ╚██████╗██║ ██║ ██║╚██████╔╝ ███████║██║ ╚═╝ ██║██║ ██║██║ ██║ ██║ ██║███████║██║ ██║
# ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
# ╔═╗╔═╗╦═╗ ╦╔═╦ ╦╔═╗╔═╗╔═╗╦═╗
# ╠╣ ║ ║╠╦╝ ╠╩╗║ ║╠═╝╠═╝║╣ ╠╦╝
# ╚ ╚═╝╩╚═ ╩ ╩╩═╝╩╩ ╩ ╚═╝╩╚═
# CR-10 Smart-ish for Klipper
# printer_size: 300x300x400
# Version: 1.0
# This file contains pin mappings for the Creality CR-10 Smart
# with a CRC-2405V1.2 board.
# To use this config, during "make menuconfig" select the STM32F103
# with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# Choose the "Enable extra low-level configuration"
# Then, select "GPIO pins to set at micro-controller startup"
# In the prompt, enter PA0. You'll see this back on the main screen as:
# (PA0) GPIO pins to set at micro-controller startup
# All other options are acceptable as is, or, they were when this
# configuration was written.
# Flash this firmware on the MCU by copying "out/klipper.bin" to an SD
# card and turning the printer on with the card inserted. The firmware
# filename must end in ".bin" and must not match the last filename
# that was flashed.
# For the CR-10 Smart, you MUST hold down the power button the entire time
# during the flash. It only takes about 8 to 10 seconds, and you'll hear a
# fairly loud click from a relay when it is complete. The screen will
# freeze at the start of the Creality logo and will no longer work.
# The machine itself includes a small router that can run a Klipper
# frontend. You don't need to buy a single-board computer. See:
# https://3dprintbeginner.com/how-to-install-klipperwrt-on-creality-box/
# However, after going this route, and installing a switch and extra power
# for 5V so the router can run without the printer on, I found the onboard
# box MUCH too slow to be useful. It takes 5 full minutes to load Octoprint.
# I ended up switching to a Raspberry PI 3B+ for Klipper.
# See https://www.klipper3d.org/Config_Reference.html for a description of parameters.
# ╔═╗═╗ ╦╔═╗╔═╗╦═╗╦╔╦╗╔═╗╔╗╔╔╦╗╔═╗╦ ╦ ╦╔═╗╦═╗╦╔═
# ║╣ ╔╩╦╝╠═╝║╣ ╠╦╝║║║║║╣ ║║║ ║ ╠═╣║ ║║║║ ║╠╦╝╠╩╗
# ╚═╝╩ ╚═╩ ╚═╝╩╚═╩╩ ╩╚═╝╝╚╝ ╩ ╩ ╩╩═╝ ╚╩╝╚═╝╩╚═╩ ╩
# For reference, the "outside pin" means the pin nearest the edge of the board.
# PIN PB12 - Connector J4 outside pin.
# This was used for was WIFI reset on the Creality Cloud. It seems to be floating when not
# enabled and not reliable. When used as an input as PB12 (in a test as an endstop trigger)
# it is floating. Pulling to ground stabilizes it so ground is open, and applying 5v is
# triggered. So, adopting a hardware pull down, as ~PB12 stablizes it to ground. Using a 10K
# resistor and connecting to 5V results in 4V, so there is a 40K pulldown. That is a weird
# value. Adopting a hardware pull up as ^PB12 produces 3.3V on it's output, nice! They chose
# a good resistor size for pull up.
# Use as an output:
# [output_pin PB12_on_J4]
# pin: PB12
# PIN PB2 - Optical Z endstop.
# this is the optical endstop; haven't figured out how to leverage it yet tho in klipper.
# Ideally, I'd like to make the z axis zoom down to the optical stop before homing, but I
# haven't figured out how to do that yet. Maybe a stepper_z?
# as used in the z axis stepper section:
# endstop_pin: PB2
# PIN PA15 - Connector J3 outside pin.
# To use as an input, use PA15 and connect to ground to trigger it; no resistor needed. It has a 10K pull up as confirmed by a 2.5V presence when used with an external 10K resistor.
# Use as an output:
# [output_pin PA15_on_J3]
# pin: PA15
# PIN PC7 - SD Card Inserted Switch.
# Inserting an SD-card causes PC7 to be open and when removed it is triggered. It might be a neat lockout trick or emergency .
#─┼─┼─╔═╗╔═╗╦╦ ╔═╗
#─┼─┼─╠╣ ╠═╣║║ ╚═╗
# ╚ ╩ ╩╩╩═╝╚═╝
# PA2 no visible effect, was possible fan candidate
# [output_pin PA2]
# pin: PA2
# PC6 BEEPER in screen
# Didn't do anything. It likely needs the screen to be initialized before it works.
# [output_pin PC6]
# pin: PC6
# value: 0
# motor protect pin from smart pro config, nope?
# [output_pin PC0]
# pin: PC0
# value: 0
# MOTOR_CIRCUIT_PIN from smart pro config, nope?
# [output_pin PA1]
# pin: PA1
# value: 0
# pin: PD2 is refered as a fan but I believe it's a copy paste error from the CR6 series.
# PC13 hotend fan candidate? Nope.
# [output_pin PC13]
# pin: PC13
# pwm: True
# value: 0.0
# ╔╦╗╔═╗╔═╗╦═╗╔═╗╔═╗
# ║║║╠═╣║ ╠╦╝║ ║╚═╗
# ╩ ╩╩ ╩╚═╝╩╚═╚═╝╚═╝
# This loads the BED_MESH called default on startup
[delayed_gcode setdefaultbedmesh]
initial_duration: 1
gcode:
BED_MESH_PROFILE LOAD="default"
[gcode_macro Lower_And_Probe]
description: Go down 5 microns and check probe status.
gcode:
G91
G0 Z-0.005
QUERY_PROBE
G90
[gcode_macro Zero_Out_Z]
description: Set the Z axis to 0 with G92 Z0.
gcode:
G92 Z0
# This plays a harmony with the Z and X axis, useful for notifications or impressing your wife.
[gcode_macro SNAPPY_LITTLE_TUNE]
description: Don't click this.
gcode:
G90
G0 X150 F2000
G91
G0 X+1 Z+0.16 F200
G0 X+22 F4938 Z+2.8
G0 X-25 F3700 Z-3.38
G0 X+21 F4662 Z+3.44
G0 X-18 F4938 z-2.3
G4 P250
G0 X-25 F3700 Z+3.38
G4 P50
G0 X-22 F4938 Z-2.8
G0 X+25 F3700 Z+3.38
G0 X+21 F4662 ;Z-3.44
G0 X-18 F4938 z-2.3
G4 P300
G0 X+18 F4938 z-2.3
G90
# Probe Tare - I experimented with this, and DID see results at first but now I can't
# get it to show any sign of working again. Puzzling. I'll leave it for now.
# activate_gcode:
# TARE_STRAIN_GAUGE
[gcode_macro TARE_STRAIN_GAUGE]
description: Tare the strain gauge. Ensure nothing is touching the extruder and it is not under strain from the cabling or bowden tube.
gcode:
SET_PIN PIN=_tare_strain VALUE=0
G4 P250
SET_PIN PIN=_tare_strain VALUE=1
G4 P250
{action_respond_info("Strain gauge tared. Ensure nothing was touching the extruder and it was not under strain from the cabling or bowden tube.")}
[gcode_macro PROBE_CHECK]
description: Display if the probe endstop is triggered or open, useful when fine tuning the z-offset.
gcode:
QUERY_PROBE
[gcode_macro CHECK_PROBE_ACCURACY]
description: Does a test of the probe and provides an average output. I see less than 10 micro accurancy consistently, very impressive!
gcode:
PROBE_ACCURACY
# I know the strain gauge tares as the optical sensor is triggered, but I don't
# know if this pin tells the hx711 that a tare is happening. I experimented with
# it and it didn't seem to do anything. I'll have to look into it more.
[output_pin _tare_strain]
pin: !PA1
value: 1
# Seriously, who thought these lights were bright enough?
[led LED_on_Gantry]
white_pin: PA6
cycle_time: 0.010
initial_WHITE: 1
# I'd really love a way to power UP the board too. Maybe 3.3V from the PI would turn in on?
# Use this as a "nice" way to show Power Off in the Misc section:
# [output_pin printer_power_(Off_Only)]
# Or, use _ps_off and then configure the moonraker.cfg with this
# [power CR-10 Smart]
# type: klipper_device
# object_name: output_pin _ps_off
# which will make the printer appear in the power menu in the top-right
# the _ before the label makes it hidden in the misc section in Mainsail
[output_pin _ps_off]
pin: PA0
value: 1
# Once you have your machine setup and don't need to fiddle anymore, I'd recommend setting
# this to false.
[force_move]
enable_force_move: false
## These show the temps of the processors for the MCU and the Pi.
[temperature_sensor CR-10_MCU]
sensor_type: temperature_mcu
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
# The rest of this file is fairly standard configurations combined from various places on the net.
# Subject to change as I begin to use the printer more and refine it further.
[virtual_sdcard]
path: ~/printer_data/gcodes
[display_status]
[pause_resume]
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
# change this if you need more or less extrusion
variable_extrude: 1.0
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 2.0) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
{% if "xyz" in printer.toolhead.homed_axes %}
G91
G1 Z4.5 F300
G90
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
G28 X Y
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
G1 Y{y_park} F2000
;M84 # I believe it's a better workflow to keep the unit homed after a print so I can just right back in after a cancel.
CANCEL_PRINT_BASE
[printer]
kinematics: cartesian
max_velocity: 150
max_accel: 3000
max_accel_to_decel: 2000
square_corner_velocity: 5.0
max_z_velocity: 20
max_z_accel: 450
[stepper_x]
step_pin: PB8
dir_pin: !PB7
enable_pin: !PC3
rotation_distance: 40
microsteps: 16
endstop_pin: PC4
position_min: -5
position_endstop: -5
position_max: 305
homing_speed: 80
[stepper_y]
step_pin: PB6
dir_pin: PB5
enable_pin: !PC3
rotation_distance: 40
microsteps: 16
endstop_pin: PC5
position_min: -2
position_endstop: -2
position_max: 302
homing_speed: 80
[stepper_z]
step_pin: PB4
dir_pin: !PB3
enable_pin: !PC3
rotation_distance: 8
microsteps: 16
endstop_pin: probe:z_virtual_endstop
position_min: -1.5
position_max: 405
homing_speed: 5.0
second_homing_speed: 1.0
homing_retract_dist: 4.0
[extruder]
max_extrude_only_distance: 1000.0
step_pin: PC2
dir_pin: !PB9
enable_pin: !PC3
# original value might be 30.4768. my machine had a replacement extruder when I purchased it used.
rotation_distance: 33.29895168
microsteps: 16
nozzle_diameter: 0.600
filament_diameter: 1.750
heater_pin: PB14
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PB1
control: pid
# tuned for stock hardware with 200 degree Celsius target
pid_Kp: 14.32
pid_Ki: 0.81
pid_Kd: 63.12
min_temp: 0
max_temp: 265
# pressure_advance: 0.73
pressure_advance: 0.3
# useful when tuning extrusion length, otherwise, dangerous to leave at 0
# min_extrude_temp: 0
[heater_bed]
heater_pin: PB13
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PB0
control: pid
# tuned for stock hardware with 50 degree Celsius target
pid_Kp: 79.49
pid_Ki: 1.17
pid_Kd: 1349.52
min_temp: 0
max_temp: 120
[fan]
pin: PB15
kick_start_time: 1.0
[mcu]
## get this by running `ls /dev/serial/by-id/` and looking for the USB serial device
serial:/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
[probe]
pin: PA4
x_offset: 0.0
y_offset: 0.0
# Once you set the z_offset and save it, this will get commented out.
z_offset: 0.0
speed: 2
lift_speed: 5
samples_tolerance: 0.05
samples_tolerance_retries: 2
samples: 1
[filament_switch_sensor filament_sensor]
pause_on_runout: true
switch_pin: ^!PA7
[static_digital_output daughterboard_communication]
pins: !PA5
# [bltouch]
# sensor_pin: ^PB1 #signal check port ^stand for pull up
# control_pin: PB0 #singal control prot
# #x_offset: -31.8
# #y_offset: -40.5
# #z_offset: 1.50 #z off_set configuration
# speed: 3.0
# stow_on_each_sample = false #high speed for bltoch,
# samples: 1
# #probe_with_touch_mode = true
[bed_mesh]
speed: 200
mesh_min: 10,10 #need to handle head distance with bl_touch
mesh_max: 290,290 #max probe range
probe_count: 13,13 #yeah, aggressiveboi
fade_start: 1
fade_end: 10
fade_target: 0
algorithm: bicubic
# This is CRUCIAL. This sets the 150,150 mark as a 0.000 offset reference. Many
# claim this is only cosmentic but I have verified that the safe_z_home process
# doesn't account for the bed mesh, enabled or not during the homing process.
# Since this machine is homed to 150,150 below this ensures there is nothing to
# take into account.
zero_reference_position: 150,150
[safe_z_home]
home_xy_position:150,150
speed: 100
z_hop: 10
z_hop_speed: 10
[mcu rpi]
serial: /tmp/klipper_host_mcu
# [adxl345]
# cs_pin: rpi:None
# spi_speed: 2000000
# spi_bus: spidev2.0
# [resonance_tester]
# accel_chip: adxl345
# accel_per_hz: 70
# probe_points:
# 150,150,20
# # NABBED FROM creality, to test
[input_shaper]
# shaper_type_x = 2hump_ei
# shaper_freq_x = 90.6
# shaper_type_y = mzv
# shaper_freq_y = 27.2
# [gcode_macro G29]
# gcode:
# G28
# bed_mesh_calibrate
# G1 X0 Y0 Z10 F4200
# [gcode_arcs]
# #resolution: 1.0
[exclude_object]