Skip to content

Commit 63deacd

Browse files
committed
Fix sub-revision detection for Turing 5inch
1 parent 133dbcf commit 63deacd

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

library/lcd/lcd_comm_rev_c.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,8 @@ def __init__(self, command):
119119

120120

121121
class SubRevision(Enum):
122-
UNKNOWN = bytearray((0x00,))
123-
FIVEINCH = bytearray(
124-
(0x63, 0x68, 0x73, 0x5f, 0x35, 0x69, 0x6e, 0x63, 0x68, 0x2e, 0x64, 0x65, 0x76, 0x31, 0x5f, 0x72, 0x6f, 0x6d,
125-
0x31, 0x2e, 0x38, 0x37, 0x00)
126-
)
122+
UNKNOWN = ""
123+
FIVEINCH = "chs_5inch"
127124

128125
def __init__(self, command):
129126
self.command = command
@@ -199,9 +196,9 @@ def _hello(self):
199196
# This command reads LCD answer on serial link, so it bypasses the queue
200197
self.sub_revision = SubRevision.UNKNOWN
201198
self._send_command(Command.HELLO, bypass_queue=True)
202-
response = self.lcd_serial.read(23)
199+
response = str(self.lcd_serial.read(22).decode())
203200
self.lcd_serial.flushInput()
204-
if response == SubRevision.FIVEINCH.value:
201+
if response.startswith(SubRevision.FIVEINCH.value):
205202
self.sub_revision = SubRevision.FIVEINCH
206203
else:
207204
logger.warning("Display returned unknown sub-revision on Hello answer (%s)" % str(response))

0 commit comments

Comments
 (0)