From d145c9cb859224fc792990482fffedd5169817f2 Mon Sep 17 00:00:00 2001 From: Kyle Brown Date: Sat, 17 Jun 2023 16:31:37 -0700 Subject: [PATCH] Initial commit --- Makefile | 2 + moonraker.conf | 62 +++++++ printer.cfg | 438 +++++++++++++++++++++++++++++++++++++++++++++++++ sensorless.cfg | 73 +++++++++ 4 files changed, 575 insertions(+) create mode 100644 Makefile create mode 100644 moonraker.conf create mode 100644 printer.cfg create mode 100644 sensorless.cfg diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..32d1f66 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +clean: + rm -f printer-*.cfg diff --git a/moonraker.conf b/moonraker.conf new file mode 100644 index 0000000..fa70883 --- /dev/null +++ b/moonraker.conf @@ -0,0 +1,62 @@ +[server] +host: 0.0.0.0 +port: 7125 + +[file_manager] +enable_object_processing: True +queue_gcode_uploads: True + +[job_queue] +load_on_startup: False + +[timelapse] + +[authorization] +cors_domains: + https://my.mainsail.xyz + http://my.mainsail.xyz + http://*.local + http://*.lan + http://*.home + http://*.far + http://vzbot.home + # Figure out why this is required. + # I don't open ports, so not a big deal + * +trusted_clients: + 10.0.0.0/8 + 127.0.0.0/8 + 169.254.0.0/16 + 172.16.0.0/12 + 192.168.0.0/16 + 192.168.2.0/24 + 192.168.25.0/24 + FE80::/10 + ::1/128 + +# enables partial support of Octoprint API +[octoprint_compat] + +# enables moonraker to track and store print history. +[history] + +# enables moonraker announcements in mainsail +[announcements] +subscriptions: + mainsail + +# this enables moonraker's update manager +[update_manager] +refresh_interval: 48 +enable_auto_refresh: True + +[update_manager mainsail] +type: web +repo: meteyou/mainsail +path: ~/mainsail + +[update_manager timelapse] +type: git_repo +primary_branch: main +path: ~/moonraker-timelapse +origin: https://github.com/mainsail-crew/moonraker-timelapse.git diff --git a/printer.cfg b/printer.cfg new file mode 100644 index 0000000..1424db2 --- /dev/null +++ b/printer.cfg @@ -0,0 +1,438 @@ +# This file contains common pin mappings for the BIGTREETECH Manta M8P V1.1 +# To use this config, the firmware should be compiled for the +# STM32G0B1 with a "8KiB bootloader" and USB communication. + +# See docs/Config_Reference.md for a description of parameters. + +## THINGS TO CHANGE/CHECK: *** +## MCU paths [mcu] section +## Thermistor types [extruder] and [heater_bed] sections - See 'sensor types' list at end of file +## Z Endstop Switch location [safe_z_home] section +## Homing end position [gcode_macro G32] section +## Z Endstop Switch offset for Z0 [stepper_z] section +## Probe points [quad_gantry_level] section +## Min & Max gantry corner postions [quad_gantry_level] section +## PID tune [extruder] and [heater_bed] sections +## Thermistor types [extruder] and [heater_bed] sections +## Probe pin [probe] section +## Fine tune E steps [extruder] section + + +##################################################################### +# Important other files +##################################################################### + + +[mcu] +## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/{REPLACE WITH YOUR SERIAL} +restart_method: command +##-------------------------------------------------------------------- + +[printer] +kinematics: corexy +max_velocity: 300 +max_accel: 3000 +max_z_velocity: 15 +max_z_accel: 350 +square_corner_velocity: 5.0 + +##################################################################### +# X/Y Stepper Settings +##################################################################### + +## B Stepper - Left +## Connected to MOTOR_1 +[stepper_x] +step_pin: PE2 +dir_pin: PB4 +enable_pin: !PC11 +rotation_distance: 32 +microsteps: 32 +full_steps_per_rotation:200 +position_min: 0 +position_endstop: 180 +position_max: 180 +homing_positive_dir: true +endstop_pin: ^PF3 +homing_retract_dist: 5 +homing_speed: 50 #Max 100 + + + +[tmc2209 stepper_x] +uart_pin: PC10 +interpolate: false +run_current: 0.6 +stealthchop_threshold: 0 + +## A Stepper - Right +## Connected to MOTOR_2 +[stepper_y] +step_pin: PF12 +dir_pin: PF11 +enable_pin: !PB3 +endstop_pin: ^PF4 +rotation_distance: 32 +microsteps: 32 +full_steps_per_rotation:200 +position_min: 0 +position_endstop: 190 +position_max: 190 +homing_positive_dir: true +endstop_pin: PG9 +homing_retract_dist: 5 +homing_speed: 50 #Max 100 + +[tmc2209 stepper_y] +uart_pin: PF13 +interpolate: false +run_current: 0.6 +stealthchop_threshold: 0 + + + +##################################################################### +# Z Stepper Settings +##################################################################### + +## Z0 Stepper - Front Left +## Connected to MOTOR_3 +[stepper_z] +step_pin: PD7 +dir_pin: !PD6 +enable_pin: !PF10 +rotation_distance: 32 +gear_ratio: 64:16 +microsteps: 32 +endstop_pin: ^PF5 +## Z-position of nozzle (in mm) to z-endstop trigger point relative to print surface (Z0) +## (+) value = endstop above Z0, (-) value = endstop below +## Increasing position_endstop brings nozzle closer to the bed +## After you run Z_ENDSTOP_CALIBRATE, position_endstop will be stored at the very end of your config +position_endstop: -0.5 +position_max: 165 +position_min: -5 +homing_speed: 8 +second_homing_speed: 3 +homing_retract_dist: 3 + +[tmc2209 stepper_z] +uart_pin: PF9 +interpolate: false +run_current: 0.6 +stealthchop_threshold: 0 + +## Z1 Stepper - Rear Left +## Connected to MOTOR_4 +[stepper_z1] +step_pin: PD3 +dir_pin: PC8 +enable_pin: !PD1 +rotation_distance: 32 +gear_ratio: 64:16 +microsteps: 32 + +[tmc2209 stepper_z1] +uart_pin: PD4 +interpolate: false +run_current: 0.6 +stealthchop_threshold: 0 + +## Z2 Stepper - Rear Right +## Connected to MOTOR_5 +[stepper_z2] +step_pin: PC9 +dir_pin: !PC8 +enable_pin: !PD1 +rotation_distance: 32 +gear_ratio: 64:16 +microsteps: 32 + +[tmc2209 stepper_z2] +uart_pin: PF2 +interpolate: false +run_current: 0.6 +sense_resistor: 0.110 +stealthchop_threshold: 0 + +## Z3 Stepper - Front Right +## Connected to MOTOR_6 +[stepper_z3] +step_pin: PA10 +dir_pin: PD15 +enable_pin: !PA15 +rotation_distance: 32 +gear_ratio: 64:16 +microsteps: 32 + +[tmc2209 stepper_z3] +uart_pin: PD0 +interpolate: false +run_current: 0.6 +sense_resistor: 0.110 +stealthchop_threshold: 0 + + +##################################################################### +# Extruder +##################################################################### + +## Connected to MOTOR_7 +## Heater - HE0 +## Thermistor - T0 +[extruder] +step_pin: PD12 +dir_pin: PD11 +enable_pin: !PD14 +## Update value below when you perform extruder calibration +## If you ask for 100mm of filament, but in reality it is 98mm: +## rotation_distance = * / 100 +## 22.6789511 is a good starting point +rotation_distance: 22.6789511 #Bondtech 5mm Drive Gears +gear_ratio: 50:10 #BMG Gear Ratio +microsteps: 32 +full_steps_per_rotation: 200 #200 for 1.8 degree, 400 for 0.9 degree +nozzle_diameter: 0.400 +filament_diameter: 1.75 +heater_pin: PA3 +## Check what thermistor type you have. See https://www.klipper3d.org/Config_Reference.html#common-thermistors for common thermistor types. +## Use "Generic 3950" for NTC 100k 3950 thermistors +#sensor_type: +sensor_pin: PA1 +min_temp: 10 +max_temp: 350 +max_power: 1.0 +min_extrude_temp: 170 +control = pid +pid_kp = 26.213 +pid_ki = 1.304 +pid_kd = 131.721 + +## E0 on MOTOR7 +[tmc2209 extruder] +uart_pin: PD14 +interpolate: false +run_current: 0.3 +stealthchop_threshold: 0 + + +##################################################################### +# Bed Heater +##################################################################### + +[heater_bed] +## Heater Pin - BED_OUT - PB7 +## Thermistor - TB - PA0 +heater_pin: PB7 +## Validate the following thermistor type to make sure it is correct +## See https://www.klipper3d.org/Config_Reference.html#common-thermistors for additional options +#sensor_type: Generic 3950 +sensor_pin: PA0 +max_power: 0.6 +min_temp: 0 +max_temp: 120 +control: pid +pid_kp: 58.437 +pid_ki: 2.347 +pid_kd: 363.769 + +##################################################################### +# Probe +##################################################################### + +[probe] +## Klicky Probe - Since this is just an endstop switch its wired up to one of the endstop ports +# Uses the PS-ON port as we ran out of endstops +pin: PC3 +x_offset: 0 +y_offset: 26.0 +z_offset: 0 +speed: 10.0 +samples: 3 +samples_result: median +sample_retract_dist: 3.0 +samples_tolerance: 0.006 +samples_tolerance_retries: 3 + +##################################################################### +# Fan Control +##################################################################### + +[fan] +## Print Cooling Fan - FAN0 - MAKE SURE TO SET THE VOLTAGE JUMPER! +pin: PE6 +kick_start_time: 0.5 +## Depending on your fan, you may need to increase this value +## if your fan will not start. Can change cycle_time (increase) +## if your fan is not able to slow down effectively +off_below: 0.10 + +[heater_fan hotend_fan] +## Hotend Fan - FAN1 +pin: PE0 +max_power: 1.0 +kick_start_time: 0.5 +heater: extruder +heater_temp: 50.0 +## If you are experiencing back flow, you can reduce fan_speed +#fan_speed: 1.0 + +[controller_fan controller_fan] +## Controller fan - FAN2 +pin: PB6 +kick_start_time: 0.5 +heater: heater_bed + +##################################################################### +# Homing and Gantry Adjustment Routines +##################################################################### + +[idle_timeout] +timeout: 1800 + + + +[quad_gantry_level] + +# Gantry Corners for Micron+ Build +# Uncomment for Micron+ build +gantry_corners: + -60.2,-10.4 + 244.1,234.5 +# Probe points +points: + 2,2 + 2,150 + 170,150 + 170,2 + +speed: 100 +horizontal_move_z: 15 +retries: 5 +retry_tolerance: 0.0075 +max_adjust: 10 + + +######################################## +# EXP1 / EXP2 (display) pins +######################################## + +[board_pins] +aliases: + # EXP1 header + EXP1_1=PE9, EXP1_2=PE10, + EXP1_3=PE11, EXP1_4=PE12, + EXP1_5=PE13, EXP1_6=PE14, # Slot in the socket on this side + EXP1_7=PE15, EXP1_8=PB10, + EXP1_9=, EXP1_10=<5V>, + + # EXP2 header + EXP2_1=PB14, EXP2_2=PB13, + EXP2_3=PF7, EXP2_4=PB12, + EXP2_5=PE7, EXP2_6=PB11, # Slot in the socket on this side + EXP2_7=PE8, EXP2_8=, + EXP2_9=, EXP2_10=PC5 + +# See the sample-lcd.cfg file for definitions of common LCD displays. + +#[bltouch] +#sensor_pin: PB2 +#control_pin: PB1 + +# Proximity switch +#[probe] +#pin: PF6 + +#[neopixel my_neopixel_1] +#pin: PA9 + +#[neopixel my_neopixel_2] +#pin: PB15 + +#[hall_filament_width_sensor] +#adc1: PC5 +#adc2: PB0 + +[z_thermal_adjust] +#temp_coeff: #23.4 μm/m·°C for Misumi A6N01SS-T5 6005A-T5 aluminum alloy +# The temperature coefficient of expansion, in mm/degC. For example, a +# temp_coeff of 0.01 mm/degC will move the Z axis downwards by 0.01 mm for +# every degree Celsius that the temperature sensor increases. Defaults to +# 0.0 mm/degC, which applies no adjustment. +#smooth_time: +# Smoothing window applied to the temperature sensor, in seconds. Can reduce +# motor noise from excessive small corrections in response to sensor noise. +# The default is 2.0 seconds. +#z_adjust_off_above: +# Disables adjustments above this Z height [mm]. The last computed correction +# will remain applied until the toolhead moves below the specified Z height +# again. The default is 99999999.0 mm (always on). +#max_z_adjustment: +# Maximum absolute adjustment that can be applied to the Z axis [mm]. The +# default is 99999999.0 mm (unlimited). +#sensor_type: +#sensor_pin: +#min_temp: +#max_temp: +# Temperature sensor configuration. +# See the "extruder" section for the definition of the above +# parameters. +#gcode_id: +# See the "heater_generic" section for the definition of this +# parameter. + +##################################################################### +# Macros +##################################################################### +[gcode_macro PARK] +gcode: + {% set th = printer.toolhead %} + G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y//2} Z30 + +[gcode_macro G32] +gcode: + SAVE_GCODE_STATE NAME=STATE_G32 + G90 + G28 + QUAD_GANTRY_LEVEL + G28 + PARK + RESTORE_GCODE_STATE NAME=STATE_G32 + +[gcode_macro PRINT_START] +# Use PRINT_START for the slicer starting script - please customise for your slicer of choice +gcode: + G32 ; home all axes + G90 ; absolute positioning + G1 Z20 F3000 ; move nozzle away from bed + + +[gcode_macro PRINT_END] +# Use PRINT_END for the slicer ending script - please customise for your slicer of choice +gcode: + # safe anti-stringing move coords + {% set th = printer.toolhead %} + {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %} + {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %} + {% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %} + + SAVE_GCODE_STATE NAME=STATE_PRINT_END + + M400 ; wait for buffer to clear + G92 E0 ; zero the extruder + G1 E-5.0 F1800 ; retract filament + + TURN_OFF_HEATERS + + G90 ; absolute positioning + G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing + G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear + M107 ; turn off fan + + BED_MESH_CLEAR + RESTORE_GCODE_STATE NAME=STATE_PRINT_END + +#QUAD_GANTRY_LEVEL horizontal_move_z=10 retry_tolerance=1.000 # First slow pass far away from the bed as a "sanity check" +#QUAD_GANTRY_LEVEL horizontal_move_z=2 # Lower pass at speed diff --git a/sensorless.cfg b/sensorless.cfg new file mode 100644 index 0000000..5290ba6 --- /dev/null +++ b/sensorless.cfg @@ -0,0 +1,73 @@ +[gcode_macro SENSORLESS_HOME_X] +gcode: + {% set HOME_CUR = 0.700 %} + {% set driver_config = printer.configfile.settings['tmc2209 stepper_x'] %} + {% set RUN_CUR = driver_config.run_current %} + # Set current for sensorless homing + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR} + # Pause to ensure driver stall flag is clear + G4 P2000 + # Home + G28 X0 + # Move away + G91 + G1 X5 F{400*60} # dodge probe + # Set current during print + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR} + G90 + +[gcode_macro SENSORLESS_HOME_Y] +gcode: + {% set HOME_CUR = 0.700 %} + {% set driver_config = printer.configfile.settings['tmc2209 stepper_y'] %} + {% set RUN_CUR = driver_config.run_current %} + # Set current for sensorless homing + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={HOME_CUR} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={HOME_CUR} + # Pause to ensure driver stall flag is clear + G4 P2000 + # Home + G28 Y0 + # Move away + G91 + G1 Y-5 F{400*60} + # Set current during print + SET_TMC_CURRENT STEPPER=stepper_x CURRENT={RUN_CUR} + SET_TMC_CURRENT STEPPER=stepper_y CURRENT={RUN_CUR} + G90 + +[gcode_macro HOME] +gcode: + G90 + # Home Y + SENSORLESS_HOME_Y + # Home X + SENSORLESS_HOME_X + # Home Z + G28 Z0 + +[homing_override] +axes: xyz + +gcode: + {% set home_all = 'X' not in params and 'Y' not in params and 'Z' not in params %} + + {% if home_all or 'Y' in params %} + SENSORLESS_HOME_Y + {% endif %} + + {% if home_all or 'X' in params %} + SENSORLESS_HOME_X + {% endif %} + + + {% if home_all or 'Z' in params %} + G90 # Absolute positioning + # park above bed center + G1 X{(printer.toolhead.axis_maximum.x/2)-30} Y{(printer.toolhead.axis_maximum.y/2)+2.4} + G28 Z + G91 + {% endif %} + G90