Skip to content

Commit c207609

Browse files
authored
Merge pull request #885 from mathoudebine/dev/863-support-for-weact-display-fs-096-inch-usb-lcd-displays
2 parents 18dfa77 + 499c858 commit c207609

File tree

158 files changed

+1332
-14
lines changed

Some content is hidden

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

158 files changed

+1332
-14
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Supported operating systems : macOS, Windows, Linux (incl. Raspberry Pi), basica
3232
| <img src="res/docs/UsbPCMonitor_5inch.webp" width="60%" height="60%"/> | <img src="res/docs/kipye-qiye-35.webp" width="60%" height="60%"/> |
3333
| Unknown manufacturer, visually similar to Turing 3.5" / 5". Original software is `UsbPCMonitor.exe` | Front panel has an engraved inscription "奇叶智显" Qiye Zhixian (Qiye Smart Display) |
3434

35+
| ✅ WeAct Studio Display FS V1 0.96" | ✅ WeAct Studio Display FS V1 3.5" |
36+
|---------------------------------------------------------------|--------------------------------------------------------------|
37+
| <img src="res/docs/weact_0.96.jpg" width="60%" height="60%"/> | <img src="res/docs/weact_3.5.png" width="60%" height="60%"/> |
38+
3539
<details>
3640

3741
<summary><h3>❌ Not (yet) supported / not tested smart screen models</h3></summary>

config.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ config:
5252

5353
display:
5454
# Display revision:
55-
# - A for Turing 3.5" and UsbPCMonitor 3.5"/5"
56-
# - B for Xuanfang 3.5" (inc. flagship)
57-
# - C for Turing 2.1"/5"/8.8"
58-
# - D for Kipye Qiye Smart Display 3.5"
55+
# - A for Turing 3.5" and UsbPCMonitor 3.5"/5"
56+
# - B for Xuanfang 3.5" (inc. flagship)
57+
# - C for Turing 2.1"/5"/8.8"
58+
# - D for Kipye Qiye Smart Display 3.5"
59+
# - WEACT_A for WeAct Studio Display FS V1 3.5"
60+
# - WEACT_B for WeAct Studio Display FS V1 0.96"
5961
# - SIMU for simulated display (image written in screencap.png). Width & height will be detected from the theme
6062
# To identify your smart screen: https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions
6163
REVISION: A

configure.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,16 @@
6060
USBPCMONITOR_MODEL = "UsbPCMonitor"
6161
XUANFANG_MODEL = "XuanFang rev. B & flagship"
6262
KIPYE_MODEL = "Kipye Qiye Smart Display"
63+
WEACT_MODEL = "WeAct Studio Display FS V1"
6364
SIMULATED_MODEL = "Simulated screen"
6465

6566
SIZE_3_5_INCH = "3.5\""
6667
SIZE_5_INCH = "5\""
6768
SIZE_8_8_INCH = "8.8\""
6869
SIZE_2_1_INCH = "2.1\""
70+
SIZE_0_96_INCH = "0.96\""
6971

70-
size_list = (SIZE_2_1_INCH, SIZE_3_5_INCH, SIZE_5_INCH, SIZE_8_8_INCH)
72+
size_list = (SIZE_0_96_INCH, SIZE_2_1_INCH, SIZE_3_5_INCH, SIZE_5_INCH, SIZE_8_8_INCH)
7173

