Skip to content

Commit a6f9c7f

Browse files
committed
Rename C_USB to TUR_USB for config.yaml, add other sizes (5.2", 8.0")
1 parent f7d8cd1 commit a6f9c7f

4 files changed

Lines changed: 75 additions & 39 deletions

File tree

config.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1+
---
12
config:
23
# Configuration values to set up basic communication
34
# Set your COM port e.g. COM3 for Windows, /dev/ttyACM0 for Linux...
4-
# Use AUTO for COM port auto-discovery (may not work on every setup)
5+
# Use AUTO for COM port auto-discovery (may not work on every setup) or if device is not detected as a COM port
56
# COM_PORT: "/dev/ttyACM0"
67
# COM_PORT: "COM3"
7-
COM_PORT: AUTO
8+
COM_PORT: "AUTO"
89

910
# Theme to use (located in res/themes)
1011
# Use the name of the folder as value
1112
# Choose a theme made for your screen size (see DISPLAY_SIZE inside theme.yaml)
12-
THEME: Gradient
13+
THEME: 3.5inchTheme2
1314

1415
# Hardware sensors reading
1516
# Choose the appropriate method for reading your hardware sensors:
1617
# - PYTHON use Python libraries (psutils, GPUtil...) to read hardware sensors (supports all OS but not all HW)
1718
# - LHM use LibreHardwareMonitor library to read hardware sensors (Windows only - NEEDS ADMIN RIGHTS)
1819
# - STUB / STATIC use random/static data instead of real hardware sensors
1920
# - AUTO use the best method based on your OS: Windows OS will use LHM, other OS will use Python libraries
20-
HW_SENSORS: PYTHON
21+
HW_SENSORS: AUTO
2122

2223
# Network interfaces
2324
# Linux/MacOS interfaces are named "eth0", "wlan0", "wlp1s0", "enp2s0"...
2425
# For Windows use the interfaces pretty name: "Ethernet 2", "Wi-Fi", ...
2526
# Leave the fields empty if the card does not exist on your setup
26-
ETH: Ethernet # Ethernet Card
27-
WLO: '' # Wi-Fi Card
27+
ETH: "" # Ethernet Card
28+
WLO: "" # Wi-Fi Card
2829

2930
# CPU fan
3031
# For Linux/MacOS platforms, the CPU fan is amongst all fan sensors gathered from the motherboard chipset
@@ -40,26 +41,27 @@ config:
4041

4142
# OpenWeatherMap API KEY. Can be obtained by creating a free account on https://home.openweathermap.org/users/sign_up.
4243
# You need to subscribe to the 3.0 OneCallAPI that has 1000 free daily calls
43-
WEATHER_API_KEY: ''
44+
WEATHER_API_KEY: ""
4445
# Location from which to display the weather. Use for example https://www.latlong.net/ to get latitude/longitude
45-
WEATHER_LATITUDE: '45.75'
46-
WEATHER_LONGITUDE: '4.85'
46+
WEATHER_LATITUDE: 45.75
47+
WEATHER_LONGITUDE: 4.85
4748
# Units used to display temperatures (metric - °C, imperial - °F, standard - °K)
4849
WEATHER_UNITS: metric
4950
# Language is used by the API. Find more here https://openweathermap.org/api/one-call-3#multi
50-
WEATHER_LANGUAGE: de
51+
WEATHER_LANGUAGE: en
5152

5253
display:
5354
# Display revision:
5455
# - A for Turing 3.5" and UsbPCMonitor 3.5"/5"
5556
# - B for Xuanfang 3.5" (inc. flagship)
5657
# - C for Turing 2.1"/2.8"/5"/8.8"
5758
# - D for Kipye Qiye Smart Display 3.5"
59+
# - TUR_USB for Turing HW revisions 1.x: 4.6"/5.2"/8.0"/8.8"/9.2"
5860
# - WEACT_A for WeAct Studio Display FS V1 3.5"
5961
# - WEACT_B for WeAct Studio Display FS V1 0.96"
6062
# - SIMU for simulated display (image written in screencap.png). Width & height will be detected from the theme
6163
# To identify your smart screen: https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions
62-
REVISION: C_USB
64+
REVISION: A
6365

