Skip to content

Commit 460c915

Browse files
authored
Update (#1)
Update
1 parent f2aa4bc commit 460c915

File tree

487 files changed

+34178
-24781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

487 files changed

+34178
-24781
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.idea/
2+
KlipperScreen.conf
3+
__pycache__/
4+
*.py[cod]
5+
*$py.class
6+
dist/
7+
build/
8+
venv/

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
# KlipperScreen
2-
## Z-BoltUI
3-
KlipperScreen is touchscreen GUI for Klipper based 3D printers. KlipperScreen interfaces with [Klipper](https://github.com/kevinOConnor/klipper) via [Moonraker](https://github.com/arksine/moonraker).
2+
3+
KlipperScreen is a touchscreen GUI that interfaces with [Klipper](https://github.com/kevinOConnor/klipper) via [Moonraker](https://github.com/arksine/moonraker). It can switch between multiple printers to access them from a single location, and it doesn't even need to run on the same host, you can install it on another device and configure the IP address to access the printer.
4+
5+
### Documentation [![Documentation Status](https://readthedocs.org/projects/klipperscreen/badge/?version=latest)](https://klipperscreen.readthedocs.io/en/latest/?badge=latest)
6+
7+
[Click here to access the documentation.](https://klipperscreen.readthedocs.io/en/latest/)
8+
9+
### Inspiration
10+
KlipperScreen was inspired by [OctoScreen](https://github.com/Z-Bolt/OctoScreen/) and the need for a touchscreen GUI that
11+
will natively work with [Klipper](https://github.com/kevinOConnor/klipper) and [Moonraker](https://github.com/arksine/moonraker).
12+
13+
[![Main Menu](docs/img/panels/main_panel.png)](https://klipperscreen.readthedocs.io/en/latest/Panels/)
14+
15+
[More Screenshots](https://klipperscreen.readthedocs.io/en/latest/Panels/)

docs/Changelog.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Changelog
2+
3+
Breaking changes will be listed here.
4+
5+
#### [2022 03 21](https://github.com/jordanruthe/KlipperScreen/commit/bc34b3c8d6761c27a0b0c62fc4dfa11442b417f6)
6+
* Default configuration is now merged again.
7+
Fixing [2021 05 20](https://github.com/jordanruthe/KlipperScreen/commit/eb801486928bf02709033dcbc5f0a45ca43b23c1)
8+
9+
#### [2022 03 10](https://github.com/jordanruthe/KlipperScreen/commit/490dc929bd11e3c4200b999ce7204d84fa0bc184)
10+
* The "Power On Printer" button now requires power_devices under the printer section in KlipperScreen.conf
11+
the power_devices allowed are those defined in the config of moonraker of the printer
12+
The "Power" panel will be in the Menu if there are power devices found
13+
14+
#### [2022 03 01](https://github.com/jordanruthe/KlipperScreen/commit/49ab84e8d51535d3469d97fdee53099cca6abc39)
15+
* The "Power On Printer" button now requires that the printer name in KlipperScreen.conf
16+
and the power device in moonraker.conf to have the same name.
17+
The "Power" panel will be in the Menu if there are power devices found
18+
19+
#### [2022 01 11](https://github.com/jordanruthe/KlipperScreen/commit/8a8c6c064cc6d097b1b34a5c42b4001367e545a6)
20+
* The Preheat panel has been deprecated in favor of an all in one Temperature panel
21+
22+
Remove preheat panel from your Klipperscreen.conf or replace the occurrences of preheat with temperature
23+
24+
#### [2021 05 20](https://github.com/jordanruthe/KlipperScreen/commit/eb801486928bf02709033dcbc5f0a45ca43b23c1)
25+
* Default configuration is not merged if a user configuration is set for a specific option
26+
27+
For instance, if `menu __main` is user defined, the main menu will not have any defaults.

docs/Configuration.md

Lines changed: 96 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,30 @@
11
# Configuration
22

3-
The configuration options are outlined below:
3+
Usually you don't need to create a configuration file, but if you need to change something that is not changeable in the UI
4+
create a blank file in `~/klipper_config/KlipperScreen.conf`, if the file already exist then just edit it.
45

5-
KlipperScreen will search for a configuration file in the following order:
6-
7-
1. _~/KlipperScreen.conf_
8-
2. _${KlipperScreen_Directory}/KlipperScreen.conf_
9-
3. _~/klipper_config/KlipperScreen.conf_
10-
11-
If one of those files are found, it will be used over the default configuration. The default configuration will be
12-
merged with the custom configuration, so if you do not define any menus the default menus will be used.
13-
14-
The default config is included here: (do not edit use as reference)
15-
_${KlipperScreen_Directory}/ks_includes/default.conf_
16-
17-
If no config file is found then a new configuration file will be created in:
18-
_~/klipper_config/KlipperScreen.conf_ Or _~/KlipperScreen.conf_
6+
Write in the file only the options that need to be changed, and restart KlipperScreen.
197

208
## Include files
21-
```
9+
```py
2210
[include conf.d/*.conf]
2311
# Include another configuration file. Wildcards (*) will expand to match anything.
2412
```
2513

2614

2715
## Main Options
28-
```
16+
```py
2917
[main]
3018
# Invert axis in move panel. Default is False. Change to true to invert
3119
invert_x: False
3220
invert_y: False
3321
invert_z: False
3422

35-
# Time (seconds) before the Job Status page reverts to main menu after a successful job
36-
job_complete_timeout: 30
23+
# Time in seconds before the Job Status page closes itself after a successful job/print
24+
# 0 means disabled
25+
job_complete_timeout: 0
3726

38-
# Time (seconds) before the Job Status page reverts to main menu after a successful job.
39-
# If this option is 0, the user must click on a button to go back to the main menu.
27+
# Time in seconds before the Job Status closes itself if an error is encountered
4028
job_error_timeout: 0
4129

4230
# Specify the language
@@ -45,11 +33,22 @@ language: en
4533

4634
# Allows the cursor to be displayed on the screen
4735
show_cursor: False
36+
37+
# Allows to define custom systemctl command for restart like xrdp
38+
service: KlipperScreen
39+
40+
# If multiple printers are defined, this can be set the name of the one to show at startup.
41+
default_printer: Ender 3 Pro
42+
43+
# To define a full set of custom menues (instead of merging user entries with default entries)
44+
# set this to False. See Menu section below.
45+
use_default_menu: True
46+
4847
```
4948

5049
## Printer Options
5150
Multiple printers can be defined
52-
```
51+
```py
5352
# Define printer and name. Name is anything after the first printer word
5453
[printer Ender 3 Pro]
5554
# Define the moonraker host/port if different from 127.0.0.1 and 7125
@@ -60,30 +59,77 @@ moonraker_api_key: False
6059

6160
# Define the z_babystep intervals in a CSV list. Currently only 2 are supported
6261
z_babystep_values: 0.01, 0.05
63-
```
6462

63+
# Override the movement speed and set a specific for this printer.
64+
# These setting overrides the settings configured in the UI. If specified,
65+
# the values configured in the UI will not be used.
66+
move_speed_xy: 500
67+
move_speed_z: 300
68+
69+
# Define one or more moonraker power devices that turn on this printer (CSV list)
70+
# Default is the printer name
71+
power_devices: example1, example2
72+
73+
# Define what items should be shown in titlebar besides the extruder and bed
74+
# the name must be the same as defined in the klipper config
75+
# valid options are temperature_sensors or temperature_fans, or heater_generic
76+
titlebar_items: chamber, MCU, Pi
77+
78+
# The style of the user defined items in the titlebar
79+
# Can be 'full' indicating that the full name is shown, 'short' for the first letter, or None (default) for no name
80+
titlebar_name_type: None
81+
82+
# Z probe calibrate position
83+
# By default is the middle of the bed
84+
calibrate_x_position: 100
85+
calibrate_y_position: 100
86+
87+
# Screen DPMS
88+
# By default DPMS is used to turn off the screen, this should prevent burn-in and save power.
89+
# However if you find that your screen doesn't turn off because it doesn't support it
90+
# Setting this to false will just turn the screen black.
91+
use_dpms: True
92+
```
6593

6694
## Preheat Options
67-
```
95+
```py
6896
[preheat my_temp_setting]
6997
# Temperature for the heated bed
7098
bed: 40
7199
# Temperature for the tools
72100
extruder: 195
73101
# Temperature for generic heaters
74102
heater_generic: 40
103+
# Temperature controlled fans (temperature_fan in klipper config)
104+
temperature_fan: 40
75105
# optional GCode to run when the option is selected
76106
gcode: MY_HEATSOAK_MACRO
77107
```
78108

109+
There is a special preheat setting named cooldown to do additional things when the _cooldown_ button is pressed
110+
for example:
111+
112+
```py
113+
[preheat cooldown]
114+
gcode: M107
115+
```
116+
117+
## Bed Screws
118+
```py
119+
[bed_screws]
120+
# Rotation is useful if the screen is not directly in front of the machine.
121+
# Valid values are 0 90 180 270
122+
rotation: 0
123+
```
124+
79125
## Menu
80126
This allows a custom configuration for the menu displayed while the printer is idle. You can use sub-menus to group
81127
different items and there are several panel options available. It is possible to have a gcode script run on a menu
82128
button press. There are two menus available in KlipperScreen, __main and __print. The __main menu is displayed while the
83129
printer is idle. The __print menu is accessible from the printing status page.
84130

85131
A menu item is configured as follows:
86-
```
132+
```py
87133
[menu __main my_menu_item]
88134
# To build a sub-menu of this menu item, you would next use [menu __main my_menu_item sub_menu_item]
89135
name: Item Name
@@ -99,10 +145,10 @@ params: {"script":"G28 X"}
99145
# Available variables are listed below.
100146
enable: {{ printer.power_devices.count > 0 }}
101147
```
102-
Available panels are listed here: [docs/panels.md](panels.md)
148+
Available panels are listed here: [docs/panels.md](Panels.md)
103149

104150
Certain variables are available for conditional testing of the enable statement:
105-
```
151+
```py
106152
printer.bltouch # Available if bltouch section defined in config
107153
printer.gcode_macros.count # Number of gcode macros
108154
printer.idle_timeout # Idle timeout section
@@ -113,7 +159,7 @@ printer.power_devices.count # Number of power devices configured in Moonraker
113159

114160

115161
A sample configuration of a main menu would be as follows:
116-
```
162+
```py
117163
[menu __main homing]
118164
name: Homing
119165
icon: home
@@ -134,3 +180,25 @@ icon: home
134180
method: printer.gcode.script
135181
params: {"script":"G28"}
136182
```
183+
184+
## KlipperScreen behaviour towards configuration
185+
186+
KlipperScreen will search for a configuration file in the following order:
187+
188+
1. _~/KlipperScreen.conf_
189+
2. _${KlipperScreen_Directory}/KlipperScreen.conf_
190+
3. _~/klipper_config/KlipperScreen.conf_
191+
192+
If you need a custom location for the configuration file, you can add -c or --configfile to the systemd file and specify
193+
the location of your configuration file.
194+
195+
If one of those files are found, it will be merged with the default configuration.
196+
Default Preheat options will be discarded if a custom preheat is found.
197+
If include files are defined then, they will be merged first.
198+
199+
The default config is included here: (do not edit use as reference)
200+
_${KlipperScreen_Directory}/ks_includes/default.conf_
201+
202+
Preferably *do not* copy the entire default.conf file, just configure the settings needed.
203+
204+
If no config file is found, then when a setting is changed in the settings panel, a new configuration file will be created automatically.

docs/Contact.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ You may submit a GitHub issue request for any problems you are having.
88

99
## Klipper Community Discord
1010

11-
The invite link: https://discord.klipper3d.org/
12-
13-
Look for the channel `#klipper-screen`
11+
[Look for the channel `#klipper-screen`](https://discord.klipper3d.org/)

docs/Hardware.md

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Hardware
22

3-
There are no recommended screens, but here are some guidelines:
4-
5-
* There is no support for vertical/portrait mode, only widescreen
6-
* Minimum resolution of 480x320
3+
There are no recommended screens, but the minimum supported resolution is 480x320
74

85
#### Hardware known to work
96

@@ -14,68 +11,64 @@ There are no recommended screens, but here are some guidelines:
1411
* [3.5" RPi Display](http://www.lcdwiki.com/3.5inch_RPi_Display)
1512
* [5" HDMI Display-B](http://lcdwiki.com/5inch_HDMI_Display-B)
1613
* [VoCore](https://klipper.discourse.group/t/hardware-known-to-work-with-klipperscreen/35/7)
17-
* [Android Phone](https://klipper.discourse.group/t/hardware-known-to-work-with-klipperscreen/35/8)
14+
* [Android Phone](https://klipper.discourse.group/t/how-to-klipperscreen-on-android-smart-phones/1196)
1815
* [WAVESHARE 4.3 inch DSI LCD](https://www.waveshare.com/4.3inch-dsi-lcd.htm)
1916
* [DFrobot DFR0550](https://wiki.dfrobot.com/5%27%27TFT-Display_with_Touchscreen_V1.0_SKU_DFR0550)
2017

2118
* [More known hardware in the klipper discourse](https://klipper.discourse.group/t/hardware-known-to-work-with-klipperscreen/35)
2219

23-
#### Configuration
20+
### Configuration
2421

2522
Follow the manufacturer instructions on how to install your screen. In general if you see a white screen, then it's not properly installed, ensure that you at least see a console, Then ![install](Installation.md) KlipperScreen, if you are having troubles refer to the ![troubleshooting page](Troubleshooting.md) for further information.
2623

27-
#### Touchscreen Calibration
28-
Most people don't need to calibrate, but if you do need to calibrate your touchscreen, follow the below steps.
2924

30-
Run this command:
31-
```
32-
DISPLAY=:0 xinput_calibrator --list
33-
```
34-
It will output something such as:
35-
```
36-
Device "wch.cn USB2IIC_CTP_CONTROL" id=6
25+
## Touchscreen touch rotation
26+
If your touchscreen isn't registering touches properly after the screen has been rotated, you will need to apply a
27+
transformation matrix.
28+
29+
First you will need your device name, on a terminal run:
30+
31+
```sh
32+
DISPLAY=:0 xinput
3733
```
3834

39-
Find the ID of your display and put it in the following command:
35+
Output:
36+
```sh
37+
⎡ Virtual core pointer id=2 [master pointer (3)]
38+
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
39+
⎜ ↳ ADS7846 Touchscreen id=6 [slave pointer (2)]
40+
⎣ Virtual core keyboard id=3 [master keyboard (2)]
41+
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
4042
```
41-
DISPLAY=:0 xinput_calibrator -v --device <id from last command>
43+
In this case the device is the ADS7846 Touchscreen, yours may be different
44+
45+
You can test a change by running:
46+
47+
```sh
48+
DISPLAY=:0 xinput set-prop "<device name>" 'Coordinate Transformation Matrix' <matrix>
4249
```
4350

44-
#### Touchscreen touch rotation
45-
If your touchscreen isn't registering touches properly after the screen has been rotated, you will need to apply a
46-
transformation matrix. You can have the matrix be one of the following:
51+
Where the matrix can be one of the following options:
4752

4853
* 0°: `1 0 0 0 1 0 0 0 1`
4954
* 90° Clockwise: `0 -1 1 1 0 0 0 0 1`
5055
* 90° Counter-Clockwise: `0 1 0 -1 0 1 0 0 1`
51-
* 180°: `-1 0 1 0 -1 1 0 0 1`
56+
* 180° (Inverts X and Y): `-1 0 1 0 -1 1 0 0 1`
57+
* invert Y: `-1 0 1 1 1 0 0 0 1`
58+
* invert X: `-1 0 1 0 1 0 0 0 1`
5259

53-
To check the current matrix, you will need your `<screen name>`
54-
(which can be found via the last section, ex: "wch.cn USB2IIC_CTP_CONTROL").
55-
Run the following command: `xinput list-props "wch.cn USB2IIC_CTP_CONTROL"`
60+
For example:
5661

57-
It will output something such as:
62+
```sh
63+
DISPLAY=:0 xinput set-prop "ADS7846 Touchscreen" 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
5864
```
59-
Device '<screen name>':
60-
Device Enabled (115): 1
61-
Coordinate Transformation Matrix (116): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
62-
libinput Calibration Matrix (247): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000
63-
libinput Calibration Matrix Default (248): -1.000000, 0.000000, 1.000000, 0.000000, -1.000000, 1.000000, 0.000000, 0.000000, 1.000000
64-
libinput Send Events Modes Available (249): 1, 0
65-
libinput Send Events Mode Enabled (250): 0, 0
66-
libinput Send Events Mode Enabled Default (251): 0, 0
67-
Device Node (252): "/dev/input/event0"
68-
Device Product ID (253): 6790, 58083
69-
```
70-
71-
You can verify by checking that the 'Coordinate Transformation Matrix' or 'libinput Calibration Matrix'.
72-
73-
You can test a change by running: `xinput set-prop "<screen name>" 'Coordinate Transformation Matrix' <matrix>`
74-
75-
Replace matrix with one of the options above, such as: `1 0 0 0 1 0 0 0 1`
7665

7766
To make this permanent, modify the file `/etc/udev/rules.d/51-touchscreen.rules` and add following line:
7867

68+
```sh
69+
ACTION=="add", ATTRS{name}=="<device name>", ENV{LIBINPUT_CALIBRATION_MATRIX}="<matrix>"
7970
```
80-
ACTION=="add", ATTRS{name}=="<screen name>", ENV{LIBINPUT_CALIBRATION_MATRIX}="<matrix>"
81-
```
71+
More info about input transformation can be found in:
72+
73+
* [Ubuntu wiki InputCoordinateTransformation](https://wiki.ubuntu.com/X/InputCoordinateTransformation)
74+
* [Libinput docs](https://wayland.freedesktop.org/libinput/doc/1.9.0/absolute_axes.html)

0 commit comments

Comments
 (0)