Skip to content

Commit f7d8cd1

Browse files
authored
Merge pull request #979 from smandon/detection-correction
2 parents cb8f133 + a1d710d commit f7d8cd1

File tree

6 files changed

+97
-3
lines changed

6 files changed

+97
-3
lines changed

configure.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@
6464
SIMULATED_MODEL = "Simulated screen"
6565

6666
SIZE_3_5_INCH = "3.5\""
67+
SIZE_4_6_INCH = "4.6\""
68+
SIZE_4_6_INCH_USB = "4.6\""
6769
SIZE_5_INCH = "5\""
6870
SIZE_8_8_INCH = "8.8\""
6971
SIZE_8_8_INCH_USB = "8.8\" (V1.1) or 9.2\""
7072
SIZE_2_1_INCH = "2.1\"" # Only for retro compatibility
7173
SIZE_2_x_INCH = "2.1\" / 2.8\""
7274
SIZE_0_96_INCH = "0.96\""
7375

74-
size_list = (SIZE_0_96_INCH, SIZE_2_x_INCH, SIZE_3_5_INCH, SIZE_5_INCH, SIZE_8_8_INCH, SIZE_8_8_INCH_USB)
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)
7577

7678
# Maps between config.yaml values and GUI description
7779
revision_and_size_to_model_map = {
@@ -81,13 +83,15 @@
8183
('C', SIZE_2_x_INCH): TURING_MODEL,
8284
('C', SIZE_5_INCH): TURING_MODEL,
8385
('C', SIZE_8_8_INCH): TURING_MODEL,
86+
('C_USB', SIZE_4_6_INCH_USB): TURING_MODEL,
8487
('C_USB', SIZE_8_8_INCH_USB): TURING_MODEL,
8588
('D', SIZE_3_5_INCH): KIPYE_MODEL,
8689
('WEACT_A', SIZE_3_5_INCH): WEACT_MODEL,
8790
('WEACT_B', SIZE_0_96_INCH): WEACT_MODEL,
8891
('SIMU', SIZE_0_96_INCH): SIMULATED_MODEL,
8992
('SIMU', SIZE_2_x_INCH): SIMULATED_MODEL,
9093
('SIMU', SIZE_3_5_INCH): SIMULATED_MODEL,
94+
('SIMU', SIZE_4_6_INCH): SIMULATED_MODEL,
9195
('SIMU', SIZE_5_INCH): SIMULATED_MODEL,
9296
('SIMU', SIZE_8_8_INCH): SIMULATED_MODEL,
9397
}
@@ -99,13 +103,15 @@
99103
(TURING_MODEL, SIZE_2_x_INCH): 'C',
100104
(TURING_MODEL, SIZE_5_INCH): 'C',
101105
(TURING_MODEL, SIZE_8_8_INCH): 'C',
106+
(TURING_MODEL, SIZE_4_6_INCH_USB): 'C_USB',
102107
(TURING_MODEL, SIZE_8_8_INCH_USB): 'C_USB',
103108
(KIPYE_MODEL, SIZE_3_5_INCH): 'D',
104109
(WEACT_MODEL, SIZE_3_5_INCH): 'WEACT_A',
105110
(WEACT_MODEL, SIZE_0_96_INCH): 'WEACT_B',
106111
(SIMULATED_MODEL, SIZE_0_96_INCH): 'SIMU',
107112
(SIMULATED_MODEL, SIZE_2_x_INCH): 'SIMU',
108113
(SIMULATED_MODEL, SIZE_3_5_INCH): 'SIMU',
114+
(SIMULATED_MODEL, SIZE_4_6_INCH): 'SIMU',
109115
(SIMULATED_MODEL, SIZE_5_INCH): 'SIMU',
110116
(SIMULATED_MODEL, SIZE_8_8_INCH): 'SIMU',
111117
}

library/display.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def _get_theme_size() -> tuple[int, int]:
6262
return 480, 480
6363
elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '3.5"':
6464
return 320, 480
65+
elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '4.6"':
66+
return 320, 960
6567
elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '5"':
6668
return 480, 800
6769
elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '8.8"':

library/lcd/lcd_comm_turing_usb.py

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

4141
VENDOR_ID = 0x1cbe
42-
PRODUCT_ID = [0x0088, 0x0092] # 8.8", 9.2"
42+
PRODUCT_ID = [0x0046, 0x0088, 0x0092] # 4.6", 8.8", 9.2"
4343

