Optimize code

pull/4/head
rdagger 5 years ago
parent 767e9a93d4
commit 357dba06dc

@ -100,7 +100,7 @@ def main():
spi2 = SPI(2, baudrate=1000000, spi2 = SPI(2, baudrate=1000000,
sck=Pin(18), mosi=Pin(23), miso=Pin(19)) sck=Pin(18), mosi=Pin(23), miso=Pin(19))
pwn = PwnLookup(spi1, spi2) PwnLookup(spi1, spi2)
while True: while True:
sleep(.1) sleep(.1)

@ -29,7 +29,7 @@ class TouchKeyboard(object):
( (
('1', '2', '3', '4', '5', '6', '7', '8', '9', '0'), ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0'),
('<', '>', '|', '\\', '/', '{', '}', '[', ']'), ('<', '>', '|', '\\', '/', '{', '}', '[', ']'),
('\v', '=', '"', '\'', ';', ':', '`', '~', '\b', '\b'), ('\f', '=', '"', '\'', ';', ':', '`', '~', '\b', '\b'),
('\a', ' ', '\r') ('\a', ' ', '\r')
) )
) )
@ -97,10 +97,7 @@ class TouchKeyboard(object):
self.kb_screen ^= 1 # Toggle caps self.kb_screen ^= 1 # Toggle caps
self.load_keyboard() self.load_keyboard()
elif key == '\f': elif key == '\f':
self.kb_screen = 3 # Symbols Set 2 self.kb_screen = self.kb_screen - 2 ^ 1 + 2 # Toggle symbols
self.load_keyboard()
elif key == '\v':
self.kb_screen = 2 # Symbols Set 1
self.load_keyboard() self.load_keyboard()
elif key == '\a': elif key == '\a':
self.kb_screen = 0 # Letters self.kb_screen = 0 # Letters

@ -99,7 +99,6 @@ class Touch(object):
elif pin.value() and self.int_locked: elif pin.value() and self.int_locked:
sleep(.1) # Debounce rising edge sleep(.1) # Debounce rising edge
self.int_locked = False # Unlock interrupt self.int_locked = False # Unlock interrupt
return
def normalize(self, x, y): def normalize(self, x, y):
"""Normalize mean X,Y values to match LCD screen.""" """Normalize mean X,Y values to match LCD screen."""

Loading…
Cancel
Save