Configuration Requirements¶
We need to change your printer.cfg a bit, so that the screen software can find the right parameters from the moonraker API.
I recommend backing up your klipper config.
Make sure you have these sections (or rename existing) and they are correctly configured in your printer.cfg (or the included files):
[extruder] - (obvious... shouldnt need to change)
[heater_bed] - (obvious... shouldnt need to change)
[heater_generic chamber] (only for X-Plus3, X-Max3 and Plus4 owners)
[fan_generic partfan]
[fan_generic sidefan] (only for X-Plus3, X-Max3 and Plus4 owners)
[fan_generic filterfan]
[output_pin caselight]
For the X3-series:
[filament_switch_sensor filament]
For the Q1 Pro and Plus4:
[filament_switch_sensor filament_tangle_sensor]
[hall_filament_width_sensor]
Warning
I want to make this clear: The naming must match.
A common issue is that the filament sensor is still named "fila" instead of the new naming "filament".
Next, we need to add freedi specific configs to your printer.cfg.
For a cleaner structure, I recommend doing it by adding an include like this to your printer.cfg:
#####################################################################
# FreeDi
#####################################################################
[include freedi.cfg]
Next, create a freedi.cfg file with the following content:
FreeDi.cfg:
#####################################################################
# FreeDi config
#####################################################################
[freedi]
# Printer model. Currently supported: x-smart3, x-plus3, x-max3, q1_pro, plus4 and unknown (for autodetection)
printer_model: unknown
# Baud rate for serial communication. Stock mainboard with standard firmware: 921600 | Legacy firmware: 115200
baudrate: 921600
# Serial port for the LCD. Stock: /dev/ttyS1 | USB<->TTL adapter: /dev/ttyUSB0 | BTT Manta M5P: /dev/ttyS0
serial_port: /dev/ttyS1
# URL of the printer service
url: 127.0.0.1
# Port of the moonraker service. Default: 7125
moonraker_port: 7125
# Port of the web user interface (Mainsail | Fluidd). Default: 80
webUI_port: 80
# API key for the printer
api_key: XXXXXX
# Path to the Klippy socket file
klippy_socket: /home/mks/printer_data/comms/klippy.sock
# Specify if you want to use the stable or beta channel. Caution: beta firmwares have more potential to have bugs.
channel: stable
# Enable FreeDi wizard: True | False
wizard: True
# default values for on screen activation
default_temp_extruder: 220
default_temp_bed: 60
default_temp_chamber: 45
default_speed_partfan: 100
default_speed_sidefan: 100
default_speed_filterfan: 100
# Synchronize case light with display: True | False
sync_case_light_with_display: True
# Default brightness of the display
default_brightness: 100
# Dim display: time in minutes | 0 to disable
lcd_dim_time: 10
# Dim display: intensity in percent
lcd_dim_brightness: 20
# Sleep display: time in minutes | 0 to disable
lcd_sleep_time: 20
#### not yet integrated ####
# Toggle to install the klipper module: True | False
install_klipper_module: False
# Toggle to flash the MCU: True | False
flash_MCU: False
# Toggle to flash the toolhead: True | False
flash_toolhead: False
# Toggle to flash the display: True | False
flash_display: False
# Preset names on the display home screen:
preset1_name: PLA
preset2_name: ASA
preset3_name: PETG
preset4_name: TPU
#####################################################################
# FreeDi macros
#####################################################################
# Description:
# This section is used to define the preset buttons on the display.
# This gives you maximum flexiblity to replace them with your own custom macros.
[gcode_macro PRESET_MACRO_1]
# Preset macro 1 (default for PLA)
gcode:
M104 S210 ; Set extruder temp
M140 S60 ; Set bed temp
M141 S0 ; Set chamber temp
[gcode_macro PRESET_MACRO_2]
# Preset macro 12 (default for ABS)
gcode:
M104 S250 ; Set extruder temp
M140 S95 ; Set bed temp
M141 S45 ; Set chamber temp
[gcode_macro PRESET_MACRO_3]
# Preset macro 3 (default for PETG)
gcode:
M104 S240 ; Set extruder temp
M140 S70 ; Set bed temp
M141 S0 ; Set chamber temp
[gcode_macro PRESET_MACRO_4]
## Preset macro 4 (default for TPU)
gcode:
M104 S250 ; Set extruder temp
M140 S40 ; Set bed temp
M141 S0 ; Set chamber temp
You will need to setup 3 macros:
First (mandatory) macro is to rename the fans:
fans macros:
########################################
# Fan Macros
########################################
# Set Fan Speed macro
# Mainly name castings for nicer web interface names and display functionality
[gcode_macro M106]
rename_existing: M106.1
gcode:
{% if params.P is defined %}
{% if params.S is defined %}
{% set speed = 0.003921*params.S|int %}
{% if (params.P|int) == 0 %}
M106.1 S{params.S|int}
{% elif (params.P|int) == 2 %}
SET_FAN_SPEED FAN=sidefan SPEED={speed}
{% elif (params.P|int) == 3 %}
SET_FAN_SPEED FAN=filterfan SPEED={speed}
{% else %}
SET_FAN_SPEED FAN=fan{params.P|int} SPEED={speed}
{% endif %}
{% else %}
{% if (params.P|int) == 0 %}
M106.1 S255
{% elif (params.P|int) == 2 %}
SET_FAN_SPEED FAN=sidefan SPEED=1
{% elif (params.P|int) == 3 %}
SET_FAN_SPEED FAN=filterfan SPEED=1
{% else %}
SET_FAN_SPEED FAN=fan{params.P|int} SPEED=1
{% endif %}
{% endif %}
{% endif %}
{% if params.T is defined %}
{% if (params.T|int) == -2 %}
{% if params.S is defined %}
{% set speed = 0.003921*params.S|int %}
SET_FAN_SPEED FAN=filterfan SPEED={speed}
{% else %}
SET_FAN_SPEED FAN=filterfan SPEED=1
{% endif %}
{% endif %}
{% endif %}
{% if params.P is undefined %}
{% if params.T is undefined %}
{% if params.S is defined %}
M106.1 S{params.S|int}
{% else %}
M106.1 S255
{% endif %}
{% endif %}
{% endif %}
[gcode_macro M107]
rename_existing: M107.1
gcode:
M106.1 S0
Next macro is for the loading/unloading of filament functionality.
Its not mandatory, but it's handy to use these macros from the screen UI:
load/unload filament macros:
[gcode_macro UNLOAD_FILAMENT]
description: Unloads filament from toolhead
gcode:
{% set EXTRUDER_TEMP = params.TEMP|default(215)|int %}
M109 S{EXTRUDER_TEMP} ; heat up the hotend
M83 ; set extruder to relative mode
G1 E5 F150 ; extrude a small amount to elimate soften the filament
G1 E-8 F1800 ; quickly retract a small amount to elimate stringing
G4 P200 ; pause for a short amount of time
G1 E-50 F300 ; retract slowly the rest of the way
M400 ; wait for moves to finish
M117 Unload Complete!
[gcode_macro LOAD_FILAMENT]
description: Loads filament to toolhead
gcode:
{% set EXTRUDER_TEMP = params.TEMP|default(215)|int %}
M109 S{EXTRUDER_TEMP} ; heat up the hotend
M83 ; set extruder to relative mode
G1 E5 F120 ; feed filament
G1 E5 F300 ; feed filament
G1 E40 F600 ; feed filament
G1 E15 F300 ; feed filament
G1 E15 F120 ; feed filament
G4 P200 ; pause for a short amount of time
G1 E10 F90 ; feed filament
M400 ; wait for moves to finish
M117 Load Complete!
At this point, klipper/mainsail should not give you any errors in the WebUI. If you see any, fix them. 😄