Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ Supported operating systems : macOS, Windows, Linux (incl. Raspberry Pi), basica
| <img src="res/docs/UsbPCMonitor_5inch.webp" width="60%" height="60%"/> | <img src="res/docs/kipye-qiye-35.webp" width="60%" height="60%"/> |
| 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) |

| ✅ WeAct Studio Display FS V1 0.96" | ✅ WeAct Studio Display FS V1 3.5" |
|---------------------------------------------------------------|--------------------------------------------------------------|
| <img src="res/docs/weact_0.96.jpg" width="60%" height="60%"/> | <img src="res/docs/weact_3.5.png" width="60%" height="60%"/> |

<details>

<summary><h3>❌ Not (yet) supported / not tested smart screen models</h3></summary>
Expand Down
10 changes: 6 additions & 4 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ config:

display:
# Display revision:
# - A for Turing 3.5" and UsbPCMonitor 3.5"/5"
# - B for Xuanfang 3.5" (inc. flagship)
# - C for Turing 2.1"/5"/8.8"
# - D for Kipye Qiye Smart Display 3.5"
# - A for Turing 3.5" and UsbPCMonitor 3.5"/5"
# - B for Xuanfang 3.5" (inc. flagship)
# - C for Turing 2.1"/5"/8.8"
# - D for Kipye Qiye Smart Display 3.5"
# - WEACT_A for WeAct Studio Display FS V1 3.5"
# - WEACT_B for WeAct Studio Display FS V1 0.96"
# - SIMU for simulated display (image written in screencap.png). Width & height will be detected from the theme
# To identify your smart screen: https://github.com/mathoudebine/turing-smart-screen-python/wiki/Hardware-revisions
REVISION: A
Expand Down
10 changes: 9 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@
USBPCMONITOR_MODEL = "UsbPCMonitor"
XUANFANG_MODEL = "XuanFang rev. B & flagship"
KIPYE_MODEL = "Kipye Qiye Smart Display"
WEACT_MODEL = "WeAct Studio Display FS V1"
SIMULATED_MODEL = "Simulated screen"

SIZE_3_5_INCH = "3.5\""
SIZE_5_INCH = "5\""
SIZE_8_8_INCH = "8.8\""
SIZE_2_1_INCH = "2.1\""
SIZE_0_96_INCH = "0.96\""

size_list = (SIZE_2_1_INCH, SIZE_3_5_INCH, SIZE_5_INCH, SIZE_8_8_INCH)
size_list = (SIZE_0_96_INCH, SIZE_2_1_INCH, SIZE_3_5_INCH, SIZE_5_INCH, SIZE_8_8_INCH)

