jschuh / klipper-macros

A collection of useful macros for the Klipper 3D printer firmware
GNU General Public License v3.0
881 stars 158 forks source link

M300 #23

Closed klaas1979 closed 1 year ago

klaas1979 commented 1 year ago

I tried to install the scripts on an Ender 6 with a Hemera XS modificatation. The base setup is from 3dprintingforbeginners. I get the following error, after starting the firmware:

gcode command M300 already registered

Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.
Printer is halted

I cannot find any M300 command defined, beside in the beep.cfg

Setup was done by git cloning in the path ~/printer_data/config/klipper-macros.

As I am a newbie to 3d printing and klipper, I am lost where to search in my configurations. Can you help and provide some directions?

My printer.cfg:

# This file contains pin mappings for the stock 2020 Creality Ender 6.
# To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and with "Use USB for
# communication" disabled.

# Because this printer has factory wiring, mounts, and firmware for
# a BLTouch, but does not ship with one at this time, default values
# for the sensor have been specified, but disabled, in anticipation of
# future revisions or user modification. User should take care to
# customize the offsets, particularly z-offset, for their specific unit.

# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select the
# USART3 serial port, which is broken out on the 10 pin IDC cable used
# for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC

# Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware
# filename must end in ".bin" and must not match the last filename
# that was flashed.

# See docs/Config_Reference.md for a description of parameters.

################
# Klipper macros personal config
##
# All customizations are documented in globals.cfg. Just copy a variable from
# there into the section below, and change the value to meet your needs.

[gcode_macro _km_options]
# These are examples of some likely customizations:
# Any sheets in the below list will be available with a configurable offset.
#variable_bed_surfaces: ['smooth_1','texture_1']
# Length (in mm) of filament to load (bowden tubes will be longer).
variable_load_length: 5.0
# Hide the Octoprint LCD menu since I don't use it.
#variable_menu_show_octoprint: False
# Customize the filament menus (up to 10 entries).
variable_menu_temperature: [
  {'name' : 'PLA',  'extruder' : 200.0, 'bed' : 60.0},
  {'name' : 'PETG', 'extruder' : 230.0, 'bed' : 85.0}]
gcode: # This line is required by Klipper.
# Any code you put here will run at klipper startup, after the initialization
# for these macros. For example, you could uncomment the following line to
# automatically adjust your bed surface offsets to account for any changes made
# to your Z endstop or probe offset.
#  ADJUST_SURFACE_OFFSETS

# This line includes all the standard macros.
[include klipper-macros/*.cfg]
# Uncomment to include features that require specific hardware support.
# LCD menu support for features like bed surface selection and pause next layer.
[include klipper-macros/optional/lcd_menus.cfg]
# Optimized bed leveling
#[include klipper-macros/optional/bed_mesh.cfg]

# The sections below here are required for the macros to work.
[idle_timeout]
gcode:
  _KM_IDLE_TIMEOUT

[pause_resume]

[respond]

[save_variables]
filename: ~/printer_data/config/variables.cfg # UPDATE THIS FOR YOUR PATH!!!

[virtual_sdcard]
path: ~/gcode_files

[display_status]

# Uncomment the sections below if Fluidd complains (because it's confused).
#
#[gcode_macro CANCEL_PRINT]
#rename_existing: CANCEL_PRINT_BASE
#gcode: CANCEL_PRINT_BASE{% for k in params %}{' '~k~'='~params[k]}{% endfor %}
################
### End klipper-macros personal config
################

# Some additionals temperatures to show in graph
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100

[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100

### manual bed leveling (Klipper config with new Hemera XS screw positions
[bed_screws]
screw1: 46, 39
screw2: 233, 39
screw3: 46, 228
screw4: 233, 228

#####
#####
# the original printer file config

[stepper_x]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_endstop: 257
position_max: 257
homing_speed: 50

[stepper_y]
step_pin: PC2
dir_pin: !PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_endstop: 250
position_max: 250
homing_speed: 50

[stepper_z]
step_pin: PB6
dir_pin: PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
position_endstop: 0.0                     # disable to use BLTouch
endstop_pin: ^PA7                         # disable to use BLTouch
# endstop_pin: probe:z_virtual_endstop    # enable to use BLTouch
# position_min: -5                        # enable to use BLTouch
position_max: 400
position_min: -2

# [safe_z_home]                           # enable for BLTouch
# home_xy_position: 150.7, 137
# speed: 100
# z_hop: 10
# z_hop_speed: 5

# [bltouch]                               # enable for BLTouch
# sensor_pin: ^PB1
# control_pin: PB0
# x_offset: 20.7
# y_offset: 7
# z_offset: 2.4
# speed: 3.0

# [bed_mesh]                              # enable for BLTouch
# speed: 100
# mesh_min: 10, 10
# mesh_max: 250, 250
# algorithm: bicubic
# probe_count: 5,5

[extruder]
max_extrude_only_distance: 500.0
step_pin: PB4
dir_pin: !PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 7.6
nozzle_diameter: 0.400
filament_diameter: 1.750
pressure_advance: 0.05 # (always in the range of 0.05) from comment https://www.reddit.com/r/klippers/comments/gsrotv/anyone_using_pressure_advance_with_direct_drive/
heater_pin: PA1
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC5
#control: pid
#pid_Kp: 26.949
#pid_Ki: 1.497
#pid_Kd: 121.269
min_extrude_temp: 170
min_temp: 0
max_temp: 300

[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
#control: pid
#pid_Kp: 327.11
#pid_Ki: 19.20
#pid_Kd: 1393.45
min_temp: 0
max_temp: 100

[fan]
pin: PA0

[filament_switch_sensor e0_sensor]
switch_pin: PA4

[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command

[printer]
kinematics: corexy
max_velocity: 500
max_accel: 2000
max_z_velocity: 10
max_z_accel: 100

[t5uid1]
firmware: dgus_reloaded
machine_name: Ender 6
# volume: 0
brightness: 100
z_min: 0
z_max: 400

[virtual_sdcard]
path: ~/printer_data/gcodes

[display_status]

[gcode_macro POWEROFF]
gcode:
  RESPOND TYPE=command MSG=action:poweroff

[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
    TURN_OFF_HEATERS
    CLEAR_PAUSE
    SDCARD_RESET_FILE
    BASE_CANCEL_PRINT

#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 30.765
#*# pid_ki = 2.972
#*# pid_kd = 79.604
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 61.787
#*# pid_ki = 0.851
#*# pid_kd = 1121.439
klaas1979 commented 1 year ago

I moved beep.cfg. Now the configuration loads. I am using https://github.com/Desuuuu/DGUS-reloaded-Klipper to have the custom screen of the Ender 6 available. Maybe this can be the problem where the command is defined.

jschuh commented 1 year ago

The fork you're using adds a native m300 command, whereas mainline Klipper requires m300 to be defined via a macro. Unfortunately, there's no way to be simultaneously compatible with both (because Klipper doesn't have a conditional mechanism for macro definitions or file includes). This is just an unfortunate reality of running a fork: any changes the fork makes may introduce incompatibilities with the mainline. So, the only real option is to remove the beep.cfg file (as you have).

klaas1979 commented 1 year ago

Thank you very much for the fast reply and locking into it. I will probaly get a compatible screen someday.