6466
# Display Brightness
6567
# Set this as the desired %, 0 being completely dark and 100 being max brightness

configure.py

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,57 +63,88 @@
6363
WEACT_MODEL = "WeAct Studio Display FS V1"
6464
SIMULATED_MODEL = "Simulated screen"
6565

66+
SIZE_0_96_INCH = "0.96\""
67+
SIZE_2_1_INCH = "2.1\"" # Only for retro compatibility
68+
SIZE_2_x_INCH = "2.1\" / 2.8\""
6669
SIZE_3_5_INCH = "3.5\""
6770
SIZE_4_6_INCH = "4.6\""
68-
SIZE_4_6_INCH_USB = "4.6\""
6971
SIZE_5_INCH = "5\""
72+
SIZE_5_2_INCH = "5.2\""
73+
SIZE_8_0_INCH = "8.0\""
7074
SIZE_8_8_INCH = "8.8\""
71-
SIZE_8_8_INCH_USB = "8.8\" (V1.1) or 9.2\""
72-
SIZE_2_1_INCH = "2.1\"" # Only for retro compatibility
73-
SIZE_2_x_INCH = "2.1\" / 2.8\""
74-
SIZE_0_96_INCH = "0.96\""
75-
76-
size_list = (SIZE_0_96_INCH, SIZE_2_x_INCH, SIZE_3_5_INCH, SIZE_4_6_INCH_USB, SIZE_5_INCH, SIZE_8_8_INCH, SIZE_8_8_INCH_USB)
75+
SIZE_8_8_INCH_NEWREV = "8.8\" (V1.X new HW rev.)"
76+
SIZE_9_2_INCH = "9.2\""
77+
78+
# List of sizes that can be selected
79+
size_list = (
80+
SIZE_0_96_INCH,
81+
SIZE_2_x_INCH,
82+
SIZE_3_5_INCH,
83+
SIZE_4_6_INCH,
84+
SIZE_5_INCH,
85+
# SIZE_5_2_INCH, Not implemented yet
86+
# SIZE_8_0_INCH, Not implemented yet
87+
SIZE_8_8_INCH,
88+
SIZE_8_8_INCH_NEWREV,
89+
# SIZE_9_2_INCH, Not implemented yet
90+
)
7791

