diff --git a/README.md b/README.md index 2a2a6aad..f8f3c0c1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Supported operating systems : macOS, Windows, Linux (incl. Raspberry Pi), basica | | | | | also improperly called "revision A" by the resellers | revision B & flagship (with backplate & RGB LEDs) | basic support (no video or storage for now) | -| ⚠️ Turing Smart Screen 8.8" | ✅ Turing Smart Screen 2.1" | +| ⚠️ Turing Smart Screen 8.8" | ✅ Turing Smart Screen 2.1" / 2.8" | |---------------------------------------------|------------------------------------------------------------------| | | | | basic support (no video or storage for now)
⚠️ [New revision V1.1 not supported!](https://github.com/mathoudebine/turing-smart-screen-python/issues/727) | basic support (no video or storage for now) | @@ -135,4 +135,3 @@ If you have trouble running the program as described in the wiki, please check [ ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=mathoudebine/turing-smart-screen-python&type=Date)](https://star-history.com/#mathoudebine/turing-smart-screen-python&Date) - diff --git a/config.yaml b/config.yaml index bacc6001..84c7bd11 100644 --- a/config.yaml +++ b/config.yaml @@ -54,7 +54,7 @@ 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" + # - C for Turing 2.1"/2.8"/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" @@ -76,4 +76,4 @@ display: # By default, this program resets the display on startup, in case it is in a degraded state from previous runs. # This behavior causes the display to disconnect/reconnect, and the COM port to change. # On some displays (like rev. A) it can be an issue, in this case change the value to "false". - RESET_ON_STARTUP: true \ No newline at end of file + RESET_ON_STARTUP: true diff --git a/configure.py b/configure.py index d4c318f1..365a3910 100755 --- a/configure.py +++ b/configure.py @@ -66,24 +66,25 @@ SIZE_3_5_INCH = "3.5\"" SIZE_5_INCH = "5\"" SIZE_8_8_INCH = "8.8\"" -SIZE_2_1_INCH = "2.1\"" +SIZE_2_1_INCH = "2.1\"" # Only for retro compatibility +SIZE_2_x_INCH = "2.1\" / 2.8\"" SIZE_0_96_INCH = "0.96\"" -size_list = (SIZE_0_96_INCH, SIZE_2_1_INCH, SIZE_3_5_INCH, SIZE_5_INCH, SIZE_8_8_INCH) +size_list = (SIZE_0_96_INCH, SIZE_2_x_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 = { ('A', SIZE_3_5_INCH): TURING_MODEL, # Can also be UsbPCMonitor 3.5, does not matter since protocol is the same ('A', SIZE_5_INCH): USBPCMONITOR_MODEL, ('B', SIZE_3_5_INCH): XUANFANG_MODEL, - ('C', SIZE_2_1_INCH): TURING_MODEL, + ('C', SIZE_2_x_INCH): TURING_MODEL, ('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_2_x_INCH): SIMULATED_MODEL, ('SIMU', SIZE_3_5_INCH): SIMULATED_MODEL, ('SIMU', SIZE_5_INCH): SIMULATED_MODEL, ('SIMU', SIZE_8_8_INCH): SIMULATED_MODEL, @@ -93,14 +94,14 @@ (USBPCMONITOR_MODEL, SIZE_3_5_INCH): 'A', (USBPCMONITOR_MODEL, SIZE_5_INCH): 'A', (XUANFANG_MODEL, SIZE_3_5_INCH): 'B', - (TURING_MODEL, SIZE_2_1_INCH): 'C', + (TURING_MODEL, SIZE_2_x_INCH): 'C', (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_2_x_INCH): 'SIMU', (SIMULATED_MODEL, SIZE_3_5_INCH): 'SIMU', (SIMULATED_MODEL, SIZE_5_INCH): 'SIMU', (SIMULATED_MODEL, SIZE_8_8_INCH): 'SIMU', @@ -312,7 +313,7 @@ def load_theme_preview(self): try: theme_preview = Image.open(MAIN_DIRECTORY + "res/themes/" + self.theme_cb.get() + "/preview.png") - if theme_data['display'].get("DISPLAY_SIZE", '3.5"') == '2.1"': + if theme_data['display'].get("DISPLAY_SIZE", '3.5"') == SIZE_2_1_INCH: # This is a circular screen: apply a circle mask over the preview theme_preview.paste(circular_mask, mask=circular_mask) except: @@ -380,6 +381,7 @@ def load_config_values(self): # Guess display size from theme in the configuration size = get_theme_size(self.config['config']['THEME']) + 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" try: self.size_cb.set(size) except: @@ -505,6 +507,7 @@ def on_model_change(self, e=None): def on_size_change(self, e=None): size = self.size_cb.get() + 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 themes = get_themes(size) self.theme_cb.config(values=themes) diff --git a/library/lcd/lcd_comm_rev_c.py b/library/lcd/lcd_comm_rev_c.py index d4f9b239..75fe73a2 100644 --- a/library/lcd/lcd_comm_rev_c.py +++ b/library/lcd/lcd_comm_rev_c.py @@ -115,16 +115,16 @@ class SleepInterval(Enum): class SubRevision(Enum): - UNKNOWN = "" - REV_2INCH = "chs_21inch" - REV_5INCH = "chs_5inch" - REV_8INCH = "chs_88inch" + UNKNOWN = 0 + REV_2INCH = 1 # For 2.1" and 2.8" models + REV_5INCH = 2 + REV_8INCH = 3 WAKE_RETRIES = 15 -# This class is for Turing Smart Screen 2.1" / 5" / 8" screens +# This class is for Turing Smart Screen 2.1" / 2.8" / 5" / 8" screens class LcdCommRevC(LcdComm): def __init__(self, com_port: str = "AUTO", display_width: int = 480, display_height: int = 800, update_queue: Optional[queue.Queue] = None): @@ -431,7 +431,7 @@ def _generate_update_image( img_raw_data = bytearray() # Some screens require different RGBA encoding - if self.rom_version > 88: + if self.sub_revision != SubRevision.REV_2INCH and self.rom_version > 88: # BGRA mode on 4 bytes : [B, G, R, A] img_data, pixel_size = image_to_BGRA(image) else: diff --git a/tools/list-serial-ports.py b/tools/list-serial-ports.py new file mode 100644 index 00000000..c5146767 --- /dev/null +++ b/tools/list-serial-ports.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: GPL-3.0-or-later +# +# turing-smart-screen-python - a Python system monitor and library for USB-C displays like Turing Smart Screen or XuanFang +# https://github.com/mathoudebine/turing-smart-screen-python/ +# +# Copyright (C) 2021 Matthieu Houdebine (mathoudebine) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# list-serial-ports.py: To list all serial ports available in your system, with their names and IDs + +from serial.tools.list_ports import comports +for com_port in comports(): + if com_port.vid and com_port.pid: + print("Serial=%s VID=%x PID=%x" % (com_port.serial_number, com_port.vid, com_port.pid))