First of all, and as always with my other posts and projects. I am not a company. I'm doing this in my spare time and mostly because I'm really excited to make these things work and improve things.
I have tested all this stuff only with my own printer and the constellation around it. I did my best to make it all work without problems. However, this is a work in progress. There is no guarantee. Be careful, watch your printer, double check things. Use it as is. I am not responsible for any damages or consequences of any kind..
And yes, help and improve if you find something. I will put this project under an open source license, I have an idea which one is the right one...
This is my project to enable serial (UART) connected BigTreeTech-TouchScreens with Klipper by emulating anything they need with macros. I tested it with an Artillery Sidewinder X2 printer. It comes with a relabeled Bigtreetech BTT-TFT28. It's one of the supported screens of the open source BigTreeTech TouchScreenFirmware and is original made for Marlin/RepRap firmware.
Just to clarify that, I talk about the popular TouchMode here, not an LCD emulation.
Due limitations of Klipper G-code macros, this project will conflict with the mainsail-config project. So I included also basic macros for a full featured Mainsail UI. They are derived and adapted from their recommended macros.
In general this code should work for any of these displays an may need additional changes here - but I cant test that. Feel free to help us with further improvements. General oriented pull requests are welcome.
See my blog Use your TouchScreen with Klipper on Sidewinder X2 for more details and news.
This is work in progress. Tested with my Artillery Sidewinder X2 and latest Mainsail + Klipper
The main use cases on a Cartesian printer (Artillery Sidewinder, Ender 3...) are working
Please help contributing and moving the project forward
Login on your Pi/CB1 (via SSH)
cd ~
git clone https://github.com/freakydude/klipper-serial-btt.git
Install the socat package
sudo apt -y install socat
Copy systemd-service/serial-btt-bridge.service to /etc/systemd/system/serial-btt-bridge.service
sudo cp ~/klipper-serial-btt/systemd-service/serial-btt-bridge-rpi.service /etc/systemd/system/serial-btt-bridge.service
sudo cp ~/klipper-serial-btt/systemd-service/serial-btt-bridge-cb1.service /etc/systemd/system/serial-btt-bridge.service
In Addition, ensure you have console=serial
in your /boot/BoardEnv.txt
Optional: If you did anything custom: Open the service, adapt to your home directory and your user
sudo nano /etc/systemd/system/serial-btt-bridge.service
Optional: Find the following line ExecStart=socat -d /dev/ttyAMA0,b115200 /home/pi/printer_data/comms/klippy.serial,b115200
. Replace /home/pi
by your user. On a raspberry it's /home/pi
, on a CB1 it's /home/biqu
by default. Replace /dev/ttyAMA0
with the serial (UART) interface your level-shifter and BigTreeTech-TouchScreen is connected. Hint: On the BigTreeTech CB1 it seems like UART serial pins are not enabled by default.
Optional: You could also replace "b115200" two times by the serial speed listed in your BigTreeTech Touchscreen. The default 115200Bit/sec is the safe an pre-configured speed. Make sure, you select the same speed in your Touchscreen too.
Reload services, start and enable the serial bridge
sudo systemctl daemon-reload
sudo systemctl enable --now serial-btt-bridge.service
Double check if you like
sudo systemctl status serial-btt-bridge.service
Optional: Configure your Moonraker update manager.
moonraker.conf
[update_manager klipper-serial-btt]
type: git_repo
primary_branch: main
path: ~/klipper-serial-btt
origin: https://github.com/freakydude/klipper-serial-btt.git
managed_services: klipper
Link the fd-macros
folder and the fd-macros-example.cfg
into your config folder (where printer.cfg
exists).
ln -sf ~/klipper-serial-btt/fd-macros ~/printer_data/config/
ln -sf ~/klipper-serial-btt/fd-macros-example.cfg ~/printer_data/config/
Open printer.cfg
and include the linked files from fd-macros
folder.
To start and adapting to your needs, also include (or copy and include) the fd-macros-example.cfg
file.
[include fd-macros/*.cfg]
[include fd-macros-example.cfg]
The the general idea is, that there is no need to adapt the files in fd-macros/
folder. But we linked the fd-macros-example.cfg
and included it beforehand.
If you like or have to adapt anything and if you don't want to break the update manager for this repository, it would be wise to make a copy of these files. Normally it should be only the fd-macros-example.cfg
because I designed it as a wrapper (as far as possible).
So exclude the linked files and include your adapted copies instead.
Feel free create pull requests if something general is wrong or missing.
Changes to color of a status led (for example on your extruder) on some printer states. To enable that you have to add a neopixel or dotstar config section into your printer.cfg
with the name statusled
.
Example config section for Sidewinder X2 Extruder LED
[neopixel statusled]
pin: PB7
initial_RED: 0.0
initial_GREEN: 0.25
initial_BLUE: 0.0
To enable all features, you have to configure things in your slicer (like in native Marlin) Switch to expert mode and configure the following properties:
Printer Settings
General
Firmware
Advanced
Custom G-code
Start G-code:
### is not needed if Klipper G-code flavor is selected
### and temperature emit is disable
M140 S0
M104 S0
###
;LAYER_COUNT:[total_layer_count]
;Support for Mainsail feature
SET_PRINT_STATS_INFO TOTAL_LAYER=[total_layer_count]
START_PRINT BED_TEMP=[first_layer_bed_temperature] EXTRUDER_TEMP=[first_layer_temperature]
End G-code:
END_PRINT
;mainsail
; total layers count = [total_layer_count]
Before layer change G-code:
;BEFORE_LAYER_CHANGE
;[layer_z]
;G92 E0 ;To reset relativ extruder on layer change
TIMELAPSE_TAKE_FRAME ; optional, if you configured TIMELAPSE with mainsail
Before layer change G-code:
;AFTER_LAYER_CHANGE
;[layer_z]
;LAYER:[layer_num]
SET_PRINT_STATS_INFO CURRENT_LAYER={layer_num+1}
Color Change G-code:
M600
It will work similar, please adapt accordingly and make a pull request here, if you like to.
Feel free to create pull requests and discussions. I can't solve anything alone.
Have fun!
If you like, buy me a coffee
freakyDude