Installation guide for existing systems - Phil1988/FreeDi GitHub Wiki

This is a step by step guide how to enable the stock screen if you already have an open armbian system.
If you are interested, I have a guide how to do that on your own.

If you have a stock Qidi operating system or dont know what I am even talking about, please head over to the:
Installation guide for stock systems.

#1: Prepare your printer configuration:

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)
[output_pin partfan]
[output_pin sidefan]        (only for X-Plus3, X-Max3 and Plus4 owners)
[output_pin filterfan]
[output_pin caselight]
[filament_switch_sensor filament]

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, add this section to your printer.cfg and adjust the settings according to your setup:

[freedi]
# Printer model. Currently supported: x-smart3, x-plus3, x-max3, q1-pro, plus4
printer_model: x-max3
# 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 printer service
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

You will need to setup 3 macros: First (mandatory) macro is to rename the fans:

[gcode_macro M106]
gcode:
    {% if params.P is defined %}
      {% if params.S is defined %}
        {% if (params.P|int) == 0 %}
          SET_PIN PIN=partfan VALUE={params.S|int}
        {% elif (params.P|int) == 2 %}
          SET_PIN PIN=sidefan VALUE={params.S|int}
        {% elif (params.P|int) == 3 %}
          SET_PIN PIN=filterfan VALUE={params.S|int}
        {% else %}
          SET_PIN PIN=fan{params.P|int} VALUE={params.S|int}
        {% endif %}
      {% else %}
        {% if (params.P|int) == 0 %}
          SET_PIN PIN=partfan VALUE=255
        {% elif (params.P|int) == 2 %}
          SET_PIN PIN=sidefan VALUE=255
        {% elif (params.P|int) == 3 %}
          SET_PIN PIN=filterfan VALUE=255
        {% else %}
          SET_PIN PIN=fan{params.P|int} VALUE=255
        {% endif %}
      {% endif %}
    {% endif %} 

    {% if params.T is defined %}
      {% if (params.T|int) == -2 %}
        {% if params.S is defined %}
          SET_PIN PIN=filterfan VALUE={params.S|int}
        {% else %}
          SET_PIN PIN=filterfan VALUE=255
        {% endif %}
      {% endif %}
    {% endif %}

    {% if params.P is undefined %}
      {% if params.T is undefined %}
        {% if params.S is defined %}
          SET_PIN PIN=partfan VALUE={params.S|int}
        {% else %}
          SET_PIN PIN=partfan VALUE=255
        {% endif %}
      {% endif %}
    {% endif %}

2nd Macro is for the "unload filament" functionality.
Its not mandatory, but handy to use these macros from the UI:

[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!

3rd Macro is for the "load filament" functionality.
Its not mandatory, but handy to use from the UI:

[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 please ;)

#3 Installing FreeDi:

Connect to your printer via ssh (eg. PuTTY) to get the files. Run the commands below one by one in your terminal:

Download this project and install FreeDi:

cd ~ && git clone https://github.com/Phil1988/FreeDi ~/FreeDi && cd ~/FreeDi && ./install.sh

This will install everything for you. It will also start a firmware update automatically for your screen.

Please check the terminal output and feedback if you receive any errors or problems (screenshots will help me helping you).
The install script will setup an autostart entry for the X3seriesLCD software for your printer.
The screen should work after the next boot, but if you want to manually start it, you can simply...

#4 Enjoy it!

If everything works, your screen will show the "home"-page.
If not. Bye! ;)
(open a detailed issue report please)

⚠️ **GitHub.com Fallback** ⚠️