Guest User

Printer.cfg

a guest
Sep 26th, 2023
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 33.30 KB | None | 0 0
  1.   # This file contains pin mappings for the LDO Kit using BigTreeTech Octopus V1 as the main controller.
  2. # To use this config, the firmware should be compiled for the STM32F446 with a "32KiB bootloader"
  3. # Enable "extra low-level configuration options" and select the "12MHz crystal" as clock reference
  4.  
  5. # after running "make", copy the generated "klipper/out/klipper.bin" file to a
  6. # file named "firmware.bin" on an SD card and then restart the Octopus with that SD card.
  7.  
  8. # See docs/Config_Reference.md for a description of parameters.
  9.  
  10. ## Voron Design VORON2 250/300/350mm BigTreeTech Octopus V1 TMC2209 UART config
  11.  
  12. ## *** THINGS TO CHANGE/CHECK: ***
  13. ## MCU paths                            [mcu] section
  14. ## Thermistor types                     [extruder] and [heater_bed] sections - See 'sensor types' list at end of file
  15. ## Z Endstop Switch location            [safe_z_home] section
  16. ## Homing end position                  [gcode_macro G32] section
  17. ## Z Endstop Switch  offset for Z0      [stepper_z] section
  18. ## Probe points                         [quad_gantry_level] section
  19. ## Min & Max gantry corner postions     [quad_gantry_level] section
  20. ## PID tune                             [extruder] and [heater_bed] sections
  21. ## Thermistor types                     [extruder] and [heater_bed] sections
  22. ## Probe pin                            [probe] section
  23. ## Fine tune E steps                    [extruder] section
  24.  
  25. [include mainsail.cfg]
  26. [include led_progress.cfg]
  27. [include nozzle_scrub.cfg]
  28.  
  29.  
  30. [mcu]
  31. ##  Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify
  32. ##--------------------------------------------------------------------
  33. serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_250024001550535556323420-if00
  34. restart_method: command
  35. ##--------------------------------------------------------------------
  36.  
  37. [temperature_sensor MCU]
  38. sensor_type: temperature_mcu
  39.  
  40. [temperature_sensor PI]
  41. sensor_type: temperature_host
  42.  
  43. [printer]
  44. kinematics: corexy
  45. max_velocity: 500  
  46. max_accel: 10000
  47. max_z_velocity: 15          #Max 15 for 12V TMC Drivers, can increase for 24V
  48. max_z_accel: 350
  49. square_corner_velocity: 5.0
  50.  
  51. #####################################################################
  52. #   X/Y Stepper Settings
  53. #####################################################################
  54.  
  55. ##  B Stepper - Left
  56. ##  Connected to MOTOR0
  57. ##  Endstop connected to DIAG0
  58. [stepper_x]
  59. step_pin: PF13
  60. dir_pin: PF12
  61. enable_pin: !PF14
  62. rotation_distance: 40
  63. microsteps: 32
  64. full_steps_per_rotation:400  #set to 200 for 1.8 degree stepper
  65. endstop_pin: PG6
  66. position_min: 0
  67. ##--------------------------------------------------------------------
  68.  
  69. ##  Uncomment below for 250mm build
  70. #position_endstop: 250
  71. #position_max: 250
  72.  
  73. ##  Uncomment for 300mm build
  74. #position_endstop: 300
  75. #position_max: 300
  76.  
  77. ##  Uncomment for 350mm build
  78. position_endstop: 350
  79. position_max: 350
  80.  
  81. ##--------------------------------------------------------------------
  82. homing_speed: 50   #Max 100
  83. homing_retract_dist: 5
  84. homing_positive_dir: true
  85.  
  86. ##  Make sure to update below for your relevant driver (2208 or 2209)
  87. [tmc2209 stepper_x]
  88. uart_pin: PC4
  89. interpolate: false
  90. run_current: 1
  91. sense_resistor: 0.110
  92. stealthchop_threshold: 0
  93.  
  94. ##  A Stepper - Right
  95. ##  Connected to MOTOR1
  96. ##  Endstop connected to DIAG1
  97. [stepper_y]
  98. step_pin: PG0
  99. dir_pin: PG1
  100. enable_pin: !PF15
  101. rotation_distance: 40
  102. microsteps: 32
  103. full_steps_per_rotation:400  #set to 200 for 1.8 degree stepper
  104. endstop_pin: PG9
  105. position_min: 0
  106. ##--------------------------------------------------------------------
  107.  
  108. ##  Uncomment for 250mm build
  109. #position_endstop: 250
  110. #position_max: 250
  111.  
  112. ##  Uncomment for 300mm build
  113. #position_endstop: 300
  114. #position_max: 300
  115.  
  116. ##  Uncomment for 350mm build
  117. position_endstop: 357
  118. position_max: 357
  119.  
  120. ##--------------------------------------------------------------------
  121. homing_speed: 50  #Max 100
  122. homing_retract_dist: 5
  123. homing_positive_dir: true
  124.  
  125. ##  Make sure to update below for your relevant driver (2208 or 2209)
  126. [tmc2209 stepper_y]
  127. uart_pin: PD11
  128. interpolate: false
  129. run_current: 1
  130. sense_resistor: 0.110
  131. stealthchop_threshold: 0
  132.  
  133. #####################################################################
  134. #   Z Stepper Settings
  135. #####################################################################
  136.  
  137. ## Z0 Stepper - Front Left
  138. ##  Connected to MOTOR2_1
  139. ##  Endstop connected to DIAG_2
  140. [stepper_z]
  141. step_pin: PF11
  142. dir_pin: PG3
  143. enable_pin: !PG5
  144. rotation_distance: 40
  145. gear_ratio: 80:16
  146. microsteps: 32
  147. endstop_pin: PG10
  148. ##  Z-position of nozzle (in mm) to z-endstop trigger point relative to print surface (Z0)
  149. ##  (+) value = endstop above Z0, (-) value = endstop below
  150. ##  Increasing position_endstop brings nozzle closer to the bed
  151. ##  After you run Z_ENDSTOP_CALIBRATE, position_endstop will be stored at the very end of your config
  152. #position_endstop: -0.5
  153. ##--------------------------------------------------------------------
  154.  
  155. ##  Uncomment below for 250mm build
  156. #position_max: 210
  157.  
  158. ##  Uncomment below for 300mm build
  159. #position_max: 260
  160.  
  161. ##  Uncomment below for 350mm build
  162. position_max: 310
  163.  
  164. ##--------------------------------------------------------------------
  165. position_min: -5
  166. homing_speed: 8
  167. second_homing_speed: 3
  168. homing_retract_dist: 3
  169.  
  170. ##  Make sure to update below for your relevant driver (2208 or 2209)
  171. [tmc2209 stepper_z]
  172. uart_pin: PC6
  173. interpolate: false
  174. run_current: 0.8
  175. sense_resistor: 0.110
  176. stealthchop_threshold: 999999
  177.  
  178. ##  Z1 Stepper - Rear Left
  179. ##  Connected to MOTOR3
  180. [stepper_z1]
  181. step_pin: PG4
  182. dir_pin: !PC1
  183. enable_pin: !PA0
  184. rotation_distance: 40
  185. gear_ratio: 80:16
  186. microsteps: 32
  187.  
  188. ##  Make sure to update below for your relevant driver (2208 or 2209)
  189. [tmc2209 stepper_z1]
  190. uart_pin: PC7
  191. interpolate: false
  192. run_current: 0.8
  193. sense_resistor: 0.110
  194. stealthchop_threshold: 999999
  195.  
  196. ##  Z2 Stepper - Rear Right
  197. ##  Connected to MOTOR4
  198. [stepper_z2]
  199. step_pin: PF9
  200. dir_pin: PF10
  201. enable_pin: !PG2
  202. rotation_distance: 40
  203. gear_ratio: 80:16
  204. microsteps: 32
  205.  
  206. ##  Make sure to update below for your relevant driver (2208 or 2209)
  207. [tmc2209 stepper_z2]
  208. uart_pin: PF2
  209. interpolate: false
  210. run_current: 0.8
  211. sense_resistor: 0.110
  212. stealthchop_threshold: 999999
  213.  
  214. ##  Z3 Stepper - Front Right
  215. ##  Connected to MOTOR5
  216. [stepper_z3]
  217. step_pin: PC13
  218. dir_pin: !PF0
  219. enable_pin: !PF1
  220. rotation_distance: 40
  221. gear_ratio: 80:16
  222. microsteps: 32
  223.  
  224. ##  Make sure to update below for your relevant driver (2208 or 2209)
  225. [tmc2209 stepper_z3]
  226. uart_pin: PE4
  227. interpolate: false
  228. run_current: 0.8
  229. sense_resistor: 0.110
  230. stealthchop_threshold: 999999
  231.  
  232.  
  233. #####################################################################
  234. #   Extruder
  235. #####################################################################
  236.  
  237. ##  Connected to MOTOR_6
  238. ##  Heater - HE0
  239. ##  Thermistor - T0
  240. [extruder]
  241. step_pin: PE2
  242. dir_pin: !PE3
  243. enable_pin: !PD4
  244. ##  Update value below when you perform extruder calibration
  245. ##  If you ask for 100mm of filament, but in reality it is 98mm:
  246. ##  rotation_distance = <previous_rotation_distance> * <actual_extrude_distance> / 100
  247. ##  22.6789511 is a good starting point
  248. rotation_distance: 21.8749822835 #22.905740611   #Bondtech 5mm Drive Gears
  249. ##  Update Gear Ratio depending on your Extruder Type
  250. ##  Use 50:17 for Afterburner/Clockwork (BMG Gear Ratio)
  251. ##  Use 80:20 for M4, M3.1
  252. gear_ratio: 50:17               #BMG Gear Ratio
  253. microsteps: 32
  254. full_steps_per_rotation: 200    #200 for 1.8 degree, 400 for 0.9 degree
  255. nozzle_diameter: 0.800
  256. filament_diameter: 1.75
  257. heater_pin: PA3
  258. ##  Validate the following thermistor type to make sure it is correct
  259. ##  See https://www.klipper3d.org/Config_Reference.html#common-thermistors for additional options
  260. sensor_type: ATC Semitec 104NT-4-R025H42G
  261. sensor_pin: PF4
  262. min_temp: 0
  263. max_temp: 290
  264. max_power: 1.0
  265. min_extrude_temp: 0 #170
  266. #control = pid
  267. #pid_kp = 26.213
  268. #pid_ki = 1.304
  269. #pid_kd = 131.721
  270. ##  Try to keep pressure_advance below 1.0
  271. pressure_advance: 0.0485
  272. ##  Default is 0.040, leave stock
  273. #pressure_advance_smooth_time: 0.040
  274. max_extrude_only_distance: 101
  275.  
  276. ##  E0 on MOTOR6
  277. ##  Make sure to update below for your relevant driver (2208 or 2209)
  278. [tmc2209 extruder]
  279. uart_pin: PE1
  280. interpolate: false
  281. run_current: 0.5
  282. sense_resistor: 0.110
  283. stealthchop_threshold: 0
  284.  
  285.  
  286. #####################################################################
  287. #   Bed Heater
  288. #####################################################################
  289.  
  290. [heater_bed]
  291. ##  SSR Pin - HE1
  292. ##  Thermistor - TB
  293. heater_pin: PA1
  294. ##  Validate the following thermistor type to make sure it is correct
  295. ##  See https://www.klipper3d.org/Config_Reference.html#common-thermistors for additional options
  296. sensor_type: Generic 3950
  297. sensor_pin: PF3
  298. ##  Adjust Max Power so your heater doesn't warp your bed. Rule of thumb is 0.4 watts / cm^2 .
  299. max_power: 0.6
  300. min_temp: 0
  301. max_temp: 120
  302. #control: pid
  303. #pid_kp: 58.437
  304. #pid_ki: 2.347
  305. #pid_kd: 363.769
  306.  
  307. #####################################################################
  308. #   Probe
  309. #####################################################################
  310.  
  311. [probe]
  312. ##  Inductive Probe - DIAG7
  313. ##  This probe is not used for Z height, only Quad Gantry Leveling
  314. pin: PG15
  315. x_offset: 0
  316. y_offset: 25.0
  317. z_offset: 0
  318. speed: 10.0
  319. samples: 5
  320. samples_result: median
  321. sample_retract_dist: 3.0
  322. samples_tolerance: 0.006
  323. samples_tolerance_retries: 5
  324.  
  325. #####################################################################
  326. #   Fan Control
  327. #####################################################################
  328.  
  329. [fan]
  330. ##  Print Cooling Fan - CNC_FAN0
  331. pin: PA8
  332. kick_start_time: 0.5
  333. ##  Depending on your fan, you may need to increase this value
  334. ##  if your fan will not start. Can change cycle_time (increase)
  335. ##  if your fan is not able to slow down effectively
  336. shutdown_speed: 1.0
  337. off_below: 0.10
  338.  
  339. [heater_fan hotend_fan]
  340. ##  Hotend Fan - CNC_FAN1
  341. pin: PE5
  342. max_power: 1.0
  343. kick_start_time: 0.5
  344. heater: extruder
  345. heater_temp: 50.0
  346. ##  If you are experiencing back flow, you can reduce fan_speed
  347. #fan_speed: 1.0
  348.  
  349. [controller_fan controller_fan]
  350. ##  Controller fan - CNC_FAN2
  351. pin: PD12
  352. kick_start_time: 0.5
  353. heater: heater_bed
  354. shutdown_speed: 1.0
  355. fan_speed: 0.5
  356.  
  357. [fan_generic filter_fan]
  358. #  Filter fan - CNC_FAN3
  359. pin: PD13
  360. max_power: 1.0
  361. shutdown_speed: 1.0
  362. kick_start_time: 5.0
  363.  
  364. #####################################################################
  365. #   LED Control
  366. #####################################################################
  367.  
  368. [output_pin caselight]
  369. ## Chamber Lighting - CNC_FAN5
  370. pin: PD15
  371. pwm:true
  372. shutdown_value: 0
  373. value:0
  374. cycle_time: 0.01
  375.  
  376.  
  377. #####################################################################
  378. #   Additional Sensors
  379. #####################################################################
  380.  
  381. [thermistor CMFB103F3950FANT]
  382. temperature1: 0.0
  383. resistance1: 32116.0
  384. temperature2: 40.0
  385. resistance2: 5309.0
  386. temperature3: 80.0
  387. resistance3: 1228.0
  388.  
  389. [temperature_sensor chamber_temp]
  390. ## Chamber Temperature - T1
  391. sensor_type: CMFB103F3950FANT
  392. sensor_pin: PF5
  393. min_temp: 0
  394. max_temp: 100
  395. gcode_id: chamber_th
  396.  
  397. [mcu rpi]
  398. serial: /tmp/klipper_host_mcu
  399.  
  400. [adxl345]
  401. cs_pin: rpi:None
  402.  
  403. [resonance_tester]
  404. accel_chip: adxl345
  405. probe_points:
  406.     175, 175, 20  # an example
  407.  
  408. [input_shaper]
  409. shaper_freq_x: 54.0
  410. shaper_type_x: zv
  411. shaper_freq_y: 39.0
  412. shaper_type_y: mzv
  413.  
  414. [printer]
  415. max_accel: 4300  # should not exceed the estimated max_accel for X and Y axes
  416.  
  417. [filament_switch_sensor switch_sensor]
  418. switch_pin: PG13
  419. pause_on_runout: False
  420. runout_gcode:
  421.   PAUSE # [pause_resume] is required in printer.cfg
  422.   M117 Filament switch runout
  423. insert_gcode:
  424.   M117 Filament switch inserted
  425.  
  426. [filament_motion_sensor encoder_sensor]
  427. switch_pin: PG12
  428. detection_length: 2.88
  429. extruder: extruder
  430. pause_on_runout: False
  431. runout_gcode:
  432.   PAUSE # [pause_resume] is required in printer.cfg
  433.   M117 Filament encoder runout
  434. insert_gcode:
  435.   M117 Filament encoder inserted
  436.  
  437. #####################################################################
  438. #   Homing and Gantry Adjustment Routines
  439. #####################################################################
  440.  
  441. [idle_timeout]
  442. timeout: 1800
  443.  
  444. [safe_z_home]
  445. ##  XY Location of the Z Endstop Switch
  446. ##  Update -10,-10 to the XY coordinates of your endstop pin
  447. ##  (such as 157,305) after going through Z Endstop Pin
  448. ##  Location Definition step.
  449. home_xy_position:232.3,354.0
  450. speed:100
  451. z_hop:10
  452. z_hop_speed:10
  453.  
  454. [quad_gantry_level]
  455. ##  Use QUAD_GANTRY_LEVEL to level a gantry.
  456. ##  Min & Max gantry corners - measure from nozzle at MIN (0,0) and
  457. ##  MAX (250, 250), (300,300), or (350,350) depending on your printer size
  458. ##  to respective belt positions
  459.  
  460. #--------------------------------------------------------------------
  461. ##  Gantry Corners for 250mm Build
  462. ##  Uncomment for 250mm build
  463. #gantry_corners:
  464. #   -60,-10
  465. #   310, 320
  466. ##  Probe points
  467. #points:
  468. #   50,25
  469. #   50,175
  470. #   200,175
  471. #   200,25
  472.    
  473. ##  Gantry Corners for 300mm Build
  474. ##  Uncomment for 300mm build
  475. #gantry_corners:
  476. #   -60,-10
  477. #   360,370
  478. ##  Probe points
  479. #points:
  480. #   50,25
  481. #   50,225
  482. #   250,225
  483. #   250,25
  484.  
  485. #  Gantry Corners for 350mm Build
  486. #  Uncomment for 350mm build
  487. gantry_corners:
  488.    -60,-10
  489.    410,420
  490. #  Probe points
  491. points:
  492.    50,25
  493.    50,275
  494.    300,275
  495.    300,25
  496.  
  497. #--------------------------------------------------------------------
  498. speed: 400
  499. horizontal_move_z: 10
  500. retries: 5
  501. retry_tolerance: 0.0075
  502. max_adjust: 10
  503.  
  504. [bed_mesh]
  505. speed: 400
  506. horizontal_move_z: 5
  507. mesh_min: 35, 35
  508. mesh_max: 315, 315
  509. probe_count: 5, 5
  510.  
  511. ########################################
  512. # EXP1 / EXP2 (display) pins
  513. ########################################
  514.  
  515. [board_pins]
  516. aliases:
  517.     # EXP1 header
  518.     EXP1_1=PE8, EXP1_2=PE7,
  519.     EXP1_3=PE9, EXP1_4=PE10,
  520.     EXP1_5=PE12, EXP1_6=PE13,    # Slot in the socket on this side
  521.     EXP1_7=PE14, EXP1_8=PE15,
  522.     EXP1_9=<GND>, EXP1_10=<5V>,
  523.  
  524.     # EXP2 header
  525.     EXP2_1=PA6, EXP2_2=PA5,
  526.     EXP2_3=PB1, EXP2_4=PA4,
  527.     EXP2_5=PB2, EXP2_6=PA7,      # Slot in the socket on this side
  528.     EXP2_7=PC15, EXP2_8=<RST>,
  529.     EXP2_9=<GND>, EXP2_10=<5V>
  530.  
  531.  
  532.  
  533. #####################################################################
  534. #   Displays
  535. #####################################################################
  536.  
  537. [display]
  538. #  mini12864 LCD Display
  539. lcd_type: uc1701
  540. cs_pin: EXP1_3
  541. a0_pin: EXP1_4
  542. rst_pin: EXP1_5
  543. encoder_pins: ^EXP2_5, ^EXP2_3
  544. click_pin: ^!EXP1_2
  545. contrast: 63
  546. spi_software_miso_pin: EXP2_1
  547. spi_software_mosi_pin: EXP2_6
  548. spi_software_sclk_pin: EXP2_2
  549.  
  550. [neopixel btt_mini12864]
  551. #  To control Neopixel RGB in mini12864 display
  552. pin: EXP1_6
  553. chain_count: 3
  554. initial_RED: 0.1
  555. initial_GREEN: 0.5
  556. initial_BLUE: 0.0
  557. color_order: RGB
  558.  
  559.  
  560. [neopixel sb-neopixel]
  561. pin: PB0
  562. chain_count: 3
  563. initial_RED: 0.0
  564. initial_GREEN: 0.0
  565. initial_Blue: 0.0
  566. initial_WHITE: 1.0
  567. color_order: GRBW
  568.  
  569. [neopixel skirt-neopixel]
  570. pin: PB6
  571. chain_count: 8
  572. initial_RED: 0.0
  573. initial_GREEN: 0.0
  574. initial_Blue: 0.0
  575. color_order: GRB
  576.  
  577. ##  Set RGB values on boot up for each Neopixel.
  578. ##  Index 1 = display, Index 2 and 3 = Knob
  579. [delayed_gcode setdisplayneopixel]
  580. initial_duration: 1
  581. gcode:
  582.         SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=1 TRANSMIT=0
  583.         SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=2 TRANSMIT=0
  584.         SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=3
  585.         SET_LED LED=sb-neopixel RED=1 GREEN=0 BLUE=0 WHITE=0 INDEX=1
  586.         SET_LED LED=sb-neopixel RED=1 GREEN=0 BLUE=0 WHITE=0 INDEX=2
  587.         SET_LED LED=sb-neopixel RED=1 GREEN=0 BLUE=0 WHITE=0 INDEX=3
  588.  
  589. [delayed_gcode setskirtneopixel]
  590. initial_duration: 5
  591. gcode:
  592.       SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=1
  593.       G4 P100
  594.       SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=2
  595.       G4 P100
  596.       SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=3
  597.       G4 P100
  598.       SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=4
  599.       G4 P100
  600.       SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=5
  601.       G4 P100
  602.       SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=6
  603.       G4 P100
  604.       SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=7
  605.       G4 P100
  606.       SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=8
  607.  
  608. [output_pin beeper]
  609. pin: EXP1_1
  610. value: 0
  611. shutdown_value: 0
  612. pwm: True
  613. cycle_time: 0.0005 ; Default beeper tone in kHz. 1 / 0.0005 = 2000Hz (2kHz)
  614.  
  615. [gcode_macro BEEP]
  616. gcode:
  617.     # Parameters
  618.     {% set i = params.I|default(1)|int %}           ; Iterations (number of times to beep).
  619.     {% set dur = params.DUR|default(100)|int %}     ; Duration/wait of each beep in ms. Default 100ms.
  620.     {% set freq = params.FREQ|default(2000)|int %}  ; Frequency in Hz. Default 2kHz.
  621.  
  622.     {% for iteration in range(i|int) %}
  623.         SET_PIN PIN=beeper VALUE=0.8 CYCLE_TIME={ 1.0/freq if freq > 0 else 1 }
  624.         G4 P{dur}
  625.         SET_PIN PIN=beeper VALUE=0
  626.         G4 P{dur}
  627.     {% endfor %}
  628.  
  629.  
  630. #--------------------------------------------------------------------
  631.  
  632.  
  633. #####################################################################
  634. #   Macros
  635. #####################################################################
  636.  
  637. [exclude_object]
  638.  
  639. [gcode_macro G32]
  640. gcode:
  641.     G28
  642.     QUAD_GANTRY_LEVEL
  643.     G28
  644.     ##  Uncomment for for your size printer:
  645.     #--------------------------------------------------------------------
  646.     ##  Uncomment for 250mm build
  647.     #G0 X125 Y125 Z30 F3600
  648.    
  649.     ##  Uncomment for 300 build
  650.     #G0 X150 Y150 Z30 F3600
  651.    
  652.     ##  Uncomment for 350mm build
  653.     #G0 X175 Y175 Z30 F3600
  654.     #--------------------------------------------------------------------
  655.  
  656. [gcode_macro CG28]
  657. gcode:
  658.     {% if "xyz" not in printer.toolhead.homed_axes %}
  659.         G28
  660.     {% endif %}
  661.  
  662. [gcode_macro PRINT_START]
  663. #   Use PRINT_START for the slicer starting script - please customise for your slicer of choice
  664. gcode:
  665.     SET_LED LED=sb-neopixel RED=0 GREEN=0 BLUE=0 WHITE=1 INDEX=2
  666.     SET_LED LED=sb-neopixel RED=0 GREEN=0 BLUE=0 WHITE=1 INDEX=3
  667.     SET_LED LED=btt_mini12864 RED=1 GREEN=1 BLUE=1 INDEX=1
  668.     SET_LED LED=btt_mini12864 RED=1 GREEN=1 BLUE=1 INDEX=2
  669.     SET_PIN PIN=caselight VALUE=0.5 ; turn case light off
  670.     SET_LED LED=skirt-neopixel RED=1 GREEN=1 BLUE=1 INDEX=1
  671.     G4 P100
  672.     SET_LED LED=skirt-neopixel RED=1 GREEN=1 BLUE=1 INDEX=2
  673.     G4 P100
  674.     SET_LED LED=skirt-neopixel RED=1 GREEN=1 BLUE=1 INDEX=3
  675.     G4 P100
  676.     SET_LED LED=skirt-neopixel RED=1 GREEN=1 BLUE=1 INDEX=4
  677.     G4 P100
  678.     SET_LED LED=skirt-neopixel RED=1 GREEN=1 BLUE=1 INDEX=5
  679.     G4 P100
  680.     SET_LED LED=skirt-neopixel RED=1 GREEN=1 BLUE=1 INDEX=6
  681.     G4 P100
  682.     SET_LED LED=skirt-neopixel RED=1 GREEN=1 BLUE=1 INDEX=7
  683.     G4 P100
  684.     SET_LED LED=skirt-neopixel RED=1 GREEN=1 BLUE=1 INDEX=8
  685.     G4 P100;
  686.  
  687.     G32                            ; home all axes
  688.     G1 Z20 F3000                   ; move nozzle away from bed
  689.     G1 X20 Y20 F5000               ; move so it doesn't crash into bed on startup
  690.    PRIME_NOZZLE
  691.  
  692.    NEOPIXEL_DISPLAY LED="skirt-neopixel" TYPE=print_percent MODE=progress
  693.    
  694.  
  695. [delayed_gcode post_print]
  696. gcode:
  697.  SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=1 TRANSMIT=0
  698.  SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=2 TRANSMIT=0
  699.  SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=3
  700.  SET_LED LED=sb-neopixel RED=0 GREEN=0 BLUE=0 WHITE=1 INDEX=1
  701.  SET_LED LED=sb-neopixel RED=1 GREEN=0 BLUE=0 WHITE=0 INDEX=2
  702.  SET_LED LED=sb-neopixel RED=1 GREEN=0 BLUE=0 WHITE=0 INDEX=3
  703.  SET_FAN_SPEED FAN=filter_fan SPEED=0
  704.  SET_PIN PIN=caselight VALUE=0 ; turn case light off
  705.  SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=1
  706.  G4 P100
  707.  SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=2
  708.  G4 P100
  709.  SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=3
  710.  G4 P100
  711.  SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=4
  712.  G4 P100
  713.  SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=5
  714.  G4 P100
  715.  SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=6
  716.  G4 P100
  717.  SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=7
  718.  G4 P100
  719.  SET_LED LED=skirt-neopixel RED=1 GREEN=0 BLUE=0 INDEX=8
  720.  
  721.  
  722.  
  723. [gcode_macro PRINT_END]
  724. #   Use PRINT_END for the slicer ending script - please customise for your slicer of choice
  725. gcode:
  726.    # safe anti-stringing move coords
  727.    {% set th = printer.toolhead %}
  728.    {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %}
  729.    {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %}
  730.    {% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %}
  731.    
  732.    SAVE_GCODE_STATE NAME=STATE_PRINT_END
  733.    
  734.    M400                           ; wait for buffer to clear
  735.    G92 E0                         ; zero the extruder
  736.    G1 E-18.0 F800                 ; retract filament
  737.    
  738.    TURN_OFF_HEATERS
  739.    
  740.    G90                                      ; absolute positioning
  741.    G0 X{x_safe} Y{y_safe} Z{z_safe} F20000  ; move nozzle to remove stringing
  742.    G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600  ; park nozzle at rear
  743.    M107                                     ; turn off fan
  744.    
  745.    BED_MESH_CLEAR
  746.    RESTORE_GCODE_STATE NAME=STATE_PRINT_END
  747.  
  748.    SET_LED LED=sb-neopixel RED=0 GREEN=1 BLUE=0 WHITE=0 INDEX=2
  749.    SET_LED LED=sb-neopixel RED=0 GREEN=1 BLUE=0 WHITE=0 INDEX=3
  750.    SET_LED LED=btt_mini12864 RED=0 GREEN=1 BLUE=0 INDEX=1
  751.    SET_LED LED=btt_mini12864 RED=0 GREEN=1 BLUE=0 INDEX=2
  752.    SET_FAN_SPEED FAN=filter_fan SPEED=1
  753.    M84;
  754.    UPDATE_DELAYED_GCODE ID=post_print DURATION=600
  755.  
  756. [gcode_macro OFF]
  757. gcode:
  758.    SET_LED LED=sb-neopixel RED=1 GREEN=0 BLUE=0 WHITE=0 INDEX=1
  759.    SET_LED LED=sb-neopixel RED=0 GREEN=0 BLUE=0 WHITE=0 INDEX=2
  760.    SET_LED LED=sb-neopixel RED=0 GREEN=0 BLUE=0 WHITE=0 INDEX=3
  761.    SET_LED LED=btt_mini12864 RED=0 GREEN=0 BLUE=0 INDEX=1
  762.    SET_LED LED=btt_mini12864 RED=0 GREEN=0 BLUE=0 INDEX=2
  763.    SET_LED LED=btt_mini12864 RED=0 GREEN=0 BLUE=0 INDEX=3
  764.  
  765.    SET_LED LED=skirt-neopixel RED=0 GREEN=0 BLUE=0 INDEX=1
  766.    G4 P500
  767.    SET_LED LED=skirt-neopixel RED=0 GREEN=0 BLUE=0 INDEX=2
  768.    G4 P500
  769.    SET_LED LED=skirt-neopixel RED=0 GREEN=0 BLUE=0 INDEX=3
  770.    G4 P500
  771.    SET_LED LED=skirt-neopixel RED=0 GREEN=0 BLUE=0 INDEX=4
  772.    G4 P500
  773.    SET_LED LED=skirt-neopixel RED=0 GREEN=0 BLUE=0 INDEX=5
  774.    G4 P500
  775.    SET_LED LED=skirt-neopixel RED=0 GREEN=0 BLUE=0 INDEX=6
  776.    G4 P500
  777.    SET_LED LED=skirt-neopixel RED=0 GREEN=0 BLUE=0 INDEX=7
  778.    G4 P500
  779.    SET_LED LED=skirt-neopixel RED=0 GREEN=0 BLUE=0 INDEX=8
  780.    G4 P500
  781.  
  782.    M84                                  ; turn steppers off
  783.    TURN_OFF_HEATERS                     ; turn bed / hotend off
  784.    M107                                 ; turn print cooling fan off
  785.  
  786.    #SET_PIN PIN=caselight VALUE=0 ; turn case light off
  787.  
  788. [gcode_macro PRIME_NOZZLE]
  789. gcode:
  790.  # SAVE_GCODE_STATE NAME=STATE_NOZZLE_PRIME
  791.  # G92 E0
  792.  # G1 X0 Y0 F5000;
  793.  # G1 Z0.2 F3000;
  794.  # G1 X300.00 E50 F500.0 ; intro line
  795.  # G4 P10000 ; pause for 10secs to hopefullt finish oozing
  796.  # G1 X0 F5000; Clear intro line
  797.  # RESTORE_GCODE_STATE NAME=STATE_NOZZLE_PRIME
  798.  # G28; rehome ready for print
  799.  CLEAN_NOZZLE
  800.  G1 X20 Y20 F5000               ; move so it doesn't crash into bed on startup
  801.  
  802. [gcode_macro SWAP_NOZZLE]
  803. gcode:
  804.   M104 S0;
  805.   SAVE_GCODE_STATE NAME=STATE_NOZZLE_SWAP
  806.   CG28
  807.   M106;
  808.   G1 X10 Y10 Z100 F3000;
  809.   TEMPERATURE_WAIT SENSOR=extruder MAXIMUM=60;
  810.   M107
  811.   BEEP I=3
  812.   RESTORE_GCODE_STATE NAME=STATE_NOZZLE_SWAP
  813.  
  814.  
  815. [gcode_macro SHUTDOWN]
  816. gcode:
  817.     #LCDRGB R=0 G=0 B=0                               ; Turn off LCD neopixels (see above for this macro)
  818.     OFF                ; Shortcut to turn everything off (see above for this macro)
  819.     G4 P500
  820.     M400;
  821.     {action_respond_info('action:poweroff')}          ; OctoPrint compatible host shutdown
  822.     {action_call_remote_method("shutdown_machine")}   ; Moonraker compatible host shutdown
  823.  
  824. [menu __main __control __swapNozzle]
  825. type: command
  826. enable: {not printer.idle_timeout.state == "Printing"}
  827. name: Swap nozzle
  828. gcode: SWAP_NOZZLE
  829.  
  830. [menu __main __control __shutdown]
  831. type: command
  832. enable: {not printer.idle_timeout.state == "Printing"}
  833. name: Shut down
  834. gcode: SHUTDOWN
  835.  
  836. [virtual_sdcard]
  837. path:~/uploads/
  838.  
  839. # [gcode_macro PAUSE]
  840. # rename_existing: PAUSE_BASE
  841. # gcode:
  842. #     CLEAR_PAUSE
  843. #     # Parameters
  844. #     {% set z = params.Z|default(10)|int %}                                                   ; z hop amount
  845.    
  846. #     {% if printer['pause_resume'].is_paused|int == 0 %}    
  847. #         SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z}                              ; set z hop variable for reference in resume macro
  848. #         SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target}    ; set hotend temp variable for reference in resume macro
  849.                                
  850. #         SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0                                  ; disable filament sensor      
  851. #         SAVE_GCODE_STATE NAME=PAUSE                                                          ; save current print position for resume                
  852. #         BASE_PAUSE                                                                           ; pause print
  853. #         {% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %}       ; check that zhop doesn't exceed z max
  854. #             G91                                                                              ; relative positioning
  855. #             G1 Z{z} F900                                                                     ; raise Z up by z hop amount
  856. #         {% else %}
  857. #             { action_respond_info("Pause zhop exceeds maximum Z height.") }                  ; if z max is exceeded, show message and set zhop value for resume to 0
  858. #             SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
  859. #         {% endif %}
  860. #         G90                                                                                  ; absolute positioning
  861. #         G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000   ; park toolhead at front center
  862. #         SAVE_GCODE_STATE NAME=PAUSEPARK                                                      ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error)
  863. #         M104 S0                                                                              ; turn off hotend
  864. #         SET_IDLE_TIMEOUT TIMEOUT=43200                                                       ; set timeout to 12 hours
  865. #     {% endif %}
  866.  
  867. [gcode_macro RESUME]
  868. rename_existing: RESUME_BASE
  869. variable_zhop: 0
  870. variable_etemp: 0
  871. gcode:
  872.     # Parameters
  873.     {% set e = params.E|default(2.5)|int %}                                          ; hotend prime amount (in mm)
  874.    
  875.     {% if printer['pause_resume'].is_paused|int == 1 %}
  876.         SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1                          ; enable filament sensor
  877.         #RESETRGB                                                                    ; reset LCD color
  878.         SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout}  ; set timeout back to configured value
  879.         {% if etemp > 0 %}
  880.             M109 S{etemp|int}                                                        ; wait for hotend to heat back up
  881.         {% endif %}
  882.         RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100                     ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error)  
  883.         G91                                                                          ; relative positioning
  884.         M83                                                                          ; relative extruder positioning
  885.         {% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %}                                                
  886.             G1 Z{zhop * -1} E{e} F900                                                ; prime nozzle by E, lower Z back down
  887.         {% else %}                      
  888.             G1 Z{zhop * -1} F900                                                     ; lower Z back down without priming (just in case we are testing the macro with cold hotend)
  889.         {% endif %}                            
  890.         RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60                          ; restore position
  891.         BASE_RESUME                                                                  ; resume print
  892.     {% endif %}
  893.  
  894. # Home, get position, throw around toolhead, home again.
  895. # If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured.
  896. # We only measure to a full step to accomodate for endstop variance.
  897. # Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10
  898.  
  899. [gcode_macro TEST_SPEED]
  900. gcode:
  901.     # Speed
  902.     {% set speed  = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
  903.     # Iterations
  904.     {% set iterations = params.ITERATIONS|default(5)|int %}
  905.     # Acceleration
  906.     {% set accel  = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
  907.     # Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
  908.     {% set bound = params.BOUND|default(20)|int %}
  909.     # Size for small pattern box
  910.     {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %}
  911.    
  912.     # Large pattern
  913.         # Max positions, inset by BOUND
  914.         {% set x_min = printer.toolhead.axis_minimum.x + bound %}
  915.         {% set x_max = printer.toolhead.axis_maximum.x - bound %}
  916.         {% set y_min = printer.toolhead.axis_minimum.y + bound %}
  917.         {% set y_max = printer.toolhead.axis_maximum.y - bound %}
  918.    
  919.     # Small pattern at center
  920.         # Find X/Y center point
  921.         {% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %}
  922.         {% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %}
  923.        
  924.         # Set small pattern box around center point
  925.         {% set x_center_min = x_center - (smallpatternsize/2) %}
  926.         {% set x_center_max = x_center + (smallpatternsize/2) %}
  927.         {% set y_center_min = y_center - (smallpatternsize/2) %}
  928.         {% set y_center_max = y_center + (smallpatternsize/2) %}
  929.  
  930.     # Save current gcode state (absolute/relative, etc)
  931.     SAVE_GCODE_STATE NAME=TEST_SPEED
  932.    
  933.     # Output parameters to g-code terminal
  934.     { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) }
  935.    
  936.     # Home and get position for comparison later:
  937.         G28
  938.         # QGL if not already QGLd (only if QGL section exists in config)
  939.         {% if printer.configfile.settings.quad_gantry_level %}
  940.             {% if printer.quad_gantry_level.applied == False %}
  941.                 QUAD_GANTRY_LEVEL
  942.                 G28 Z
  943.             {% endif %}
  944.         {% endif %}
  945.         G90
  946.         G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
  947.         G4 P1000
  948.         GET_POSITION
  949.  
  950.     # Go to starting position
  951.     G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60}
  952.  
  953.     # Set new limits
  954.     SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2}
  955.  
  956.     {% for i in range(iterations) %}
  957.         # Large pattern
  958.             # Diagonals
  959.             G0 X{x_min} Y{y_min} F{speed*60}
  960.             G0 X{x_max} Y{y_max} F{speed*60}
  961.             G0 X{x_min} Y{y_min} F{speed*60}
  962.             G0 X{x_max} Y{y_min} F{speed*60}
  963.             G0 X{x_min} Y{y_max} F{speed*60}
  964.             G0 X{x_max} Y{y_min} F{speed*60}
  965.            
  966.             # Box
  967.             G0 X{x_min} Y{y_min} F{speed*60}
  968.             G0 X{x_min} Y{y_max} F{speed*60}
  969.             G0 X{x_max} Y{y_max} F{speed*60}
  970.             G0 X{x_max} Y{y_min} F{speed*60}
  971.        
  972.         # Small pattern
  973.             # Small diagonals
  974.             G0 X{x_center_min} Y{y_center_min} F{speed*60}
  975.             G0 X{x_center_max} Y{y_center_max} F{speed*60}
  976.             G0 X{x_center_min} Y{y_center_min} F{speed*60}
  977.             G0 X{x_center_max} Y{y_center_min} F{speed*60}
  978.             G0 X{x_center_min} Y{y_center_max} F{speed*60}
  979.             G0 X{x_center_max} Y{y_center_min} F{speed*60}
  980.            
  981.             # Small box
  982.             G0 X{x_center_min} Y{y_center_min} F{speed*60}
  983.             G0 X{x_center_min} Y{y_center_max} F{speed*60}
  984.             G0 X{x_center_max} Y{y_center_max} F{speed*60}
  985.             G0 X{x_center_max} Y{y_center_min} F{speed*60}
  986.     {% endfor %}
  987.  
  988.     # Restore max speed/accel/accel_to_decel to their configured values
  989.     SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}
  990.  
  991.     # Re-home and get position again for comparison:
  992.         G28
  993.         # Go to XY home positions (in case your homing override leaves it elsewhere)
  994.         G90
  995.         G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
  996.         G4 P1000
  997.         GET_POSITION
  998.  
  999.     # Restore previous gcode state (absolute/relative, etc)
  1000.     RESTORE_GCODE_STATE NAME=TEST_SPEED
  1001. #   The path of the local directory on the host machine to look for
  1002. #   g-code files. This is a read-only directory (sdcard file writes
  1003. #   are not supported). One may point this to OctoPrint's upload
  1004. #   directory (generally ~/.octoprint/uploads/ ). This parameter must
  1005. #   be provided.
  1006.  
  1007. #*# <---------------------- SAVE_CONFIG ---------------------->
  1008. #*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
  1009. #*#
  1010. #*# [heater_bed]
  1011. #*# control = pid
  1012. #*# pid_kp = 39.781
  1013. #*# pid_ki = 1.434
  1014. #*# pid_kd = 275.983
  1015. #*#
  1016. #*# [extruder]
  1017. #*# control = pid
  1018. #*# pid_kp = 37.838
  1019. #*# pid_ki = 6.818
  1020. #*# pid_kd = 52.500
  1021. #*#
  1022. #*# [stepper_z]
  1023. #*# position_endstop = 2.525
  1024.  
Advertisement
Add Comment
Please, Sign In to add comment