diff --git a/config/hardware/fans/hotend_fan_tachometer.cfg b/config/hardware/fans/hotend_fan_tachometer.cfg new file mode 100644 index 000000000..dbf370a8c --- /dev/null +++ b/config/hardware/fans/hotend_fan_tachometer.cfg @@ -0,0 +1,14 @@ +[gcode_macro _USER_VARIABLES] +variable_hotend_fan_tach_enabled: True +gcode: + +[heater_fan hotend_fan] +pin: E_FAN +max_power: 1.0 +kick_start_time: 0.100 +heater: extruder +heater_temp: 50.0 +tachometer_pin: E_FAN_TACHO + +# And we also include the tachometer check macros from here +[include ../../../macros/helpers/tachometer_check.cfg] diff --git a/config/hardware/fans/part_fan_tachometer.cfg b/config/hardware/fans/part_fan_tachometer.cfg new file mode 100644 index 000000000..675ec97bd --- /dev/null +++ b/config/hardware/fans/part_fan_tachometer.cfg @@ -0,0 +1,12 @@ +[gcode_macro _USER_VARIABLES] +variable_part_fan_tach_enabled: True +gcode: + +[fan] +pin: PART_FAN +kick_start_time: 0.100 +cycle_time: 0.010 +tachometer_pin: PART_FAN_TACHO + +# And we also include the tachometer check macros from here +[include ../../../macros/helpers/tachometer_check.cfg] diff --git a/config/mcu_definitions/toolhead/LDO_Nighthawk-SB_v1.0.cfg b/config/mcu_definitions/toolhead/LDO_Nitehawk-SB_v1.0.cfg similarity index 100% rename from config/mcu_definitions/toolhead/LDO_Nighthawk-SB_v1.0.cfg rename to config/mcu_definitions/toolhead/LDO_Nitehawk-SB_v1.0.cfg diff --git a/docs/pinout.md b/docs/pinout.md index 2501a75b6..e8a681136 100644 --- a/docs/pinout.md +++ b/docs/pinout.md @@ -57,7 +57,9 @@ Here is a list of all the "Frix-x names" available to use in your own board_pins #### Fans - `E_FAN`: hotend fan. This fan should stay at 100% whenever the hotend is hot, so a PWM capable pin is not mandatory + - `E_FAN_TACHO`: tachometer of the hotend fan, optional and used to validate that the fan is spinning as a safety feature - `PART_FAN`: part fan used during the print. This pin should be a PWM capable pin to allow modulation of the fan speed + - `PART_FAN_TACHO`: tachometer of the part fan, optional and used to validate that the fan is spinning as a safety feature - `EXHAUST_FAN`: for an exhaust filter (such as the Voron basic exhaust). This pin should be a PWM capable pin to allow modulation of the fan speed - `FILTER_FAN`: for a filter (such as a Nevermore filter). This pin should be a PWM capable pin to allow modulation of the fan speed - `CONTROLLER_FAN`: to cool down your MCUs or electronic bay diff --git a/macros/base/cancel_print.cfg b/macros/base/cancel_print.cfg index 177a84b45..82c3a8ade 100644 --- a/macros/base/cancel_print.cfg +++ b/macros/base/cancel_print.cfg @@ -13,6 +13,7 @@ gcode: {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} {% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %} + {% set hotend_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].hotend_fan_tach_enabled %} PARK @@ -33,6 +34,10 @@ gcode: SET_HEATER_TEMPERATURE HEATER=extruder TARGET={safe_extruder_temp} {% endif %} + {% if hotend_fan_tach_enabled %} + UPDATE_DELAYED_GCODE ID=_BACKGROUND_HOTEND_TACHO_CHECK DURATION=0 + {% endif %} + M107 M400 diff --git a/macros/base/end_print.cfg b/macros/base/end_print.cfg index ce191eb45..5228ba43a 100644 --- a/macros/base/end_print.cfg +++ b/macros/base/end_print.cfg @@ -13,6 +13,7 @@ gcode: {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} {% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %} {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} + {% set hotend_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].hotend_fan_tach_enabled %} PARK @@ -33,6 +34,10 @@ gcode: SET_HEATER_TEMPERATURE HEATER=extruder TARGET={safe_extruder_temp} {% endif %} + {% if hotend_fan_tach_enabled %} + UPDATE_DELAYED_GCODE ID=_BACKGROUND_HOTEND_TACHO_CHECK DURATION=0 + {% endif %} + M107 M400 diff --git a/macros/base/start_print.cfg b/macros/base/start_print.cfg index e98859a1c..54416b635 100644 --- a/macros/base/start_print.cfg +++ b/macros/base/start_print.cfg @@ -61,6 +61,8 @@ gcode: {% set firmware_retraction_enabled = printer["gcode_macro _USER_VARIABLES"].firmware_retraction_enabled %} {% set filter_enabled = printer["gcode_macro _USER_VARIABLES"].filter_enabled %} {% set filament_sensor_enabled = printer["gcode_macro _USER_VARIABLES"].filament_sensor_enabled %} + {% set part_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].part_fan_tach_enabled %} + {% set hotend_fan_tach_enabled = printer["gcode_macro _USER_VARIABLES"].hotend_fan_tach_enabled %} {% if MATERIAL not in printer["gcode_macro _USER_VARIABLES"].material_parameters %} RESPOND MSG="Material '{MATERIAL}' is unknown!" @@ -96,6 +98,19 @@ gcode: STOP_FILTER {% endif %} + # If a tachometer is enabled on one of the fans, we check them: + # - It's done only once for the part fan to be sure nothing block it before starting the print + # - And as a safety feature, we start a monitoring loop for the hotend fan (that is automatically stopped at the end of a print) + {% if part_fan_tach_enabled %} + M106 S255 + G4 P2000 + _PART_FAN_CHECK + M106 S0 + {% endif %} + {% if hotend_fan_tach_enabled %} + UPDATE_DELAYED_GCODE ID=_BACKGROUND_HOTEND_TACHO_CHECK DURATION=1 + {% endif %} + SET_GCODE_OFFSET Z=0 M221 S100 M220 S100 diff --git a/macros/hardware_functions/tacho_macros.cfg b/macros/hardware_functions/tacho_macros.cfg deleted file mode 100644 index 820e38fa3..000000000 --- a/macros/hardware_functions/tacho_macros.cfg +++ /dev/null @@ -1,25 +0,0 @@ -## This config file contains macros that can be used in conjuction with tacho-enabled part fans -## -## - PREFLIGHT_CHECK, add this to the beginning of your PRINT_START macro to check your PCF fans. -## If either of the fans are malfunctioning, the print job will be cancelled. - -[gcode_macro PCF_CHECK] -description: sub-macro of PREFLIGHT CHECK, not intended to be used outside of parent macro -gcode: - {% if printer.fan.rpm is not none %} - {% if printer.fan.rpm > 500 %} - {action_respond_info("Part fan self-test: PASS")} - {% else %} - CANCEL_PRINT - {action_respond_info("Part fan self-test: FAIL!")} - {% endif %} - {% endif %} - -[gcode_macro PREFLIGHT_CHECK] -description: Use before print startup, checks the part fan for failures -gcode: - M106 S128 ; turn on the part fan - G4 P2000 ; wait for the fan to spin up - M400 - PCF_CHECK ; check part fan speed - M106 S0 ; turn off the part fan \ No newline at end of file diff --git a/macros/helpers/tachometer_check.cfg b/macros/helpers/tachometer_check.cfg new file mode 100644 index 000000000..a39d9f84a --- /dev/null +++ b/macros/helpers/tachometer_check.cfg @@ -0,0 +1,44 @@ +## This config file contains macros that are used in conjuction with tacho-enabled hotend and part fans + +# Monitoring loop for hotend fan safety check +[delayed_gcode _BACKGROUND_HOTEND_TACHO_CHECK] +gcode: + _HOTEND_FAN_CHECK + UPDATE_DELAYED_GCODE ID=_BACKGROUND_HOTEND_TACHO_CHECK DURATION=3 + +[gcode_macro _HOTEND_FAN_CHECK] +description: Check the hotend fan tachometer to verify that it is running effectively +variable_he_stop_count: 0 +gcode: + {% set min_rpm = 1000|float %} # This is a relatively low value adapted to all fans to check that they are effectively running + {% set max_consecutive_stops = 3 %} + {% set rpm = printer['heater_fan hotend_fan'].rpm|float %} + {% set he_target = printer[printer.toolhead.extruder].target|float %} + {% set he_temp = printer[printer.toolhead.extruder].temperature|float %} + {% set fan_on_temp = printer.configfile.settings['heater_fan hotend_fan'].heater_temp|float %} + {% set he_stop_count = printer["gcode_macro _HOTEND_FAN_CHECK"].he_stop_count|int %} + + {% if (he_target >= fan_on_temp) and (rpm < min_rpm) and (he_temp >= fan_on_temp) %} + SET_GCODE_VARIABLE MACRO=_HOTEND_FAN_CHECK VARIABLE=he_stop_count VALUE={he_stop_count + 1} + RESPOND MSG="Hotend fan stoppage detected for {(he_stop_count+1)*3}sec (max {max_consecutive_stops*3}sec allowed)" + M400 + {% if printer["gcode_macro _HOTEND_FAN_CHECK"].he_stop_count|int >= max_consecutive_stops-1 %} + CANCEL_PRINT + {% endif %} + {% else %} + SET_GCODE_VARIABLE MACRO=_HOTEND_FAN_CHECK VARIABLE=he_stop_count VALUE=0 + {% endif %} + + +[gcode_macro _PART_FAN_CHECK] +description: Check the part fan tachometer to verify that it is running effectively +gcode: + {% if printer.fan.rpm is not none %} + {% if printer.fan.rpm > 1000 %} # This is a relatively low value adapted to all fans to check that they are effectively running + {action_respond_info("Part fan OK!")} + {% else %} + M400 + CANCEL_PRINT + {action_raise_error("Hotend fan stoppage detected, print was canceled!")} + {% endif %} + {% endif %} diff --git a/user_templates/mcu_defaults/main/BTT_SKR_3.cfg b/user_templates/mcu_defaults/main/BTT_SKR_3.cfg index 1215052dd..47d4addcf 100644 --- a/user_templates/mcu_defaults/main/BTT_SKR_3.cfg +++ b/user_templates/mcu_defaults/main/BTT_SKR_3.cfg @@ -1,3 +1,4 @@ + #-------------------------------------# #### BTT SKR3 definition #### #-------------------------------------# diff --git a/user_templates/mcu_defaults/main/BTT_SKR_Pro_V1.2.cfg b/user_templates/mcu_defaults/main/BTT_SKR_Pro_V1.2.cfg index 3fa28618d..0d24e295a 100644 --- a/user_templates/mcu_defaults/main/BTT_SKR_Pro_V1.2.cfg +++ b/user_templates/mcu_defaults/main/BTT_SKR_Pro_V1.2.cfg @@ -1,3 +1,4 @@ + #----------------------------------------# #### BTT SKR Pro v1.2 definition ######## #----------------------------------------# diff --git a/user_templates/mcu_defaults/main/MY-OWN-CUSTOM-TEMPLATE.cfg b/user_templates/mcu_defaults/main/MY-OWN-CUSTOM-TEMPLATE.cfg index 40b1f8f95..0ba4765fe 100644 --- a/user_templates/mcu_defaults/main/MY-OWN-CUSTOM-TEMPLATE.cfg +++ b/user_templates/mcu_defaults/main/MY-OWN-CUSTOM-TEMPLATE.cfg @@ -37,7 +37,9 @@ aliases: E_HEATER= , E_TEMPERATURE= , BED_HEATER= , BED_TEMPERATURE= , - PART_FAN= , E_FAN= , + PART_FAN= , E_FAN= , + PART_FAN_TACHO , E_FAN_TACHO , + CONTROLLER_FAN= , EXHAUST_FAN= , FILTER_FAN= , diff --git a/user_templates/mcu_defaults/toolhead/LDO_Nighthawk-SB_v1.0.cfg b/user_templates/mcu_defaults/toolhead/LDO_Nighthawk-SB_v1.0.cfg deleted file mode 100644 index 397af613e..000000000 --- a/user_templates/mcu_defaults/toolhead/LDO_Nighthawk-SB_v1.0.cfg +++ /dev/null @@ -1,152 +0,0 @@ - -#-------------------------------------------------------# -#### LDO Nighthawk SB toolhead v1 MCU definition ######## -#-------------------------------------------------------# - -[mcu toolhead] -##-------------------------------------------------------------------- -serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 ##### <--- change-me-to-the-correct-serial hint: ls /dev/serial/by-id/* # -##-------------------------------------------------------------------- - -# If you want to override the wiring of the LDO Nighthawk, keep in mind that this -# board is defined using the "toolhead" name. So you should use "pin: toolhead:PIN_NAME" -# in your own overrides.cfg files. - -[include config/mcu_definitions/toolhead/LDO_Nighthawk-SB_v1.0.cfg] # Do not remove this line -[board_pins nighthawk_mcu] -mcu: toolhead -aliases: - E_STEP=MCU_EMOT_STEP , E_DIR=MCU_EMOT_DIR , E_ENABLE=MCU_EMOT_EN , E_TMCUART=MCU_EMOT_UART , - - X_STOP=MCU_ENDSTOP_X , - PROBE_INPUT=MCU_HV_ENDSTOP , - - E_HEATER=MCU_HEAT , E_TEMPERATURE=MCU_TEMP , CHAMBER_TEMPERATURE=MCU_HEAT_CHAMBER , - NH_MCU_TEMP=MCU_NH_TEMP - - PART_FAN=MCU_FAN1 , E_FAN=MCU_FAN0 , PART_FAN_TACHO=MCU_PWM0 , E_FAN_TACHO=MCU_PWM1 , - - STATUS_NEOPIXEL=MCU_RGB , STATUS_BOARD=MCU_ACTIVITY_LED , - - ADXL_CS=MCU_ADXL_CS , ADXL_SCLK=MCU_ADXL_SCK , ADXL_MOSI=MCU_ADXL_MOSI , ADXL_MISO=MCU_ADXL_MISO , - - TX_PIN=MCU_ST_UART_TX , - - -#----------------------------------------# -# LDO Nighthawk-SB v1 pins remapping # -#----------------------------------------# - -# These pins overrides are automatically added when you select the LDO -# toolhead MCU during the installation process. They should provide a -# good base to work with. Feel free to adapt to your board if needed! - -##################################################################### -# Extruder -##################################################################### - -[extruder] -step_pin: toolhead:E_STEP -dir_pin: toolhead:E_DIR -enable_pin: !toolhead:E_ENABLE -heater_pin: toolhead:E_HEATER -sensor_pin: toolhead:E_TEMPERATURE -pullup_resistor: 2200 - -[tmc2209 extruder] -uart_pin: toolhead:E_TMCUART -tx_pin: toolhead:TX_PIN -sense_resistor: 0.100 - -##################################################################### -# Probe -##################################################################### - -[probe] -pin: ^toolhead:PROBE_INPUT - -##################################################################### -# Fans -##################################################################### - -[fan] -pin: toolhead: PART_FAN -#tachometer_pin: toolhead:PART_FAN_TACHO -#tachometer_ppr: 2 - -[heater_fan hotend_fan] -pin: toolhead: E_FAN -tachometer_pin: toolhead:E_FAN_TACHO -tachometer_ppr: 2 - -## Uncomment the following line if not using sensorless homing -## and having the X endstop plugged to the toolhead MCU -# [stepper_x] -# endstop_pin: ^toolhead:X_STOP - -##################################################################### -# Lights -##################################################################### - -[neopixel status_leds] -pin: toolhead:STATUS_NEOPIXEL - -## PCB Activity Light -[output_pin act_led] -pin: toolhead:STATUS_BOARD - -##################################################################### -# Accelerometer -##################################################################### - -[adxl345] -cs_pin: toolhead:ADXL_CS -spi_software_sclk_pin: toolhead:ADXL_SCLK -spi_software_mosi_pin: toolhead:ADXL_MOSI -spi_software_miso_pin: toolhead:ADXL_MISO - -[resonance_tester] -accel_chip: adxl345 -##-------------------------------------------------------------------- -## Uncomment below for 250mm build -#probe_points: -# 125, 125, 20 - -## Uncomment below for 300mm build -#probe_points: -# 155, 155, 20 - -## Uncomment below for 350mm build -#probe_points: -# 175, 175, 20 - -##################################################################### -# Thermistors -# ##################################################################### - -## If you do not have an external thermistor connected to the board, please comment this section out - -## External Chamber Thermistor Port -[temperature_sensor chamber_temp] -sensor_type: Generic 3950 -sensor_pin: toolhead:CHAMBER_TEMPERATURE -min_temp: 0 -max_temp: 100 -gcode_id: chamber_th - -[thermistor CMFB103F3950FANT] -temperature1: 0.0 -resistance1: 32116.0 -temperature2: 40.0 -resistance2: 5309.0 -temperature3: 80.0 -resistance3: 1228.0 - -[temperature_sensor nh_temp] -## Nitehawk PCB Sensor -sensor_type: CMFB103F3950FANT -sensor_pin: toolhead:NH_MCU_TEMP -pullup_resistor: 2200 -min_temp: 0 -max_temp: 100 -gcode_id: chamber_th diff --git a/user_templates/mcu_defaults/toolhead/LDO_Nitehawk-SB_v1.0.cfg b/user_templates/mcu_defaults/toolhead/LDO_Nitehawk-SB_v1.0.cfg new file mode 100644 index 000000000..4fd4d99b0 --- /dev/null +++ b/user_templates/mcu_defaults/toolhead/LDO_Nitehawk-SB_v1.0.cfg @@ -0,0 +1,84 @@ + +#-------------------------------------------------------# +#### LDO Nighthawk SB toolhead v1 MCU definition ######## +#-------------------------------------------------------# + +[mcu toolhead] +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 ##### <--- change-me-to-the-correct-serial hint: ls /dev/serial/by-id/* # +##-------------------------------------------------------------------- + +# If you want to override the wiring of the LDO Nighthawk, keep in mind that this +# board is defined using the "toolhead" name. So you should use "pin: toolhead:PIN_NAME" +# in your own overrides.cfg files. + +[include config/mcu_definitions/toolhead/LDO_Nitehawk-SB_v1.0.cfg] # Do not remove this line +[board_pins nitehawk_mcu] +mcu: toolhead +aliases: + E_STEP=MCU_EMOT_STEP , E_DIR=MCU_EMOT_DIR , E_ENABLE=MCU_EMOT_EN , E_TMCUART=MCU_EMOT_UART , + + X_STOP=MCU_ENDSTOP_X , + PROBE_INPUT=MCU_HV_ENDSTOP , + + E_HEATER=MCU_HEAT , E_TEMPERATURE=MCU_TEMP , CHAMBER_TEMPERATURE=MCU_HEAT_CHAMBER , + NH_MCU_TEMP=MCU_NH_TEMP , + + PART_FAN=MCU_FAN1 , E_FAN=MCU_FAN0 , + PART_FAN_TACHO=MCU_PWM0 , E_FAN_TACHO=MCU_PWM1 , + + STATUS_NEOPIXEL=MCU_RGB , STATUS_BOARD=MCU_ACTIVITY_LED , + + ADXL_CS=MCU_ADXL_CS , ADXL_SCLK=MCU_ADXL_SCK , ADXL_MOSI=MCU_ADXL_MOSI , ADXL_MISO=MCU_ADXL_MISO , + + TX_PIN=MCU_ST_UART_TX , + + +#----------------------------------------# +# LDO Nighthawk-SB v1 pins remapping # +#----------------------------------------# + +# These pins overrides are automatically added when you select the LDO +# toolhead MCU during the installation process. They should provide a +# good base to work with. Feel free to adapt to your board if needed! + +[extruder] +step_pin: toolhead:E_STEP +dir_pin: toolhead:E_DIR +enable_pin: !toolhead:E_ENABLE +heater_pin: toolhead:E_HEATER +sensor_pin: toolhead:E_TEMPERATURE +pullup_resistor: 2200 + +[tmc2209 extruder] +uart_pin: toolhead:E_TMCUART +tx_pin: toolhead:TX_PIN +sense_resistor: 0.100 + +[probe] +pin: ^toolhead:PROBE_INPUT + +[fan] +pin: toolhead:PART_FAN +#tachometer_pin: toolhead:PART_FAN_TACHO + +[heater_fan hotend_fan] +pin: toolhead:E_FAN +# tachometer_pin: toolhead:E_FAN_TACHO + +## Uncomment the following line if not using sensorless homing +## and having the X endstop plugged to the toolhead MCU +# [stepper_x] +# endstop_pin: ^toolhead:X_STOP + +[neopixel status_leds] +pin: toolhead:STATUS_NEOPIXEL + +## Nitehawk PCB temperature sensor +[temperature_sensor nh_temp] +sensor_type: CMFB103F3950FANT +sensor_pin: toolhead:NH_MCU_TEMP +pullup_resistor: 2200 +min_temp: 0 +max_temp: 100 + diff --git a/user_templates/printer.cfg b/user_templates/printer.cfg index a6485d270..738bafea8 100644 --- a/user_templates/printer.cfg +++ b/user_templates/printer.cfg @@ -113,6 +113,10 @@ ### -------------------------------------------------------------------------------------- # [include config/hardware/fans/hotend_fan.cfg] # [include config/hardware/fans/part_fan.cfg] + +# [include config/hardware/fans/hotend_fan_tachometer.cfg] # When having a tachometer monitoring hotend fan speed +# [include config/hardware/fans/part_fan_tachometer.cfg] # When having a tachometer monitoring part fan speed + # [include config/hardware/fans/controller_fan.cfg] # [include config/hardware/fans/rpi_fan.cfg] # ---------------------------------------------------------------------------------------- @@ -156,7 +160,7 @@ # [include config/hardware/temperature_sensors/cabinet_temp.cfg] # [include config/hardware/temperature_sensors/chamber_temp.cfg] # [include config/hardware/temperature_sensors/chamber_temp_ds18b20.cfg] # Specific for DS18B20 directly connected to the Pi -# [include config/hardware/temperature_sensors/chamber_temp_toolhead.cfg] # This is not recommended as toolhead board temperature sensors are not accurate +# [include config/hardware/temperature_sensors/chamber_temp_toolhead.cfg] # This is to use a toolhead integrated temperature sensor (or an external one as it's done on the LDO Nitehawk) # ----------------------------------------------------------------------------------------