diff --git a/macros.cfg b/macros.cfg new file mode 100644 index 0000000..9f5b678 --- /dev/null +++ b/macros.cfg @@ -0,0 +1,195 @@ +[gcode_macro START_PRINT] +description: start printing +gcode: + {% set BED_TEMP = params.BED_TEMP|default(60)|float %} + {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %} + M117 start heating + M140 S{BED_TEMP} # start bed heating + M104 S{EXTRUDER_TEMP} # start extruder heating + G92 E0 # reset extruder + G21 # set units to millimeters + G90 # use absolute coordinates + M83 # use relative distances for extrusion + SET_GCODE_OFFSET Z=0.0 # reset the G-Code Z offset + M117 home + G28 # home the printer + G1 Z5 F3000 # move the nozzle near the bed + G1 Z0.15 F300 # move the nozzle very close to the bed + M117 wait for heating + M190 S{BED_TEMP} # set and wait for bed temperature + M109 S{EXTRUDER_TEMP} # set and wait for nozzle temperature + # clean nozzle + M117 clean nozzle + G0 Z5 F300 # move Z to travel height + G0 X40 Y0 F5000 # move to start position + G0 Z0.2 F1500 # lower Z + G0 X150 Y0 Z0.2 E10 # draw line + G0 X150 Y0.8 Z0.2 # move to the side little + G0 X30 Y0.8 Z0.2 E5 # draw fine line + G0 Z5 F300 # move Z to travel height + M117 starting + +[gcode_macro END_PRINT] +description: end printing +gcode: + M140 S0 # Turn off bed + M104 S0 # Turn off extruder + M106 S0 # Turn off fan + G91 # Use relativ coordinates + G1 X-2 Y-2 E-3 F300 # Move nozzle away from print while retracting + G1 Z10 F3000 # Raise nozzle by 10mm + G1 Z10 F3000 # Raise nozzle by 10mm + G90 # Use absolute coordinates + M84 # Disable steppers + +[gcode_macro PREHEAT] +description: set bed and extruder temperature +gcode: + {% set BED_TEMP = params.BED_TEMP|default(0)|float %} + {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %} + M117 start heating + M140 S{BED_TEMP} # start bed heating + M104 S{EXTRUDER_TEMP} # start extruder heating + M109 S{EXTRUDER_TEMP} # set and wait for nozzle temperature + M117 done + +[gcode_macro PAUSE] +description: Pause the actual running print +rename_existing: PAUSE_BASE +gcode: + {% set x = params.X|default(160) %} + {% set y = params.Y|default(20) %} + {% set z = params.Z|default(10)|float %} + {% set e = params.E|default(1) %} + ## calculate save lift position + {% set max_z = printer.toolhead.axis_maximum.z|float %} + {% set act_z = printer.toolhead.position.z|float %} + {% set lift_z = z|abs %} + {% if act_z < (max_z - lift_z) %} + {% set z_safe = lift_z %} + {% else %} + {% set z_safe = max_z - act_z %} + {% endif %} + 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} + G90 + G1 X{x} Y{y} F6000 + {% else %} + {action_respond_info("Printer not homed")} + {% endif %} + +[gcode_macro RESUME] +description: Resume the actual running print +rename_existing: RESUME_BASE +gcode: + {% set e = params.E|default(1) %} + {% if 'VELOCITY' in params|upper %} + {% set get_params = ('VELOCITY=' + params.VELOCITY) %} + {%else %} + {% set get_params = "" %} + {% endif %} + G91 + {% if printer.extruder.can_extrude|lower == 'true' %} + 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 + CANCEL_PRINT_BASE + +[gcode_macro UNLOAD] +description: unload filament +gcode: + {% if printer.extruder.can_extrude|lower == 'true' %} + M83 # e relative coordinates + G0 E-370 F3000 # unload + M82 # e absolute coordinates + {% else %} + {action_respond_info("extruder not hot enough")} + {% endif %} + +[gcode_macro LOAD] +description: load filament +gcode: + {% if printer.extruder.can_extrude|lower == 'true' %} + M83 # e relative coordinates + G0 E350 F3000 + G0 E30 F300 + M82 # e absolute coordinates + {% else %} + {action_respond_info("extruder not hot enough")} + {% endif %} + +[gcode_macro PURGE] +description: purge filament +gcode: + {% set e = params.e|default(10)|float %} + {% if printer.extruder.can_extrude|lower == 'true' %} + M83 # e relative coordinates + G1 E-{e} F300 + M82 # e absolute coordinates + {% else %} + {action_respond_info("extruder not hot enough")} + {% endif %} + + +# [gcode_macro POWER_ON] +# description: power on the printer +# gcode: +# {action_call_remote_method("set_device_power", device="prusa", state="on")} + +# [gcode_macro POWER_OFF] +# description: power off the printer +# gcode: +# {action_call_remote_method("set_device_power", device="prusa", state="off")} + +[gcode_macro M600] +description: Change filament +gcode: + SAVE_GCODE_STATE NAME=M600_state + PAUSE + UNLOAD + M117 change filament + RESTORE_GCODE_STATE NAME=M600_state + +[gcode_macro G29] +description: Bed Leveling +gcode: + {% if "xyz" not in printer.toolhead.homed_axes %} + G28 + {% endif %} + BED_MESH_CALIBRATE + +## Remove unused gcodes +[gcode_macro M201] +description: Set Print Max Acceleration +gcode: + G4 + +[gcode_macro M203] +description: Set Max Feedrate +gcode: + G4 + +[gcode_macro M205] +description: Set Advanced Settings +gcode: + G4 + +[gcode_macro M900] +description: Linear Advance Factor +gcode: + G4 diff --git a/mainsail.cfg b/mainsail.cfg deleted file mode 100644 index 60b746d..0000000 --- a/mainsail.cfg +++ /dev/null @@ -1,53 +0,0 @@ -[virtual_sdcard] -path: /home/pi/gcode_files - -[pause_resume] - -[display_status] - -[gcode_macro CANCEL_PRINT] -rename_existing: BASE_CANCEL_PRINT -gcode: - TURN_OFF_HEATERS - CLEAR_PAUSE - SDCARD_RESET_FILE - BASE_CANCEL_PRINT - -[gcode_macro PAUSE] -rename_existing: BASE_PAUSE -# 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 ##### - SAVE_GCODE_STATE NAME=PAUSE_state - BASE_PAUSE - G91 - G1 E-{E} F2100 - G1 Z{z_safe} F900 - G90 - G1 X{x_park} Y{y_park} F6000 - -[gcode_macro RESUME] -rename_existing: BASE_RESUME -gcode: - ##### read E from pause macro ##### - {% set E = printer["gcode_macro PAUSE"].extrude|float %} - ##### end of definitions ##### - G91 - G1 E{E} F2100 - RESTORE_GCODE_STATE NAME=PAUSE_state - BASE_RESUME diff --git a/moonraker.conf b/moonraker.conf index 25f4ea7..52769f3 100644 --- a/moonraker.conf +++ b/moonraker.conf @@ -1,3 +1,4 @@ +# vim: ft=cfg [server] host: 0.0.0.0 port: 7125 @@ -5,7 +6,6 @@ enable_debug_logging: False config_path: ~/klipper_config [authorization] -enabled: True cors_domains: https://my.mainsail.xyz http://my.mainsail.xyz @@ -28,8 +28,51 @@ trusted_clients: # this enables moonraker's update manager [update_manager] +enable_repo_debug: True +# When set to True moonraker will bypass repo validation and allow +# updates from unofficial remotes and/or branches. Updates on +# detached repos are also allowed. This option is intended for +# developers and should not be used on production machines. The +# default is False. +enable_auto_refresh: False +# When set to True Moonraker will attempt to fetch status about +# available updates roughly every 24 hours, between 12am-4am. +# When set to False Moonraker will only fetch update state on startup +# and clients will need to request that Moonraker updates state. The +# default is False. +enable_system_updates: True +# A boolean value that can be used to toggle system package updates. +# Currently Moonraker only supports updating packages via APT, so +# this option is useful for users that wish to experiment with linux +# distros that use other package management applications, or users +# that prefer to manage their packages directly. Note that if this +# is set to False users will be need to make sure that all system +# dependencies are up to date. The default is True. +channel: dev +# The update channel applied to Klipper and Moonraker. May be 'dev' +# which will fetch updates using git, or 'beta' which will fetch +# zipped beta releases. Note that this channel does not apply to +# client updates, a client's update channel is determined by its +# 'type' option. When this option is changed the next "update" will +# swap channels, any untracked files in the application's path will be +# removed during this process. The default is dev. [update_manager client mainsail] type: web repo: meteyou/mainsail -path: ~/mainsail \ No newline at end of file +path: ~/mainsail + +# [update_manager klipper] +# type: git_repo +# # venv_args: -p python2 +# path: ~/klipper +# is_system_service: True +# origin: https://github.com/matthewlloyd/klipper +# primary_branch: prusamini +# enable_node_updates: false +# requirements: scripts/klippy-requirements.txt +# install_script: scripts/install-octopi.sh + +[power prusa] +type: tplink_smartplug +address: 192.168.11.91 diff --git a/printer.cfg b/printer.cfg index dcc7069..bcfe878 100644 --- a/printer.cfg +++ b/printer.cfg @@ -1,189 +1,43 @@ -# This file contains common configurations and pin mappings for the Prusa -# Mini+, which uses the Prusa Buddy board. - -# To use this config, the firmware should be compiled for the STM32F407. When -# running "make menuconfig", enable "extra low-level configuration setup", -# select the "128KiB + 512 byte offset" bootloader, and USB communication. -# Connect the printer to your Raspberry Pi using the printer's micro-USB port. -# If you prefer to remove Prusa's stock bootloader entirely, select the -# "No bootloader" option. - -# When flashing for the first time, you will need to break the "appendix" -# on the Buddy board, then put the device into DFU mode by moving the jumper -# on the 3-pin header (older boards) or shorting the 2-pin header (newer boards) -# and resetting, and finally use "make flash" to install Klipper. Once Klipper is -# installed, you no longer need the jumper - just use "make flash" which will -# automatically put the device into DFU mode. - -# Note that if you were previously running Prusa firmware, you must fully -# power cycle the board after flashing. Otherwise, Klipper will be unable to -# communicate with the TMC2209s due to the abrupt change in the baud rate, -# and will show this error: "Unable to read tmc uart register IFCNT". - -# See docs/Config_Reference.md for a description of parameters. - -## gcode macros -# custom slicer START_PRINT and END_PRINT macros -[gcode_macro START_PRINT] -description: start printing -gcode: - {% set BED_TEMP = params.BED_TEMP|default(60)|float %} - {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %} - M140 S{BED_TEMP} # start bed heating - M104 S{EXTRUDER_TEMP} # start extruder heating - G90 # use absolute coordinates - G92 E0 # reset extruder - # SET_GCODE_OFFSET Z=0.0 # reset the G-Code Z offset (adjust Z offset if needed) - G28 # home the printer - G1 Z5 F3000 # move the nozzle near the bed - G1 Z0.15 F300 # move the nozzle very close to the bed - M190 S{BED_TEMP} # wait for bed temperature - M109 S{EXTRUDER_TEMP} # set and wait for nozzle temperature - # clean nozzle - G0 Z5 F300 # move Z to travel height - G0 X40 Y0 F5000 # move to start position - G0 Z0.2 F1500 # lower Z - G0 X150 Y0 Z0.2 E15 # draw line - G0 X150 Y0.4 Z0.2 # move to the side little - G0 X30 Y0.4 Z0.2 E30 # draw line - G0 Z5 F300 # move Z to travel height - -[gcode_macro END_PRINT] -description: end printing -gcode: - M140 S0 # Turn off bed - M104 S0 # Turn off extruder - M106 S0 # Turn off fan - G91 # Use relativ coordinates - G1 X-2 Y-2 E-3 F300 # Move nozzle away from print while retracting - G1 Z10 F3000 # Raise nozzle by 10mm - G90 # Use absolute coordinates - M84 # Disable steppers - -[gcode_macro PAUSE] -description: Pause the actual running print -rename_existing: PAUSE_BASE -gcode: - ## set defaults - {% set x = params.X|default(160) %} - {% set y = params.Y|default(20) %} - {% set z = params.Z|default(10)|float %} - {% set e = params.E|default(1) %} - ## calculate save lift position - {% set max_z = printer.toolhead.axis_maximum.z|float %} - {% set act_z = printer.toolhead.position.z|float %} - {% set lift_z = z|abs %} - {% if act_z < (max_z - lift_z) %} - {% set z_safe = lift_z %} - {% else %} - {% set z_safe = max_z - act_z %} - {% endif %} - 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} - G90 - G1 X{x} Y{y} F6000 - {% else %} - {action_respond_info("Printer not homed")} - {% endif %} - -[gcode_macro RESUME] -description: Resume the actual running print -rename_existing: RESUME_BASE -gcode: - ## set defaults - {% set e = params.E|default(1) %} - {% if 'VELOCITY' in params|upper %} - {% set get_params = ('VELOCITY=' + params.VELOCITY) %} - {%else %} - {% set get_params = "" %} - {% endif %} - G91 - {% if printer.extruder.can_extrude|lower == 'true' %} - 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 - CANCEL_PRINT_BASE - -[gcode_macro UNLOAD] -description: unload filament -gcode: - {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %} - M104 S{EXTRUDER_TEMP} # heat extruder - G91 # relative coordinates - G0 E-370 F3000 # unload - G90 # absolute coordinates - -[gcode_macro LOAD] -description: load filament -gcode: - {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %} - M117 heating extruder to {EXTRUDER_TEMP} - M104 S{EXTRUDER_TEMP} # heat extruder - M109 S{EXTRUDER_TEMP} # wait for extruder temperature - G91 # relative coordinates - G0 E350 F3000 # load almost to nozzle - G0 E30 F300 # slowly purge - G90 # absolute coordinates - -[gcode_macro M600] -description: Change filament -gcode: - SAVE_GCODE_STATE NAME=M600_state - PAUSE - UNLOAD - M117 change filament - RESTORE_GCODE_STATE NAME=M600_state - -## Remove unused gcodes -[gcode_macro G29] -description: Bed Leveling -gcode: - G4 - -[gcode_macro M201] -description: Set Print Max Acceleration -gcode: - G4 - -[gcode_macro M203] -description: Set Max Feedrate -gcode: - G4 - -[gcode_macro M205] -description: Set Advanced Settings -gcode: - G4 - -[gcode_macro M900] -description: Linear Advance Factor -gcode: - G4 - +## +# Prusa Mini+ +## ## general configuration -[pause_resume] +[mcu] +serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_2B0024001547393432343038-if00 +restart_method: command -[display_status] +[printer] +kinematics: cartesian +# Prusa firmware defaults. +max_velocity: 180 +max_accel: 1250 +max_z_velocity: 12 +max_z_accel: 400 [virtual_sdcard] path: ~/gcode_files +## macros +[include macros.cfg] + +## web +[pause_resume] + +[display_status] + +[respond] +default_type: echo +# Sets the default prefix of the "M118" and "RESPOND" output to one +# of the following: +# echo: "echo: " (This is the default) +# command: "// " +# error: "!! " +# default_prefix: echo: +# Directly sets the default prefix. If present, this value will +# override the "default_type". + +## stepper [stepper_x] step_pin: PD1 dir_pin: PD0 @@ -220,27 +74,7 @@ endstop_pin: probe:z_virtual_endstop position_min: -3 position_max: 185 -[extruder] -step_pin: PD9 -dir_pin: !PD8 -enable_pin: !PD10 -microsteps: 16 -rotation_distance: 26.2564 # (200 * 16 * 48/18) / 325 -gear_ratio: 48:18 -nozzle_diameter: 0.400 -filament_diameter: 1.750 -heater_pin: PB1 -sensor_type: ATC Semitec 104GT-2 -sensor_pin: PC0 -#control: pid -# Prusa's firmware defaults. -#pid_Kp: 7 -#pid_Ki: 0.5 -#pid_Kd: 45 -min_temp: 10 -max_temp: 305 -max_extrude_only_distance: 800.0 - +## tmc [tmc2209 stepper_x] uart_pin: PD5 uart_address: 1 @@ -276,12 +110,44 @@ driver_SGTHRS: 100 run_current: 0.4 sense_resistor: 0.22 +## display +[display] +lcd_type: st7789v +spi_bus: spi2a +rst_pin: PC8 +cs_pin: PC9 +rs_pin: PD11 +encoder_pins: ^PE13, ^PE15 +click_pin: ^!PE12 + +[extruder] +step_pin: PD9 +dir_pin: !PD8 +enable_pin: !PD10 +microsteps: 16 +rotation_distance: 26.2564 # (200 * 16 * 48/18) / 325 +gear_ratio: 48:18 +nozzle_diameter: 0.400 +filament_diameter: 1.750 +heater_pin: PB1 +sensor_type: ATC Semitec 104GT-2 +sensor_pin: PC0 +# Prusa's firmware defaults. +#control: pid +#pid_Kp: 7 +#pid_Ki: 0.5 +#pid_Kd: 45 +min_temp: 10 +max_temp: 305 +max_extrude_only_distance: 800.0 +# max_extrude_cross_section: 10.0 + [heater_bed] heater_pin: PB0 sensor_type: EPCOS 100K B57560G104F sensor_pin: PA4 -#control: pid # Prusa's firmware defaults. +#control: pid #pid_Kp: 120 #pid_Ki: 1.5 #pid_Kd: 600 @@ -322,11 +188,12 @@ home_xy_position: 160,20 z_hop: 4 [bed_mesh] -speed: 100 +speed: 1000 horizontal_move_z: 5 mesh_min: 10,10 mesh_max: 141,167 -probe_count: 4,4 +probe_count: 6,6 +algorithm: bicubic [filament_switch_sensor filament_sensor] switch_pin: ^PB4 @@ -345,27 +212,6 @@ insert_gcode: M117 loading now load -[mcu] -serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_2B0024001547393432343038-if00 -restart_method: command - -[printer] -kinematics: cartesian -# Prusa firmware defaults. -max_velocity: 180 -max_accel: 1250 -max_z_velocity: 12 -max_z_accel: 400 - -[display] -lcd_type: st7789v -spi_bus: spi2a -rst_pin: PC8 -cs_pin: PC9 -rs_pin: PD11 -encoder_pins: ^PE13, ^PE15 -click_pin: ^!PE12 - #*# <---------------------- SAVE_CONFIG ----------------------> #*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. #*# @@ -387,17 +233,19 @@ click_pin: ^!PE12 #*# [bed_mesh default] #*# version = 1 #*# points = -#*# -0.080000, -0.012500, 0.085000, 0.021250 -#*# -0.110000, -0.061250, -0.072500, -0.017500 -#*# -0.026250, -0.112500, -0.081250, -0.017500 -#*# -0.123750, -0.120000, -0.072500, -0.072500 +#*# -0.068750, -0.116250, 0.025000, 0.067500, -0.095000, 0.002500 +#*# -0.048750, -0.036250, 0.005000, -0.028750, 0.032500, 0.086250 +#*# -0.027500, -0.028750, -0.001250, 0.010000, 0.026250, 0.045000 +#*# 0.006250, -0.023750, -0.021250, 0.020000, 0.017500, 0.046250 +#*# -0.063750, -0.011250, -0.015000, -0.030000, 0.021250, 0.017500 +#*# -0.056250, -0.150000, -0.012500, -0.010000, -0.067500, -0.021250 #*# tension = 0.2 #*# min_x = 10.0 -#*# algo = lagrange -#*# y_count = 4 +#*# algo = bicubic +#*# y_count = 6 #*# mesh_y_pps = 2 #*# min_y = 10.0 -#*# x_count = 4 -#*# max_y = 166.99 +#*# x_count = 6 +#*# max_y = 167.0 #*# mesh_x_pps = 2 -#*# max_x = 140.98 +#*# max_x = 141.0