7892
# Maps between config.yaml values and GUI description
93+
# This map is used to select the correct smart screen model based on config.yaml "REVISION" and selected "THEME" size
7994
revision_and_size_to_model_map = {
8095
('A', SIZE_3_5_INCH): TURING_MODEL, # Can also be UsbPCMonitor 3.5, does not matter since protocol is the same
8196
('A', SIZE_5_INCH): USBPCMONITOR_MODEL,
8297
('B', SIZE_3_5_INCH): XUANFANG_MODEL,
8398
('C', SIZE_2_x_INCH): TURING_MODEL,
8499
('C', SIZE_5_INCH): TURING_MODEL,
85100
('C', SIZE_8_8_INCH): TURING_MODEL,
86-
('C_USB', SIZE_4_6_INCH_USB): TURING_MODEL,
87-
('C_USB', SIZE_8_8_INCH_USB): TURING_MODEL,
88101
('D', SIZE_3_5_INCH): KIPYE_MODEL,
102+
('TUR_USB', SIZE_4_6_INCH): TURING_MODEL,
103+
('TUR_USB', SIZE_5_2_INCH): TURING_MODEL,
104+
('TUR_USB', SIZE_8_0_INCH): TURING_MODEL,
105+
('TUR_USB', SIZE_8_8_INCH): TURING_MODEL,
106+
('TUR_USB', SIZE_8_8_INCH_NEWREV): TURING_MODEL,
107+
('TUR_USB', SIZE_9_2_INCH): TURING_MODEL,
89108
('WEACT_A', SIZE_3_5_INCH): WEACT_MODEL,
90109
('WEACT_B', SIZE_0_96_INCH): WEACT_MODEL,
110+
91111
('SIMU', SIZE_0_96_INCH): SIMULATED_MODEL,
92112
('SIMU', SIZE_2_x_INCH): SIMULATED_MODEL,
93113
('SIMU', SIZE_3_5_INCH): SIMULATED_MODEL,
94114
('SIMU', SIZE_4_6_INCH): SIMULATED_MODEL,
95115
('SIMU', SIZE_5_INCH): SIMULATED_MODEL,
116+
('SIMU', SIZE_5_2_INCH): SIMULATED_MODEL,
117+
('SIMU', SIZE_8_0_INCH): SIMULATED_MODEL,
96118
('SIMU', SIZE_8_8_INCH): SIMULATED_MODEL,
119+
('SIMU', SIZE_9_2_INCH): SIMULATED_MODEL,
97120
}
121+
# This map is used to write the correct config.yaml "REVISION" from selected smart screen model and size
98122
model_and_size_to_revision_map = {
99-
(TURING_MODEL, SIZE_3_5_INCH): 'A',
100-
(USBPCMONITOR_MODEL, SIZE_3_5_INCH): 'A',
101-
(USBPCMONITOR_MODEL, SIZE_5_INCH): 'A',
102-
(XUANFANG_MODEL, SIZE_3_5_INCH): 'B',
123+
(KIPYE_MODEL, SIZE_3_5_INCH): 'D',
103124
(TURING_MODEL, SIZE_2_x_INCH): 'C',
125+
(TURING_MODEL, SIZE_3_5_INCH): 'A',
126+
(TURING_MODEL, SIZE_4_6_INCH): 'TUR_USB',
127+
(TURING_MODEL, SIZE_5_2_INCH): 'TUR_USB',
104128
(TURING_MODEL, SIZE_5_INCH): 'C',
129+
(TURING_MODEL, SIZE_8_0_INCH): 'TUR_USB',
105130
(TURING_MODEL, SIZE_8_8_INCH): 'C',
106-
(TURING_MODEL, SIZE_4_6_INCH_USB): 'C_USB',
107-
(TURING_MODEL, SIZE_8_8_INCH_USB): 'C_USB',
108-
(KIPYE_MODEL, SIZE_3_5_INCH): 'D',
109-
(WEACT_MODEL, SIZE_3_5_INCH): 'WEACT_A',
131+
(TURING_MODEL, SIZE_8_8_INCH_NEWREV): 'TUR_USB',
132+
(TURING_MODEL, SIZE_9_2_INCH): 'TUR_USB',
133+
(USBPCMONITOR_MODEL, SIZE_3_5_INCH): 'A',
134+
(USBPCMONITOR_MODEL, SIZE_5_INCH): 'A',
110135
(WEACT_MODEL, SIZE_0_96_INCH): 'WEACT_B',
136+
(WEACT_MODEL, SIZE_3_5_INCH): 'WEACT_A',
137+
(XUANFANG_MODEL, SIZE_3_5_INCH): 'B',
138+
111139
(SIMULATED_MODEL, SIZE_0_96_INCH): 'SIMU',
112140
(SIMULATED_MODEL, SIZE_2_x_INCH): 'SIMU',
113141
(SIMULATED_MODEL, SIZE_3_5_INCH): 'SIMU',
114142
(SIMULATED_MODEL, SIZE_4_6_INCH): 'SIMU',
115143
(SIMULATED_MODEL, SIZE_5_INCH): 'SIMU',
144+
(SIMULATED_MODEL, SIZE_5_2_INCH): 'SIMU',
145+
(SIMULATED_MODEL, SIZE_8_0_INCH): 'SIMU',
116146
(SIMULATED_MODEL, SIZE_8_8_INCH): 'SIMU',
147+
(SIMULATED_MODEL, SIZE_9_2_INCH): 'SIMU',
117148
}
118149
hw_lib_map = {"AUTO": "Automatic", "LHM": "LibreHardwareMonitor (admin.)", "PYTHON": "Python libraries",
119150
"STUB": "Fake random data", "STATIC": "Fake static data"}
@@ -318,13 +349,10 @@ def run(self):
318349
def load_theme_preview(self):
319350
theme_data = get_theme_data(self.theme_cb.get())
320351