7274
# Maps between config.yaml values and GUI description
7375
revision_and_size_to_model_map = {
@@ -78,6 +80,9 @@
7880
('C', SIZE_5_INCH): TURING_MODEL,
7981
('C', SIZE_8_8_INCH): TURING_MODEL,
8082
('D', SIZE_3_5_INCH): KIPYE_MODEL,
83+
('WEACT_A', SIZE_3_5_INCH): WEACT_MODEL,
84+
('WEACT_B', SIZE_0_96_INCH): WEACT_MODEL,
85+
('SIMU', SIZE_0_96_INCH): SIMULATED_MODEL,
8186
('SIMU', SIZE_2_1_INCH): SIMULATED_MODEL,
8287
('SIMU', SIZE_3_5_INCH): SIMULATED_MODEL,
8388
('SIMU', SIZE_5_INCH): SIMULATED_MODEL,
@@ -92,6 +97,9 @@
9297
(TURING_MODEL, SIZE_5_INCH): 'C',
9398
(TURING_MODEL, SIZE_8_8_INCH): 'C',
9499
(KIPYE_MODEL, SIZE_3_5_INCH): 'D',
100+
(WEACT_MODEL, SIZE_3_5_INCH): 'WEACT_A',
101+
(WEACT_MODEL, SIZE_0_96_INCH): 'WEACT_B',
102+
(SIMULATED_MODEL, SIZE_0_96_INCH): 'SIMU',
95103
(SIMULATED_MODEL, SIZE_2_1_INCH): 'SIMU',
96104
(SIMULATED_MODEL, SIZE_3_5_INCH): 'SIMU',
97105
(SIMULATED_MODEL, SIZE_5_INCH): 'SIMU',

library/display.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
from library.lcd.lcd_comm_rev_b import LcdCommRevB
2525
from library.lcd.lcd_comm_rev_c import LcdCommRevC
2626
from library.lcd.lcd_comm_rev_d import LcdCommRevD
27+
from library.lcd.lcd_comm_weact_a import LcdCommWeActA
28+
from library.lcd.lcd_comm_weact_b import LcdCommWeActB
2729
from library.lcd.lcd_simulated import LcdSimulated
2830
from library.log import logger
2931

@@ -53,6 +55,8 @@ def _get_theme_orientation() -> Orientation:
5355

5456

5557
def _get_theme_size() -> tuple[int, int]:
58+
if config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '0.96"':
59+
return 80, 160
5660
if config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '2.1"':
5761
return 480, 480
5862
elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '3.5"':
@@ -84,6 +88,12 @@ def __init__(self):
8488
elif config.CONFIG_DATA["display"]["REVISION"] == "D":
8589
self.lcd = LcdCommRevD(com_port=config.CONFIG_DATA['config']['COM_PORT'],
8690
update_queue=config.update_queue)
91+
elif config.CONFIG_DATA["display"]["REVISION"] == "WEACT_A":
92+
self.lcd = LcdCommWeActA(com_port=config.CONFIG_DATA['config']['COM_PORT'],
93+
update_queue=config.update_queue)
94+
elif config.CONFIG_DATA["display"]["REVISION"] == "WEACT_B":
95+
self.lcd = LcdCommWeActB(com_port=config.CONFIG_DATA['config']['COM_PORT'],
96+
update_queue=config.update_queue)
8797
elif config.CONFIG_DATA["display"]["REVISION"] == "SIMU":
8898
# Simulated display: always set width/height from theme
8999
self.lcd = LcdSimulated(display_width=width, display_height=height)

library/lcd/lcd_comm.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ def serial_read(self, size: int) -> bytes:
124124
assert self.lcd_serial is not None
125125
return self.lcd_serial.read(size)
126126

127+
def serial_readall(self) -> bytes:
128+
assert self.lcd_serial is not None
129+
return self.lcd_serial.readall()
130+
127131
def serial_flush_input(self):
128132
if self.lcd_serial is not None:
129133
self.lcd_serial.reset_input_buffer()
@@ -223,6 +227,12 @@ def DisplayPILImage(
223227

224228
def DisplayBitmap(self, bitmap_path: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0):
225229
image = self.open_image(bitmap_path)
230+
231+
# Resize the picture if custom width/height provided
232+
if width != 0 and height != 0:
233+
if width != image.size[0] or height != image.size[1]:
234+
image = image.resize((width, height))
235+
226236
self.DisplayPILImage(image, x, y, width, height)
227237

228238
def DisplayText(

library/lcd/lcd_comm_rev_a.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,6 @@ def DisplayPILImage(
190190
if not image_width:
191191
image_width = image.size[0]
192192

193-
assert x <= width, 'Image X coordinate must be <= display width'
194-
assert y <= height, 'Image Y coordinate must be <= display height'
195-
assert image_height > 0, 'Image height must be > 0'
196-
assert image_width > 0, 'Image width must be > 0'
197-
198193
# If our image size + the (x, y) position offsets are bigger than
199194
# our display, reduce the image size to fit our screen
200195
if x + image_width > width:
@@ -205,6 +200,11 @@ def DisplayPILImage(
205200
if image_width != image.size[0] or image_height != image.size[1]:
206201
image = image.crop((0, 0, image_width, image_height))
207202

203+
assert x <= width, 'Image X coordinate must be <= display width'
204+
assert y <= height, 'Image Y coordinate must be <= display height'
205+
assert image_height > 0, 'Image height must be > 0'
206+
assert image_width > 0, 'Image width must be > 0'
207+
208208
(x0, y0) = (x, y)
209209
(x1, y1) = (x + image_width - 1, y + image_height - 1)
210210

0 commit comments

Comments
 (0)