Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from Frix-x:main #32

Merged
merged 6 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions config/hardware/accelerometers/adxl345_Fystec_NIS.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[include generics/adxl345_software_spi.cfg]

# https://github.com/FYSETC/Nozzle-Input-Shaper
# stm32f042

# You need to override the following to be able to set the proper serial in your overrides.cfg file
[mcu adxl]
serial: /dev/serial/by-id/xxx

[adxl345]
cs_pin: NIS:PA4
spi_software_sclk_pin: adxl:PA5
spi_software_mosi_pin: adxl:PA7
spi_software_miso_pin: adxl:PA6
axes_map: x,y,z

[resonance_tester]
accel_chip: adxl345
probe_points:
-1,-1,-1

# Include the IS calibration macros to unlock them when
# an accelerometer is installed on the machine
[include ../../../macros/helpers/resonance_override.cfg]
[include ../../../scripts/K-ShakeTune/K-SnT_*.cfg]

8 changes: 8 additions & 0 deletions config/hardware/accelerometers/adxl345_nitehawk_sb.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[include generics/adxl345_software_spi.cfg]

# As it's a toolhead ADXL, we add some default pins overrides from here
[adxl345]
cs_pin: toolhead:MCU_ADXL_CS
spi_software_sclk_pin: toolhead:MCU_ADXL_SCK
spi_software_mosi_pin: toolhead:MCU_ADXL_MOSI
spi_software_miso_pin: toolhead:MCU_ADXL_MISO
2 changes: 1 addition & 1 deletion config/mcu_definitions/main/BTT_SKR_2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ aliases:

# EXP1 header
EXP1_1=PC5 , EXP1_2=PB0 ,
EXP1_3=PB1 , EXP1_4=PB9 ,
EXP1_3=PB1 , EXP1_4=PE9 ,
EXP1_5=PE10 , EXP1_6=PE11 , # Key in the socket on this side
EXP1_7=PE12 , EXP1_8=PE13 ,
EXP1_9=<GND> , EXP1_10=<5V> ,
Expand Down
51 changes: 51 additions & 0 deletions config/mcu_definitions/main/Fysetc_Cheetah_v3.x.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[board_pins mcu_manufacturer]
aliases:
MCU_XM_STEP=PC0 , MCU_XM_DIR=PC1 , MCU_XM_ENABLE=PC3 ,
MCU_YM_STEP=PC14 , MCU_YM_DIR=PC13 , MCU_YM_ENABLE=PC15 ,
MCU_ZM_STEP=PB4 , MCU_ZM_DIR=PB5 , MCU_ZM_ENABLE=PC2 ,
MCU_EM_STEP=PB2 , MCU_EM_DIR=PA15 , MCU_EM_ENABLE=PD2 ,
MCU_TMCUART=PB3 , MCU_TMCTX=PA2 ,

MCU_XSTOP=PA2 , MCU_YSTOP=PA3 , MCU_ZSTOP=PC4 ,
MCU_E0STOP=PA1 ,

MCU_HE0=PC7 ,
MCU_BED=PC8 ,

MCU_TH0=PC5 ,
MCU_THB=PB0 ,
MCU_TH2=PB1 ,

MCU_FAN0=PA14 , MCU_FAN1=PA13 , MCU_FAN2=PA8 ,

# Z-Probe Header
MCU_SERVOS=PA0, MCU_PROBE=PC4 ,

# PI Header
MCU_Pi_PWR_UART_TX1=PA9 ,
MCU_Pi_PWR_UART_RX1=PA10 ,

# ?? Header
MCU_P2_DP=PA11 ,
MCU_P2_DM=PA12 ,

# EXP1 header
EXP1_1=<GND> , EXP1_2=<5V> ,
EXP1_3=PB7 , EXP1_4=PB6 ,
EXP1_5=PB14 , EXP1_6=PB13 , # Slot in the socket on this side
EXP1_7=PB12 , EXP1_8=PB15 ,
EXP1_9=PC6 , EXP1_10=PB10 ,

# EXP2 header
EXP2_1=<GND> , EXP2_2=<5V> ,
EXP2_3=<RST> , EXP2_4=PC12 ,
EXP2_5=PA7 , EXP2_6=PC11 , # Slot in the socket on this side
EXP2_7=PA4 , EXP2_8=PC10 ,
EXP2_9=PA5 ,EXP2_10=PA6 ,

# EXP3 header
EXP3_1=PB10 , EXP3_2=PC6 ,
EXP3_3=PC10 , EXP3_4=PB14 ,
EXP3_5=PC11 , EXP3_6=PB13 , # Slot in the socket on this side
EXP3_7=PB12 , EXP3_8=PB15 ,
EXP3_9=<GND> , EXP3_10=<5V>
24 changes: 24 additions & 0 deletions docs/brush_center_offset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
The purpose of this document is to explain the purpose of the brush center offset variable in variables.cfg.