# Maps between config.yaml values and GUI description
revision_and_size_to_model_map = {
Expand All @@ -78,6 +80,9 @@
('C', SIZE_5_INCH): TURING_MODEL,
('C', SIZE_8_8_INCH): TURING_MODEL,
('D', SIZE_3_5_INCH): KIPYE_MODEL,
('WEACT_A', SIZE_3_5_INCH): WEACT_MODEL,
('WEACT_B', SIZE_0_96_INCH): WEACT_MODEL,
('SIMU', SIZE_0_96_INCH): SIMULATED_MODEL,
('SIMU', SIZE_2_1_INCH): SIMULATED_MODEL,
('SIMU', SIZE_3_5_INCH): SIMULATED_MODEL,
('SIMU', SIZE_5_INCH): SIMULATED_MODEL,
Expand All @@ -92,6 +97,9 @@
(TURING_MODEL, SIZE_5_INCH): 'C',
(TURING_MODEL, SIZE_8_8_INCH): 'C',
(KIPYE_MODEL, SIZE_3_5_INCH): 'D',
(WEACT_MODEL, SIZE_3_5_INCH): 'WEACT_A',
(WEACT_MODEL, SIZE_0_96_INCH): 'WEACT_B',
(SIMULATED_MODEL, SIZE_0_96_INCH): 'SIMU',
(SIMULATED_MODEL, SIZE_2_1_INCH): 'SIMU',
(SIMULATED_MODEL, SIZE_3_5_INCH): 'SIMU',
(SIMULATED_MODEL, SIZE_5_INCH): 'SIMU',
Expand Down
10 changes: 10 additions & 0 deletions library/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from library.lcd.lcd_comm_rev_b import LcdCommRevB
from library.lcd.lcd_comm_rev_c import LcdCommRevC
from library.lcd.lcd_comm_rev_d import LcdCommRevD
from library.lcd.lcd_comm_weact_a import LcdCommWeActA
from library.lcd.lcd_comm_weact_b import LcdCommWeActB
from library.lcd.lcd_simulated import LcdSimulated
from library.log import logger

Expand Down Expand Up @@ -53,6 +55,8 @@ def _get_theme_orientation() -> Orientation:


def _get_theme_size() -> tuple[int, int]:
if config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '0.96"':
return 80, 160
if config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '2.1"':
return 480, 480
elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '3.5"':
Expand Down Expand Up @@ -84,6 +88,12 @@ def __init__(self):
elif config.CONFIG_DATA["display"]["REVISION"] == "D":
self.lcd = LcdCommRevD(com_port=config.CONFIG_DATA['config']['COM_PORT'],
update_queue=config.update_queue)
elif config.CONFIG_DATA["display"]["REVISION"] == "WEACT_A":
self.lcd = LcdCommWeActA(com_port=config.CONFIG_DATA['config']['COM_PORT'],
update_queue=config.update_queue)
elif config.CONFIG_DATA["display"]["REVISION"] == "WEACT_B":
self.lcd = LcdCommWeActB(com_port=config.CONFIG_DATA['config']['COM_PORT'],
update_queue=config.update_queue)
elif config.CONFIG_DATA["display"]["REVISION"] == "SIMU":
# Simulated display: always set width/height from theme
self.lcd = LcdSimulated(display_width=width, display_height=height)
Expand Down
10 changes: 10 additions & 0 deletions library/lcd/lcd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def serial_read(self, size: int) -> bytes:
assert self.lcd_serial is not None
return self.lcd_serial.read(size)

def serial_readall(self) -> bytes:
assert self.lcd_serial is not None
return self.lcd_serial.readall()

def serial_flush_input(self):
if self.lcd_serial is not None:
self.lcd_serial.reset_input_buffer()
Expand Down Expand Up @@ -223,6 +227,12 @@ def DisplayPILImage(

def DisplayBitmap(self, bitmap_path: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0):
image = self.open_image(bitmap_path)

# Resize the picture if custom width/height provided
if width != 0 and height != 0:
if width != image.size[0] or height != image.size[1]:
image = image.resize((width, height))

self.DisplayPILImage(image, x, y, width, height)

def DisplayText(
Expand Down
10 changes: 5 additions & 5 deletions library/lcd/lcd_comm_rev_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ def DisplayPILImage(
if not image_width:
image_width = image.size[0]

assert x <= width, 'Image X coordinate must be <= display width'
assert y <= height, 'Image Y coordinate must be <= display height'
assert image_height > 0, 'Image height must be > 0'
assert image_width > 0, 'Image width must be > 0'

# If our image size + the (x, y) position offsets are bigger than
# our display, reduce the image size to fit our screen
if x + image_width > width:
Expand All @@ -205,6 +200,11 @@ def DisplayPILImage(
if image_width != image.size[0] or image_height != image.size[1]:
image = image.crop((0, 0, image_width, image_height))

assert x <= width, 'Image X coordinate must be <= display width'
assert y <= height, 'Image Y coordinate must be <= display height'
assert image_height > 0, 'Image height must be > 0'
assert image_width > 0, 'Image width must be > 0'

(x0, y0) = (x, y)
(x1, y1) = (x + image_width - 1, y + image_height - 1)

Expand Down
Loading
Loading