Skip to content
Draft
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
8 changes: 7 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@
SIZE_3_5_INCH = "3.5\""
SIZE_5_INCH = "5\""
SIZE_8_8_INCH = "8.8\""
SIZE_8_8_INCH_USB = "8.8\" (V1.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_x_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, SIZE_8_8_INCH_USB)

# Maps between config.yaml values and GUI description
revision_and_size_to_model_map = {
Expand All @@ -80,6 +81,7 @@
('C', SIZE_2_x_INCH): TURING_MODEL,
('C', SIZE_5_INCH): TURING_MODEL,
('C', SIZE_8_8_INCH): 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,
('WEACT_B', SIZE_0_96_INCH): WEACT_MODEL,
Expand All @@ -97,6 +99,7 @@
(TURING_MODEL, SIZE_2_x_INCH): 'C',
(TURING_MODEL, SIZE_5_INCH): 'C',
(TURING_MODEL, SIZE_8_8_INCH): 'C',
(TURING_MODEL, SIZE_8_8_INCH_USB): 'C_USB',
(KIPYE_MODEL, SIZE_3_5_INCH): 'D',
(WEACT_MODEL, SIZE_3_5_INCH): 'WEACT_A',
(WEACT_MODEL, SIZE_0_96_INCH): 'WEACT_B',
Expand Down Expand Up @@ -383,6 +386,8 @@ def load_config_values(self):
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:
if size == SIZE_8_8_INCH and self.config['display']['REVISION'] == 'C_USB':
size = SIZE_8_8_INCH_USB
self.size_cb.set(size)
except:
self.size_cb.current(0)
Expand Down Expand Up @@ -508,6 +513,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
size = size.replace(SIZE_8_8_INCH_USB, SIZE_8_8_INCH)
themes = get_themes(size)
self.theme_cb.config(values=themes)

Expand Down
4 changes: 4 additions & 0 deletions library/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from library.lcd.lcd_comm_rev_a import LcdCommRevA
from library.lcd.lcd_comm_rev_b import LcdCommRevB
from library.lcd.lcd_comm_rev_c import LcdCommRevC
from library.lcd.lcd_comm_turing_usb import LcdCommTuringUSB
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
Expand Down Expand Up @@ -85,6 +86,9 @@ def __init__(self):
# Because of issue with Turing rev. C size auto-detection, manually configure screen width/height from theme
self.lcd = LcdCommRevC(com_port=config.CONFIG_DATA['config']['COM_PORT'],
update_queue=config.update_queue, display_width=width, display_height=height)
elif config.CONFIG_DATA["display"]["REVISION"] == "C_USB":
# On all USB models, manually configure screen width/height from theme
self.lcd = LcdCommTuringUSB(display_width=width, display_height=height)
elif config.CONFIG_DATA["display"]["REVISION"] == "D":
self.lcd = LcdCommRevD(com_port=config.CONFIG_DATA['config']['COM_PORT'],
update_queue=config.update_queue)
Expand Down
3 changes: 2 additions & 1 deletion library/lcd/lcd_comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(self, com_port: str = "AUTO", display_width: int = 320, display_hei
self.lcd_serial = None

# String containing absolute path to serial port e.g. "COM3", "/dev/ttyACM1" or "AUTO" for auto-discovery
# Ignored for USB HID screens
self.com_port = com_port

# Display always start in portrait orientation by default
Expand Down Expand Up @@ -180,8 +181,8 @@ def ReadData(self, readSize: int):
return self.serial_read(readSize)

@staticmethod
@abstractmethod
def auto_detect_com_port() -> Optional[str]:
# To implement only for screens that use serial commands
pass

@abstractmethod
Expand Down
Loading
Loading