The brush center offset takes the brush center and moves it in the direction of the brush normal by the specified amount.
This is useful for avoiding brush strokes that would cause the toolhead to crash into something or otherwise cause undesired affects.
One example (and the impetus for this feature) is the case in which one has a brush and a gantry-mounted depressor for a filament cutter on the same side of the gantry. If nozzle cleaning is perform with filament loaded and the brush strokes occur in the same space as the depressor, then the filament cutter is actuated (repeatedly) which results in unnecessary wear and unwanted filament cutting.
One could simply move the center of the brush away from the depressor, but this would cause the nozzle to leave the brush and be wasted motion.

How it works:
The brush center should be set as normal in the variables.cfg file. The brush center offset should be set to a value (in mm) that will prevent the toolhead from crashing into anything.
The brush size is provided to accomodate different brush sizes and is used to calculate the brush stroke distance.

For example, if the variable_brush_xyz is set to (40, 250, 2) and the variable_brush_center_offset is set to 10, then the new brush center will be (50, 250, 2).
This will create the following brush action:

|-----------------------------|---------------|--------------|
left center center + offset right
^ nozzle starts here
---------------> first brush stroke direction {(brush size/2) - brush center offset}
<-------------------------------------------- n brush stroke direction {(brush size/2)}
--------------------------------------------> n+1 brush stroke direction {(brush size/2)}

If variable_brush_center_offset is set to -10, then the new brush center will be (30, 250, 2) and the nozzle will start to the left of the center and do the mirror of the above brush action.

Therefore, this allows the nozzle brushing action to occur entirely with the brush with no wasted motion or unwanted interactions with other components.
2 changes: 1 addition & 1 deletion macros/base/park.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ gcode:
{% set St = printer["gcode_macro _USER_VARIABLES"].travel_speed * 60 %}
{% set Sz = printer["gcode_macro _USER_VARIABLES"].z_drop_speed * 60 %}

{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set max_z = printer.toolhead.axis_maximum.z - printer.gcode_move.homing_origin.z |float %}
{% set act_z = printer.toolhead.position.z|float %}

{% set z_safe = act_z + Z_HOP %}
Expand Down
24 changes: 17 additions & 7 deletions macros/helpers/nozzle_cleaning.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ gcode:
{% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %}
{% set brush_clean_accel = printer["gcode_macro _USER_VARIABLES"].brush_clean_accel %}
{% set brush_over_y_axis = printer["gcode_macro _USER_VARIABLES"].brush_over_y_axis %}
{% set brush_offset = printer["gcode_macro _USER_VARIABLES"].brush_center_offset|default(0)|float %}
{% set brush_size = printer["gcode_macro _USER_VARIABLES"].brush_width_x|default(40)|float %}
{% set brushes = printer["gcode_macro _USER_VARIABLES"].brushes|default(6)|int %}
{% set verbose = printer["gcode_macro _USER_VARIABLES"].verbose %}

{% if purge_and_brush_enabled %}
Expand All @@ -14,6 +17,7 @@ gcode:
{% set Sc = printer["gcode_macro _USER_VARIABLES"].brush_clean_speed * 60 %}

{% set Bx, By, Bz = printer["gcode_macro _USER_VARIABLES"].brush_xyz|map('float') %}
{% set Bx = Bx + brush_offset %}

{% if status_leds_enabled %}
STATUS_LEDS COLOR="CLEANING"
Expand All @@ -25,7 +29,7 @@ gcode:

# Set the cleaning acceleration prior to any movement
{% set saved_accel = printer.toolhead.max_accel %}
M204 S{brush_clean_accel}
SET_VELOCITY_LIMIT ACCEL={brush_clean_accel}

# Move to purge zone (left side)
G90
Expand All @@ -36,17 +40,23 @@ gcode:
# Wipe procedure
G91
{% if brush_over_y_axis %}
{% for wipe in range(6) %}
{% for wipe in range(brushes) %}
G1 Y-5 F{Sc}
G1 Y+5 F{Sc}
{% endfor %}
{% endif %}

G1 X+20 F{Sc}
# Move to the right side of the brush
{% if brush_offset < 0 %} # brush center biased towards 0
G1 X+{ brush_size/2 } F{Sc}
{% else %} # brush center biased towards x_max
G1 X+{ (brush_size/2) - brush_offset} F{Sc}
{% endif %}

{% for wipe in range(6) %}
G1 X-40 F{Sc}
G1 X+40 F{Sc}
# Brush procedure
{% for wipe in range(brushes) %}
G1 X-{ (brush_size) - brush_offset } F{Sc}
G1 X+{ (brush_size) - brush_offset } F{Sc}
{% endfor %}

G90
Expand Down Expand Up @@ -162,4 +172,4 @@ gcode:
{% endif %}

RESTORE_GCODE_STATE NAME=CONDITIONAL_MOVE_TO_PURGE_BUCKET_STATE
{% endif %}
{% endif %}
55 changes: 55 additions & 0 deletions user_templates/mcu_defaults/main/Fysetc_Cheetah_v3.x.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

#------------------------------------#
#### Fystec Cheetah V3 definition ####
#------------------------------------#

# https://github.com/FYSETC/Cheetah_V3.0
[mcu]
##--------------------------------------------------------------------
serial: /dev/serial/by-id/change-me-to-the-correct-mcu-path
##--------------------------------------------------------------------