321-
if theme_data and theme_data['display'].get("DISPLAY_SIZE", '3.5"') == SIZE_2_1_INCH:
322-
theme_preview.paste(circular_mask, mask=circular_mask)
323-
324352
try:
325353
theme_preview = Image.open(MAIN_DIRECTORY / "res" / "themes" / self.theme_cb.get() / "preview.png")
326354

327-
if theme_data['display'].get("DISPLAY_SIZE", '3.5"') == SIZE_2_1_INCH:
355+
if theme_data and theme_data['display'].get("DISPLAY_SIZE", '3.5"') == SIZE_2_1_INCH:
328356
# This is a circular screen: apply a circle mask over the preview
329357
theme_preview.paste(circular_mask, mask=circular_mask)
330358
except:
@@ -394,8 +422,8 @@ def load_config_values(self):
394422
size = get_theme_size(self.config['config']['THEME'])
395423
size = size.replace(SIZE_2_1_INCH, SIZE_2_x_INCH) # If a theme is for 2.1" then it also is for 2.8"
396424
try:
397-
if size == SIZE_8_8_INCH and self.config['display']['REVISION'] == 'C_USB':
398-
size = SIZE_8_8_INCH_USB
425+
if size == SIZE_8_8_INCH and self.config['display']['REVISION'] == 'TUR_USB':
426+
size = SIZE_8_8_INCH_NEWREV
399427
self.size_cb.set(size)
400428
except:
401429
self.size_cb.current(0)
@@ -540,7 +568,7 @@ def on_model_change(self, e=None):
540568
def on_size_change(self, e=None):
541569
size = self.size_cb.get()
542570
size = size.replace(SIZE_2_x_INCH, SIZE_2_1_INCH) # For '2.1" / 2.8"' size, keep '2.1"' as size to get themes for
543-
size = size.replace(SIZE_8_8_INCH_USB, SIZE_8_8_INCH)
571+
size = size.replace(SIZE_8_8_INCH_NEWREV, SIZE_8_8_INCH)
544572
themes = get_themes(size)
545573
self.theme_cb.config(values=themes)
546574

library/display.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ def __init__(self):
8888
# Because of issue with Turing rev. C size auto-detection, manually configure screen width/height from theme
8989
self.lcd = LcdCommRevC(com_port=config.CONFIG_DATA['config']['COM_PORT'],
9090
update_queue=config.update_queue, display_width=width, display_height=height)
91-
elif config.CONFIG_DATA["display"]["REVISION"] == "C_USB":
92-
# On all USB models, manually configure screen width/height from theme
93-
self.lcd = LcdCommTuringUSB(display_width=width, display_height=height)
9491
elif config.CONFIG_DATA["display"]["REVISION"] == "D":
9592
self.lcd = LcdCommRevD(com_port=config.CONFIG_DATA['config']['COM_PORT'],
9693
update_queue=config.update_queue)
94+
elif config.CONFIG_DATA["display"]["REVISION"] == "TUR_USB":
95+
# On all USB models, manually configure screen width/height from theme
96+
self.lcd = LcdCommTuringUSB(display_width=width, display_height=height)
9797
elif config.CONFIG_DATA["display"]["REVISION"] == "WEACT_A":
9898
self.lcd = LcdCommWeActA(com_port=config.CONFIG_DATA['config']['COM_PORT'],
9999
update_queue=config.update_queue)

library/lcd/lcd_comm_turing_usb.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939
from library.lcd.lcd_comm import Orientation, LcdComm
4040

4141
VENDOR_ID = 0x1cbe
42-
PRODUCT_ID = [0x0046, 0x0088, 0x0092] # 4.6", 8.8", 9.2"
42+
PRODUCT_ID = [
43+
0x0046, # Turing 4.6", 960x320
44+
0x0052, # Turing 5.2", 1280x720
45+
0x0080, # Turing 8.0", 1280x800
46+
0x0088, # Turing 8.8", 1920x480
47+
0x0092, # Turing 9.2", 1920x462
48+
]
4349

4450

4551
MAX_CHUNK_BYTES = 1024*1024 # Data sent to screen cannot exceed 1024MB or there will be a timeout

0 commit comments

Comments
 (0)