4444

4545
MAX_CHUNK_BYTES = 1024*1024 # Data sent to screen cannot exceed 1024MB or there will be a timeout
@@ -462,8 +462,11 @@ def encrypt_command_packet(data: bytearray) -> bytearray:
462462

463463

464464
def find_usb_device():
465+
dev = None
465466
for pid in PRODUCT_ID:
466467
dev = usb.core.find(idVendor=VENDOR_ID, idProduct=pid)
468+
if dev is not None:
469+
break
467470
if dev is None:
468471
raise ValueError(f'USB device not found')
469472

@@ -936,7 +939,7 @@ def _write_file_command(dev, file_path: str) -> bool:
936939
return False
937940

938941

939-
# This class is for Turing Smart Screen newer models (5.2" / 8" / 8.8" HW rev 1.x / 9.2")
942+
# This class is for Turing Smart Screen newer models (4.6" / 5.2" / 8" / 8.8" HW rev 1.x / 9.2")
940943
# These models are not detected as serial ports but as (Win)USB devices
941944
class LcdCommTuringUSB(LcdComm):
942945
def __init__(self, com_port: str = "AUTO", display_width: int = 480, display_height: int = 1920,
44.9 KB
Loading

res/themes/Gradient46/preview.png

79.7 KB
Loading

res/themes/Gradient46/theme.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
author: "@mathoudebine"
3+
4+
display:
5+
DISPLAY_SIZE: 4.6"
6+
DISPLAY_ORIENTATION: portrait
7+
DISPLAY_RGB_LED: 226, 21, 103
8+
9+
static_images:
10+
BACKGROUND:
11+
PATH: background.png
12+
X: 0
13+
Y: 0
14+
WIDTH: 320
15+
HEIGHT: 960
16+
17+
STATS:
18+
CPU:
19+
PERCENTAGE:
20+
INTERVAL: 1
21+
TEXT:
22+
SHOW: True
23+
SHOW_UNIT: True
24+
X: 40
25+
Y: 160
26+
FONT: roboto-mono/RobotoMono-Regular.ttf
27+
FONT_SIZE: 80
28+
FONT_COLOR: 255, 255, 255
29+
BACKGROUND_IMAGE: background.png
30+
TEMPERATURE:
31+
INTERVAL: 1
32+
TEXT:
33+
SHOW: True
34+
SHOW_UNIT: True
35+
X: 80
36+
Y: 110
37+
FONT: roboto-mono/RobotoMono-Regular.ttf
38+
FONT_SIZE: 40
39+
FONT_COLOR: 255, 255, 255
40+
BACKGROUND_IMAGE: background.png
41+
GPU:
42+
INTERVAL: 1
43+
PERCENTAGE:
44+
TEXT:
45+
SHOW: True
46+
SHOW_UNIT: True
47+
X: 40
48+
Y: 480
49+
FONT: roboto-mono/RobotoMono-Regular.ttf
50+
FONT_SIZE: 80
51+
FONT_COLOR: 255, 255, 255
52+
BACKGROUND_IMAGE: background.png
53+
TEMPERATURE:
54+
TEXT:
55+
SHOW: True
56+
SHOW_UNIT: True
57+
X: 80
58+
Y: 430
59+
FONT: roboto-mono/RobotoMono-Regular.ttf
60+
FONT_SIZE: 40
61+
FONT_COLOR: 255, 255, 255
62+
BACKGROUND_IMAGE: background.png
63+
MEMORY:
64+
INTERVAL: 5
65+
VIRTUAL:
66+
USED:
67+
SHOW: True
68+
SHOW_UNIT: True
69+
X: 80
70+
Y: 740
71+
FONT: roboto-mono/RobotoMono-Regular.ttf
72+
FONT_SIZE: 30
73+
FONT_COLOR: 255, 255, 255
74+
BACKGROUND_IMAGE: background.png
75+
PERCENT_TEXT:
76+
SHOW: True
77+
SHOW_UNIT: True
78+
X: 40
79+
Y: 790
80+
FONT: roboto-mono/RobotoMono-Regular.ttf
81+
FONT_SIZE: 80
82+
FONT_COLOR: 255, 255, 255
83+
BACKGROUND_IMAGE: background.png

0 commit comments

Comments
 (0)