[include config/mcu_definitions/main/Fysetc_Cheetah_v3.x.cfg] # Do not remove this line
[board_pins Cheetah_v3_mcu]
mcu: mcu
restart_method: command
aliases:
X_STEP=MCU_XM_STEP , X_DIR=MCU_XM_DIR , X_ENABLE=MCU_XM_ENABLE ,
Y_STEP=MCU_YM_STEP , Y_DIR=MCU_YM_DIR , Y_ENABLE=MCU_YM_ENABLE ,
Z_STEP=MCU_ZM_STEP , Z_DIR=MCU_ZM_DIR , Z_ENABLE=MCU_ZM_ENABLE ,
E_STEP=MCU_EM_STEP , E_DIR=MCU_EM_DIR , E_ENABLE=MCU_EM_ENABLE ,

TMCUART=MCU_TMCUART , TMCTX=MCU_TMCTX ,

X_STOP=MCU_XSTOP , Y_STOP=MCU_YSTOP , Z_STOP=MCU_ZSTOP ,
RUNOUT_SENSOR=MCU_E0STOP ,
PROBE_INPUT=MCU_PROBE ,
SERVO_PIN=MCU_SERVOS ,

E_HEATER=MCU_HE0 , E_TEMPERATURE=MCU_TH0 ,
BED_HEATER=MCU_BED , BED_TEMPERATURE=MCU_THB ,

PART_FAN=MCU_FAN0 , E_FAN=MCU_FAN1 , CONTROLLER_FAN=MCU_FAN2 ,


[tmc2209 stepper_x]
uart_pin: TMCUART
#tx_pin: TMCTX
uart_address: 0

[tmc2209 stepper_y]
uart_pin: TMCUART
#tx_pin: TMCTX
uart_address: 1

[tmc2209 stepper_z]
uart_pin: TMCUART
#tx_pin: TMCTX
uart_address: 2

# Comment this section if you are using a toolhead with its own MCU
[tmc2209 extruder]
uart_pin: TMCUART
#tx_pin: TMCTX
uart_address: 3

4 changes: 3 additions & 1 deletion user_templates/printer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,17 @@
# [include config/hardware/accelerometers/adxl345_usb.cfg] # For KUBSA, ...
# [include config/hardware/accelerometers/adxl345_usb_rampon.cfg] # For KUBSA with Rampon firmware, ...
# [include config/hardware/accelerometers/adxl345_usb_rp2040_spi1.cfg] # For Fysetc PortableInputShaper, ...
# [include config/hardware/accelerometers/adxl345_Fystec_NIS.cfg] # For USB Nozzle Input Shapers
# [include config/hardware/accelerometers/adxl345_skr.cfg] # For ADXL plugged in SKRv1.4 (not a conventional way)

# [include config/hardware/accelerometers/adxl345_sb2040.cfg] # For ADXL plugged in Mellow Fly-SB2040 boards
# [include config/hardware/accelerometers/adxl345_ebb.cfg] # For ADXL plugged in BTT EBB36 or EBB42 boards
# [include config/hardware/accelerometers/adxl345_sht.cfg] # For ADXL plugged in Mellow SHT36 or SHT42 boards
# [include config/hardware/accelerometers/adxl345_BTT_SB22xx.cfg] # For ADXL plugged in BTT SB2209 or SB2240 boards
# [include config/hardware/accelerometers/adxl345_Fysetc_SB_Can_TH.cfg] # For ADXL plugged in Fysetc SB Can TH boards
# [include config/hardware/accelerometers/adxl345_nitehawk_sb.cfg] # For built in ADXL sensor on the Nitehawk SB board

# [include config/hardware/accelerometers/lis2dw_usb_rp2040_spi1.cfg] # For BTT S2DW V1.0, ...
# [include config/hardware/accelerometers/lis2dw_usb_rp2040_spi1.cfg] # For BTT S2DW V1.0, ...

# [include config/hardware/accelerometers/beacon_accelerometer.cfg] # For Beacon Rev H make sure Beacon. Do not forget to include the beacon_virtual_probe in the PROBE section!
# ----------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions user_templates/variables.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ variable_purge_and_brush_enabled: False
variable_force_homing_before_brush: False # Add an homing of the Z axis before a clean to be sure to not miss the brush
variable_brush_over_y_axis: True # Cleanup is done moving the extruder along the Y axis, then X axis. If false, only X axis is done
variable_brush_xyz: -1, -1, -1 # Position of the brush center for nozzle cleaning
variable_brush_width_x: 40 # Width of the brush in X direction (in mm)
variable_brush_center_offset: 0 # Offset of the brush center to start brushing (in mm), + is towards max X
variable_brushes: 6 # Number of brushes of the nozzle to perform
variable_purge_bucket_xyz: -1, -1, -1 # Purge bucket position
variable_purge_distance: 30 # Amount to purge (in mm)
variable_purge_ooze_time: 10 # Time (in seconds) to wait after the purge to let the nozzle ooze before going to the brush
Expand Down