diff --git a/configure.py b/configure.py index 8a42e897..e1f27c7d 100755 --- a/configure.py +++ b/configure.py @@ -64,6 +64,8 @@ SIMULATED_MODEL = "Simulated screen" SIZE_3_5_INCH = "3.5\"" +SIZE_4_6_INCH = "4.6\"" +SIZE_4_6_INCH_USB = "4.6\"" SIZE_5_INCH = "5\"" SIZE_8_8_INCH = "8.8\"" SIZE_8_8_INCH_USB = "8.8\" (V1.1) or 9.2\"" @@ -71,7 +73,7 @@ SIZE_2_x_INCH = "2.1\" / 2.8\"" SIZE_0_96_INCH = "0.96\"" -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) +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) # Maps between config.yaml values and GUI description revision_and_size_to_model_map = { @@ -81,6 +83,7 @@ ('C', SIZE_2_x_INCH): TURING_MODEL, ('C', SIZE_5_INCH): TURING_MODEL, ('C', SIZE_8_8_INCH): TURING_MODEL, + ('C_USB', SIZE_4_6_INCH_USB): TURING_MODEL, ('C_USB', SIZE_8_8_INCH_USB): TURING_MODEL, ('D', SIZE_3_5_INCH): KIPYE_MODEL, ('WEACT_A', SIZE_3_5_INCH): WEACT_MODEL, @@ -88,6 +91,7 @@ ('SIMU', SIZE_0_96_INCH): SIMULATED_MODEL, ('SIMU', SIZE_2_x_INCH): SIMULATED_MODEL, ('SIMU', SIZE_3_5_INCH): SIMULATED_MODEL, + ('SIMU', SIZE_4_6_INCH): SIMULATED_MODEL, ('SIMU', SIZE_5_INCH): SIMULATED_MODEL, ('SIMU', SIZE_8_8_INCH): SIMULATED_MODEL, } @@ -99,6 +103,7 @@ (TURING_MODEL, SIZE_2_x_INCH): 'C', (TURING_MODEL, SIZE_5_INCH): 'C', (TURING_MODEL, SIZE_8_8_INCH): 'C', + (TURING_MODEL, SIZE_4_6_INCH_USB): 'C_USB', (TURING_MODEL, SIZE_8_8_INCH_USB): 'C_USB', (KIPYE_MODEL, SIZE_3_5_INCH): 'D', (WEACT_MODEL, SIZE_3_5_INCH): 'WEACT_A', @@ -106,6 +111,7 @@ (SIMULATED_MODEL, SIZE_0_96_INCH): 'SIMU', (SIMULATED_MODEL, SIZE_2_x_INCH): 'SIMU', (SIMULATED_MODEL, SIZE_3_5_INCH): 'SIMU', + (SIMULATED_MODEL, SIZE_4_6_INCH): 'SIMU', (SIMULATED_MODEL, SIZE_5_INCH): 'SIMU', (SIMULATED_MODEL, SIZE_8_8_INCH): 'SIMU', } diff --git a/library/display.py b/library/display.py index 0befeb6d..d9ddeb20 100644 --- a/library/display.py +++ b/library/display.py @@ -62,6 +62,8 @@ def _get_theme_size() -> tuple[int, int]: return 480, 480 elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '3.5"': return 320, 480 + elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '4.6"': + return 320, 960 elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '5"': return 480, 800 elif config.THEME_DATA["display"].get("DISPLAY_SIZE", '') == '8.8"': diff --git a/library/lcd/lcd_comm_turing_usb.py b/library/lcd/lcd_comm_turing_usb.py index 5ccd6bf8..b419e821 100644 --- a/library/lcd/lcd_comm_turing_usb.py +++ b/library/lcd/lcd_comm_turing_usb.py @@ -39,7 +39,7 @@ from library.lcd.lcd_comm import Orientation, LcdComm VENDOR_ID = 0x1cbe -PRODUCT_ID = [0x0088, 0x0092] # 8.8", 9.2" +PRODUCT_ID = [0x0046, 0x0088, 0x0092] # 4.6", 8.8", 9.2" 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: def find_usb_device(): + dev = None for pid in PRODUCT_ID: dev = usb.core.find(idVendor=VENDOR_ID, idProduct=pid) + if dev is not None: + break if dev is None: raise ValueError(f'USB device not found') @@ -936,7 +939,7 @@ def _write_file_command(dev, file_path: str) -> bool: return False -# This class is for Turing Smart Screen newer models (5.2" / 8" / 8.8" HW rev 1.x / 9.2") +# This class is for Turing Smart Screen newer models (4.6" / 5.2" / 8" / 8.8" HW rev 1.x / 9.2") # These models are not detected as serial ports but as (Win)USB devices class LcdCommTuringUSB(LcdComm): def __init__(self, com_port: str = "AUTO", display_width: int = 480, display_height: int = 1920, diff --git a/res/themes/Gradient46/background.png b/res/themes/Gradient46/background.png new file mode 100644 index 00000000..c5bea392 Binary files /dev/null and b/res/themes/Gradient46/background.png differ diff --git a/res/themes/Gradient46/preview.png b/res/themes/Gradient46/preview.png new file mode 100644 index 00000000..64411868 Binary files /dev/null and b/res/themes/Gradient46/preview.png differ diff --git a/res/themes/Gradient46/theme.yaml b/res/themes/Gradient46/theme.yaml new file mode 100644 index 00000000..b22b1b7b --- /dev/null +++ b/res/themes/Gradient46/theme.yaml @@ -0,0 +1,83 @@ +--- +author: "@mathoudebine" + +display: + DISPLAY_SIZE: 4.6" + DISPLAY_ORIENTATION: portrait + DISPLAY_RGB_LED: 226, 21, 103 + +static_images: + BACKGROUND: + PATH: background.png + X: 0 + Y: 0 + WIDTH: 320 + HEIGHT: 960 + +STATS: + CPU: + PERCENTAGE: + INTERVAL: 1 + TEXT: + SHOW: True + SHOW_UNIT: True + X: 40 + Y: 160 + FONT: roboto-mono/RobotoMono-Regular.ttf + FONT_SIZE: 80 + FONT_COLOR: 255, 255, 255 + BACKGROUND_IMAGE: background.png + TEMPERATURE: + INTERVAL: 1 + TEXT: + SHOW: True + SHOW_UNIT: True + X: 80 + Y: 110 + FONT: roboto-mono/RobotoMono-Regular.ttf + FONT_SIZE: 40 + FONT_COLOR: 255, 255, 255 + BACKGROUND_IMAGE: background.png + GPU: + INTERVAL: 1 + PERCENTAGE: + TEXT: + SHOW: True + SHOW_UNIT: True + X: 40 + Y: 480 + FONT: roboto-mono/RobotoMono-Regular.ttf + FONT_SIZE: 80 + FONT_COLOR: 255, 255, 255 + BACKGROUND_IMAGE: background.png + TEMPERATURE: + TEXT: + SHOW: True + SHOW_UNIT: True + X: 80 + Y: 430 + FONT: roboto-mono/RobotoMono-Regular.ttf + FONT_SIZE: 40 + FONT_COLOR: 255, 255, 255 + BACKGROUND_IMAGE: background.png + MEMORY: + INTERVAL: 5 + VIRTUAL: + USED: + SHOW: True + SHOW_UNIT: True + X: 80 + Y: 740 + FONT: roboto-mono/RobotoMono-Regular.ttf + FONT_SIZE: 30 + FONT_COLOR: 255, 255, 255 + BACKGROUND_IMAGE: background.png + PERCENT_TEXT: + SHOW: True + SHOW_UNIT: True + X: 40 + Y: 790 + FONT: roboto-mono/RobotoMono-Regular.ttf + FONT_SIZE: 80 + FONT_COLOR: 255, 255, 255 + BACKGROUND_IMAGE: background.png