diff --git a/config/hardware/displays/CR10_stock_st7920.cfg b/config/hardware/displays/CR10_stock_st7920.cfg new file mode 100644 index 00000000..be947230 --- /dev/null +++ b/config/hardware/displays/CR10_stock_st7920.cfg @@ -0,0 +1,7 @@ +[display] +lcd_type = st7920 +cs_pin = EXP1_7 +sclk_pin = EXP1_6 +sid_pin = EXP1_8 +encoder_pins: ^EXP1_3, ^EXP1_5 +click_pin: ^!EXP1_2 diff --git a/config/hardware/extruder/CR10_stock.cfg b/config/hardware/extruder/CR10_stock.cfg new file mode 100644 index 00000000..6d6e15e8 --- /dev/null +++ b/config/hardware/extruder/CR10_stock.cfg @@ -0,0 +1,21 @@ +[gcode_macro _USER_VARIABLES] +variable_extruder_enabled: True +gcode: + +[extruder] +step_pin: E0_STEP +dir_pin: E0_DIR +enable_pin: !E0_ENABLE +microsteps: 16 +rotation_distance: 33.760 # measured 34.400, ratio 0.981 by calibration. (was 33.683) +nozzle_diameter: 0.400 +filament_diameter: 1.750 +heater_pin: E_HEATER +sensor_type: EPCOS 100K B57560G104F +sensor_pin: E_TEMPERATURE +min_temp: 0 +max_temp: 250 + +# We also include the default wiring and low thermal hotend patch +[include default_wiring.cfg] +[include ../../../macros/helpers/hotend_heater_ctrl.cfg] diff --git a/config/mcu_definitions/main/Creality_v2.1.cfg b/config/mcu_definitions/main/Creality_v2.1.cfg new file mode 100644 index 00000000..6e5c192c --- /dev/null +++ b/config/mcu_definitions/main/Creality_v2.1.cfg @@ -0,0 +1,79 @@ +[board_pins mcu_manufacturer] +aliases: + + X_STEP=PF0, + X_DIR=PF1, + X_ENABLE=PD7, + X_STOP=PE5, + + Y_STEP=PF6, + Y_DIR=PF7, + Y_ENABLE=PF2, + Y_STOP=PJ1, + + Z_STEP=PL3, + Z_DIR=PL1, + Z_ENABLE=PK0, + Z_STOP=PD3, + + E_STEP=PA4, + E_DIR=PA6, + E_ENABLE=PA2, + E_HEATER=PB4, + E_TEMPERATURE=PK5, + + #MCU_E1M_STEP=N/A, + #MCU_E1M_DIR=N/A, + #MCU_E1M_ENABLE=N/A, + #MCU_HE1=N/A, + #MCU_TH1=N/A, + + BED_HEATER=PH5, + BED_TEMPERATURE=PK6, + + PART_FAN=PH6, + + # EXP1 header + EXP1_1=PC0, # Buzzer + EXP1_2=PC2, # BTN_ENC + EXP1_3=PH0, # LCD E + EXP1_4=PH1, # LCDRS + EXP1_5=PA1, # D4 + EXP1_6=PA3, # D5 + EXP1_7=PA5, # D6 + EXP1_8=PA7, # D7 + EXP1_9=, + EXP1_10=<5V>, + + # EXP2 header + EXP2_1=PB3, # N/C + EXP2_2=PB1, # SCK + EXP2_3=PC6, # BTN ENC2 + EXP2_4=PB0, # N/C + EXP2_5=PC4, # BTN ENC1 + EXP2_6=PB2, # MOSI + EXP2_7=PL0, # SD_DETECT + EXP2_8=, # RESET + EXP2_9=, # GND + EXP2_10=PG0, # KILL_PIN + +# AUX1 header + AUX1_1=<5v>, + AUX1_2=<5v>, + AUX1_3=, + AUX1_4=, + AUX1_5=PF3, # A3 + AUX1_6=PE1, # TX0 + AUX1_7=PF4, # A4 + AUX1_8=PE0, # RX0 + +# EXTRA headers +# (below EXP2) +# , , <5V> +# from top to botttom +# + EXTRA_1=PK2, # A10 + EXTRA_2=PK3, # A11 + EXTRA_3=PB6, # D12 + EXTRA_4=PB5, # D11 + diff --git a/macros/helpers/prime_line.cfg b/macros/helpers/prime_line.cfg index fef104b6..db2fe9f6 100644 --- a/macros/helpers/prime_line.cfg +++ b/macros/helpers/prime_line.cfg @@ -4,6 +4,7 @@ gcode: {% set prime_line_length = params.LINE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].prime_line_length)|float %} {% set prime_line_purge_distance = params.PURGE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].prime_line_purge_distance)|float %} {% set prime_line_flowrate = params.FLOWRATE|default(printer["gcode_macro _USER_VARIABLES"].prime_line_flowrate)|float %} + {% set prime_line_height = params.LINE_HEIGHT|default(printer["gcode_macro _USER_VARIABLES"].prime_line_height)|float %} # Set internal macro vars {% set prime_line_x, prime_line_y = printer["gcode_macro _USER_VARIABLES"].prime_line_xy|map('float') %} @@ -19,40 +20,44 @@ gcode: {% set max_extrude_cross_section = printer["configfile"].config["extruder"]["max_extrude_cross_section"]|float %} {% set filament_diameter = printer["configfile"].config["extruder"]["filament_diameter"]|float %} - {% set line_height = 0.6 %} - # some more Macro parameters after retrieving defaults {% set prime_line_x = params.START_X|default(prime_line_x)|float %} {% set prime_line_y = params.START_Y|default(prime_line_y)|float %} {% set prime_line_direction = params.LINE_DIRECTION|default(printer["gcode_macro _USER_VARIABLES"].prime_line_direction)|string|upper %} + {% if verbose %} + {action_respond_info("Prime line length: %.4f" % prime_line_length)} + {action_respond_info("Prime line eight: %.4f" % prime_line_height)} + {action_respond_info("prime line extrusion length: %4.f" % prime_line_purge_distance)} + {% endif %} + # We first compute the width of the prime line {% set purge_volume = prime_line_purge_distance * 3.14159 * (filament_diameter / 2)**2 %} - {% set line_width = purge_volume / (line_height * prime_line_length) %} + {% set line_width = purge_volume / (prime_line_height * prime_line_length) %} # Then we check that the prime line cross section will not be problematic (exceeding Klipper max_extrude_cross_section) # or, if it's the case, we warn the user and add a correction to the length of filament to be purged - {% if (line_height * line_width) > max_extrude_cross_section %} + {% if (prime_line_height * line_width) > max_extrude_cross_section %} {% if verbose %} {action_respond_info("The prime_line_purge_distance of %.4f mm is too high and will exceed the max_extrude_cross_section!" % prime_line_purge_distance)} {% endif %} {% set prime_line_purge_distance = 0.98 * (max_extrude_cross_section * prime_line_length) / (3.14159 * (filament_diameter / 2)**2) %} {% set purge_volume = prime_line_purge_distance * 3.14159 * (filament_diameter / 2)**2 %} - {% set line_width = purge_volume / (line_height * prime_line_length) %} + {% set line_width = purge_volume / (prime_line_height * prime_line_length) %} {% if verbose %} {action_respond_info("Klippain corrected the prime_line_purge_distance to %.4f mm" % prime_line_purge_distance)} {% endif %} {% endif %} # We then compute the height to width ratio and validate that the prime line will not be too thin - {% if (line_height / line_width) >= 0.5 %} # TODO: validate this 1/2 ratio is good for all + {% if (prime_line_height / line_width) >= 0.5 %} # TODO: validate this 1/2 ratio is good for all {% if verbose %} {action_raise_error("The prime line will be too thin and will probably not stick properly to the bed. Increase its purge distance or decrease its length! Aborting...")} {% endif %} {% endif %} # Finally we compute the speed to get the correct flowrate for the prime line - {% set speed = (prime_line_flowrate / (line_height * line_width)) * 60 |float %} + {% set speed = (prime_line_flowrate / (prime_line_height * line_width)) * 60 |float %} {% if klippain_ercf_enabled %} {% if printer.ercf.enabled %} @@ -78,7 +83,7 @@ gcode: # Starting position G90 G0 X{prime_line_x} Y{prime_line_y} F{St} - G1 Z{line_height} F{Sz|int / 2} + G1 Z{prime_line_height} F{Sz|int / 2} # Add pressure in the nozzle G92 E0 diff --git a/user_templates/variables.cfg b/user_templates/variables.cfg index c6f0468e..76115fb7 100644 --- a/user_templates/variables.cfg +++ b/user_templates/variables.cfg @@ -60,6 +60,7 @@ variable_prime_line_direction: "X" # can also be set to "Y" variable_prime_line_length: 40 # length of the prime line on the bed (in mm) variable_prime_line_purge_distance: 30 # length of filament to purge (in mm) variable_prime_line_flowrate: 10 # mm3/s used for the prime line +variable_prime_line_height: 0.6 # mm, used for actual cross section computation ## Park position used when pause, end_print, etc... variable_park_position_xy: -1, -1