From cfcdb12f369eef94657dea25ca75fd3acefef713 Mon Sep 17 00:00:00 2001 From: Kyle Brown Date: Mon, 21 Mar 2022 17:29:31 -0700 Subject: [PATCH] First commit --- .gitignore | 4 ++ basic_macros.cfg | 59 +++++++++++++++++ calibration_macros.cfg | 141 +++++++++++++++++++++++++++++++++++++++++ fans.cfg | 46 ++++++++++++++ kiauh_macros.cfg | 59 +++++++++++++++++ moonraker.conf | 58 +++++++++++++++++ printer.cfg | 41 ++++++++++++ sherpa_mini.cfg | 19 ++++++ stepper2209.cfg | 15 +++++ stepper5160.cfg | 19 ++++++ steppers.cfg | 48 ++++++++++++++ stepperz.cfg | 7 ++ webcam.txt | 79 +++++++++++++++++++++++ 13 files changed, 595 insertions(+) create mode 100644 .gitignore create mode 100644 basic_macros.cfg create mode 100644 calibration_macros.cfg create mode 100644 fans.cfg create mode 100644 kiauh_macros.cfg create mode 100644 moonraker.conf create mode 100644 printer.cfg create mode 100644 sherpa_mini.cfg create mode 100644 stepper2209.cfg create mode 100644 stepper5160.cfg create mode 100644 steppers.cfg create mode 100644 stepperz.cfg create mode 100644 webcam.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..97f1ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +printer-*.cfg +.theme +*.bkp + diff --git a/basic_macros.cfg b/basic_macros.cfg new file mode 100644 index 0000000..96fb993 --- /dev/null +++ b/basic_macros.cfg @@ -0,0 +1,59 @@ +[gcode_macro CANCEL_PRINT] +rename_existing: BASE_CANCEL_PRINT +gcode: + M104 S0 + M140 S0 + M106 S0 + G91 E-2 + CLEAR_PAUSE + BASE_CANCEL_PRINT + SDCARD_RESET_FILE + M221 S100 + BED_MESH_CLEAR + +[gcode_macro PAUSE] +rename_existing: BASE_PAUSE +gcode: + #Edit this# + {% set X = 230 %} + {% set Y = 230 %} + {% set Z = 10 %} + ########### + SAVE_GCODE_STATE NAME=PAUSE_state + BASE_PAUSE + G91 + G1 E-1.7 F2100 + G1 Z{Z} + G90 + G1 X{X} Y{Y} F6000 + G91 + +[gcode_macro RESUME] +rename_existing: BASE_RESUME +gcode: + G91 + G1 E1.7 F2100 + G91 + RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 + BASE_RESUME + +[gcode_macro UNLOAD] +gcode: + G91 + G1 E10.0 F1200 + G1 E3.0 F1600 + G1 E-13.14 F7000 + G1 E-100 F3000 + +[gcode_macro M600] +gcode: + PAUSE + +[gcode_macro DISABLE_MOTORS] +gcode: + M18 + +[idle_timeout] +gcode: + TURN_OFF_HEATERS + DISABLE_MOTORS diff --git a/calibration_macros.cfg b/calibration_macros.cfg new file mode 100644 index 0000000..8516b05 --- /dev/null +++ b/calibration_macros.cfg @@ -0,0 +1,141 @@ +[gcode_macro TEST_RESONNANCES_X] +gcode: + TEST_RESONANCES AXIS=X + + +[gcode_macro TEST_RESONNANCES_Y] +gcode: + TEST_RESONANCES AXIS=Y + + +[gcode_macro FLOW_CALIBRATION] +gcode: + M221 S{params.FLOW} + SET_PRESSURE_ADVANCE ADVANCE={params.PRESSURE_ADVANCE} + +[gcode_macro TEST_Z_DOWN] +gcode: + {% set amount = params.amount|default(1)|int %} + TESTZ Z=-{amount} + +[gcode_macro TEST_Z_UP] +gcode: + {% set amount = params.amount|default(1)|int %} + TESTZ Z=+{amount} + +[gcode_macro TEST_Z_UP_MIDDLE] +gcode: + TESTZ Z=+ + +[gcode_macro TEST_Z_DOWN_MIDDLE] +gcode: + TESTZ Z=- + +# Home, get position, throw around toolhead, home again. +# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured. +# We only measure to a full step to accomodate for endstop variance. +# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10 + +[gcode_macro TEST_SPEED] +gcode: + # Speed + {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} + # Iterations + {% set iterations = params.ITERATIONS|default(5)|int %} + # Acceleration + {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} + # 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) + {% set bound = params.BOUND|default(20)|int %} + # Size for small pattern box + {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} + + # Large pattern + # Max positions, inset by BOUND + {% set x_min = printer.toolhead.axis_minimum.x + bound %} + {% set x_max = printer.toolhead.axis_maximum.x - bound %} + {% set y_min = printer.toolhead.axis_minimum.y + bound %} + {% set y_max = printer.toolhead.axis_maximum.y - bound %} + + # Small pattern at center + # Find X/Y center point + {% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %} + {% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %} + + # Set small pattern box around center point + {% set x_center_min = x_center - (smallpatternsize/2) %} + {% set x_center_max = x_center + (smallpatternsize/2) %} + {% set y_center_min = y_center - (smallpatternsize/2) %} + {% set y_center_max = y_center + (smallpatternsize/2) %} + + # Save current gcode state (absolute/relative, etc) + SAVE_GCODE_STATE NAME=TEST_SPEED + + # Output parameters to g-code terminal + { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } + + # Absolute positioning + G90 + + # Set new limits + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} + + # Home and get position for comparison later: + G28 + # QGL if not already QGLd (only if QGL section exists in config) + {% if printer.configfile.settings.quad_gantry_level %} + {% if printer.quad_gantry_level.applied == False %} + QUAD_GANTRY_LEVEL + G28 Z + {% endif %} + {% endif %} + G0 X{printer.toolhead.axis_maximum.x} Y{printer.toolhead.axis_maximum.y} F{30*60} + G4 P1000 + GET_POSITION + + # Go to starting position + G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} + + {% for i in range(iterations) %} + # Large pattern + # Diagonals + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Box + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Small pattern + # Small diagonals + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + + # Small box + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + {% endfor %} + + # Restore max speed/accel/accel_to_decel to their configured values + 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} + + # Re-home and get position again for comparison: + G28 + # Go to XY home positions (in case your homing override leaves it elsewhere) + G0 X{printer.toolhead.axis_maximum.x} Y{printer.toolhead.axis_maximum.y} F{30*60} + G4 P1000 + GET_POSITION + + # Restore previous gcode state (absolute/relative, etc) + RESTORE_GCODE_STATE NAME=TEST_SPEED diff --git a/fans.cfg b/fans.cfg new file mode 100644 index 0000000..04f91d9 --- /dev/null +++ b/fans.cfg @@ -0,0 +1,46 @@ +[fan] +## Print Cooling Fan - FAN2 Connector +pin: PA2 +max_power: 1 +kick_start_time: 0.5 +off_below: 0.10 + +[heater_fan hotend_fan] +## Hotend Fan - FAN0 Connector +pin: PA0 +max_power: 1.0 +kick_start_time: 0.5 +heater: extruder +heater_temp: 50.0 + +[fan_generic Exhaust_fan] +## exhaust fan - In FAN4 +pin: PA15 +max_power: 1 +shutdown_speed: 0 +kick_start_time: 0.1 +off_below: 0.10 + +[fan_generic chamber_fan] +## chamber fan - In FAN9 Positon +pin: PD15 +max_power: 1 +shutdown_speed: 0 +kick_start_time: 0.1 +off_below: 0.10 + +[fan_generic RSCS] +## RSCS Fans - In FAN1 Positon +pin: PA1 +max_power: 1 +shutdown_speed: 0 +kick_start_time: 0.1 +off_below: 0.10 + +[controller_fan driver_fan] +stepper: stepper_x +pin: PB11 +max_power: 1 +shutdown_speed: 0 +kick_start_time: 0.1 +off_below: 0.10 diff --git a/kiauh_macros.cfg b/kiauh_macros.cfg new file mode 100644 index 0000000..9f4cf1f --- /dev/null +++ b/kiauh_macros.cfg @@ -0,0 +1,59 @@ +################################################################################ +# ~~~~~~~~~~~~~~~~~~~~~~~~ AUTOCREATED WITH KIAUH ~~~~~~~~~~~~~~~~~~~~~~~~~~ # +################################################################################ +# Recommended macros and config entries if you use Mainsail or Fluidd! # +# You can edit or delete those macros if you already defined them elsewhere! # +################################################################################ + +[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 +gcode: + ##### set defaults ##### + {% set x = params.X|default(230) %} #edit to your park position + {% set y = params.Y|default(230) %} #edit to your park position + {% set z = params.Z|default(10)|float %} #edit to your park position + {% set e = params.E|default(1) %} #edit to your retract length + ##### 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 %} + ##### end of definitions ##### + SAVE_GCODE_STATE NAME=PAUSE_state + BASE_PAUSE + G91 + G1 E-{e} F2100 + G1 Z{z_safe} + G90 + G1 X{x} Y{y} F6000 + + +[gcode_macro RESUME] +rename_existing: BASE_RESUME +gcode: + ##### set defaults ##### + {% set e = params.E|default(1) %} #edit to your retract length + G91 + G1 E{e} F2100 + G90 + RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 + BASE_RESUME + +################################################################################ +################################################################################ diff --git a/moonraker.conf b/moonraker.conf new file mode 100644 index 0000000..2e260b9 --- /dev/null +++ b/moonraker.conf @@ -0,0 +1,58 @@ +[server] +host: 0.0.0.0 +port: 7125 +enable_debug_logging: False +klippy_uds_address: /tmp/klippy_uds + +[database] +database_path: /home/kdb424/.moonraker_database + +[authorization] +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.25.0/24 + 192.168.2.0/24 + 192.168.194.0/24 + FE80::/10 + ::1/128 +cors_domains: + http://*.home + http://*.far + http://*.lan + http://*.local + http://*://my.mainsail.xyz + http://*://app.fluidd.xyz + +[file_manager] +config_path: /home/kdb424/klipper_config +log_path: /home/kdb424/klipper_logs + +[octoprint_compat] + +[history] + +[update_manager] +channel: dev +refresh_interval: 168 + +[update_manager mainsail] +type: web +repo: mainsail-crew/mainsail +path: ~/mainsail + +[update_manager fluidd] +type: web +repo: fluidd-core/fluidd +path: ~/fluidd + +#[update_manager KlipperScreen] +#type: git_repo +#path: /home/kdb424/KlipperScreen +#origin: https://github.com/jordanruthe/KlipperScreen.git +#env: /home/kdb424/.KlipperScreen-env/bin/python +#requirements: scripts/KlipperScreen-requirements.txt +#install_script: scripts/KlipperScreen-install.sh diff --git a/printer.cfg b/printer.cfg new file mode 100644 index 0000000..b4bc0b4 --- /dev/null +++ b/printer.cfg @@ -0,0 +1,41 @@ +[include kiauh_macros.cfg] +[include steppers.cfg] +[include stepper2209.cfg] +[include stepperz.cfg] +[include sherpa_mini.cfg] +[include fans.cfg] +[include calibration_mcros.cfg] + +[pause_resume] +[display_status] +[virtual_sdcard] +path: ~/gcode_files + +[printer] +kinematics: corexy +max_velocity: 2000 +max_accel: 50000 +#max_accel_to_decel: 100000 +max_z_velocity: 30 +max_z_accel: 1500 +square_corner_velocity: 20 + +[mcu] +serial: /dev/serial/by-id/ + +[heater_bed] +heater_pin: PE5 +sensor_type: Generic 3950 +sensor_pin: PC1 +control: pid +pid_Kp: 66.746 +pid_Ki: 3.504 +pid_Kd: 317.878 +min_temp: 0 +max_temp: 125 + +[bed_screws] +screw1: 20,20 +screw2: 20,290 +screw3: 290,290 +screw4: 290,20 diff --git a/sherpa_mini.cfg b/sherpa_mini.cfg new file mode 100644 index 0000000..d961890 --- /dev/null +++ b/sherpa_mini.cfg @@ -0,0 +1,19 @@ +# Extruder0 +[extruder] +rotation_distance: 22.67895 #for 5mm Shaft Driven Bondtech gearsets +#gear_ratio: 50:10 #for standard 10t motor +gear_ratio: 50:8 #for sherpa mini 8t motor +microsteps: 16 +full_steps_per_rotation: 200 #1.8deg Motor + +max_extrude_only_distance: 1400.0 +max_extrude_only_velocity: 75.0 +max_extrude_only_accel: 1500 + +#settings for NEMA14 Stepper +[tmc2209 extruder] +interpolate: True + +#Run current is listed in RMS +run_current: 0.30 #min current, equivalent to 0.42A peak (Peak = RMS/0.707) +#run_current: 0.35 #max current, equivalent to 0.49A peak (Peak = RMS/0.707) diff --git a/stepper2209.cfg b/stepper2209.cfg new file mode 100644 index 0000000..8ce2faf --- /dev/null +++ b/stepper2209.cfg @@ -0,0 +1,15 @@ +[tmc2209 stepper_x] +uart_pin: PC4 +interpolate: true +run_current: 1.7 +hold_current: 1 +sense_resistor: 0.110 +stealthchop_threshold: 0 + +[tmc2209 stepper_y] +uart_pin: PF12 +interpolate: true +run_current: 1.7 +hold_current: 1 +sense_resistor: 0.110 +stealthchop_threshold: 0 diff --git a/stepper5160.cfg b/stepper5160.cfg new file mode 100644 index 0000000..7ff9eef --- /dev/null +++ b/stepper5160.cfg @@ -0,0 +1,19 @@ +[tmc5160 stepper_x] +interpolate: false +cs_pin: PC4 +#diag1_pin: PG12 +run_current: 1.8 +#hold_current: 0.5 +spi_bus: spi3 +driver_SGT: 1 +sense_resistor: 0.075 + +[tmc5160 stepper_y] +interpolate: false +cs_pin: PF12 +#diag1_pin: PG11 +run_current: 1.8 +#hold_current: 0.5 +spi_bus: spi3 +driver_SGT: 1 +sense_resistor: 0.075 diff --git a/steppers.cfg b/steppers.cfg new file mode 100644 index 0000000..8553c38 --- /dev/null +++ b/steppers.cfg @@ -0,0 +1,48 @@ + +[stepper_x] +step_pin: PE2 # Drive0 +dir_pin: PC5 +enable_pin: !PF11 +microsteps: 16 +rotation_distance: 40 +endstop_pin: PG11 +position_endstop: -8 +position_min: -8 +position_max: 315 +homing_speed: 45 +full_steps_per_rotation: 200 +homing_retract_dist: 0 +homing_positive_dir: false +step_pulse_duration: 0.000001 + +[stepper_y] +step_pin: PE3 # Drive1 +dir_pin: PF13 +enable_pin: !PF14 +microsteps: 16 +rotation_distance: 40 +endstop_pin: ^PG12 +position_endstop: -6 +position_min: -6 +position_max: 315 +homing_speed: 45 +full_steps_per_rotation: 200 +homing_retract_dist: 0 +homing_positive_dir: false +step_pulse_duration: 0.000001 + +[stepper_z] +step_pin: PE15 +dir_pin: !PE11 +enable_pin: !PF2 +microsteps: 16 +rotation_distance: 4 +endstop_pin: !PG10 +position_endstop: 0.0 +position_max: 400 +full_steps_per_rotation: 200 +homing_retract_dist: 5.0 +homing_positive_dir: false +homing_speed: 5.0 +second_homing_speed: 2.5 +step_pulse_duration: 0.000004 diff --git a/stepperz.cfg b/stepperz.cfg new file mode 100644 index 0000000..a5ef34f --- /dev/null +++ b/stepperz.cfg @@ -0,0 +1,7 @@ +[tmc2209 stepper_z] +interpolate: false +uart_pin: PE10 +run_current: 0.8 +hold_current: 0.8 +sense_resistor: 0.110 +stealthchop_threshold: 0 diff --git a/webcam.txt b/webcam.txt new file mode 100644 index 0000000..e8bd44c --- /dev/null +++ b/webcam.txt @@ -0,0 +1,79 @@ +### Windows users: To edit this file use Notepad++, VSCode, Atom or SublimeText. +### Do not use Notepad or WordPad. + +### MacOSX users: If you use Textedit to edit this file make sure to use +### "plain text format" and "disable smart quotes" in "Textedit > Preferences" + +### Configure which camera to use +# +# Available options are: +# - auto: tries first usb webcam, if that's not available tries raspi cam +# - usb: only tries usb webcam +# - raspi: only tries raspi cam +# +# Defaults to auto +# +#camera="auto" + +### Additional options to supply to MJPG Streamer for the USB camera +# +# See https://faq.octoprint.org/mjpg-streamer-config for available options +# +# Defaults to a resolution of 640x480 px and a framerate of 10 fps +# +#camera_usb_options="-r 640x480 -f 10" + +### Additional webcam devices known to cause problems with -f +# +# Apparently there a some devices out there that with the current +# mjpg_streamer release do not support the -f parameter (for specifying +# the capturing framerate) and will just refuse to output an image if it +# is supplied. +# +# The webcam daemon will detect those devices by their USB Vendor and Product +# ID and remove the -f parameter from the options provided to mjpg_streamer. +# +# By default, this is done for the following devices: +# Logitech C170 (046d:082b) +# GEMBIRD (1908:2310) +# Genius F100 (0458:708c) +# Cubeternet GL-UPC822 UVC WebCam (1e4e:0102) +# +# Using the following option it is possible to add additional devices. If +# your webcam happens to show above symptoms, try determining your cam's +# vendor and product id via lsusb, activating the line below by removing # and +# adding it, e.g. for two broken cameras "aabb:ccdd" and "aabb:eeff" +# +# additional_brokenfps_usb_devices=("aabb:ccdd" "aabb:eeff") +# +# +#additional_brokenfps_usb_devices=() + +### Additional options to supply to MJPG Streamer for the RasPi Cam +# +# See https://faq.octoprint.org/mjpg-streamer-config for available options +# +# Defaults to 10fps +# +#camera_raspi_options="-fps 10" + +### Configuration of camera HTTP output +# +# Usually you should NOT need to change this at all! Only touch if you +# know what you are doing and what the parameters mean. +# +# Below settings are used in the mjpg-streamer call like this: +# +# -o "output_http.so -w $camera_http_webroot $camera_http_options" +# +# Current working directory is the mjpg-streamer base directory. +# +#camera_http_webroot="./www-mainsail" +#camera_http_options="-n" + +### EXPERIMENTAL +# Support for different streamer types. +# +# Available options: +# mjpeg [default] - stable MJPG-streamer +#camera_streamer=mjpeg