From 357dba06dc36ea1242e3c53ad108443e80e4ca19 Mon Sep 17 00:00:00 2001 From: rdagger Date: Thu, 23 Apr 2020 20:55:50 -0700 Subject: [PATCH] Optimize code --- pwn_search.py | 2 +- touch_keyboard.py | 7 ++----- xpt2046.py | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pwn_search.py b/pwn_search.py index 9092b4d..7dcce3f 100644 --- a/pwn_search.py +++ b/pwn_search.py @@ -100,7 +100,7 @@ def main(): spi2 = SPI(2, baudrate=1000000, sck=Pin(18), mosi=Pin(23), miso=Pin(19)) - pwn = PwnLookup(spi1, spi2) + PwnLookup(spi1, spi2) while True: sleep(.1) diff --git a/touch_keyboard.py b/touch_keyboard.py index 9c5c064..5c38e5b 100644 --- a/touch_keyboard.py +++ b/touch_keyboard.py @@ -29,7 +29,7 @@ class TouchKeyboard(object): ( ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0'), ('<', '>', '|', '\\', '/', '{', '}', '[', ']'), - ('\v', '=', '"', '\'', ';', ':', '`', '~', '\b', '\b'), + ('\f', '=', '"', '\'', ';', ':', '`', '~', '\b', '\b'), ('\a', ' ', '\r') ) ) @@ -97,10 +97,7 @@ class TouchKeyboard(object): self.kb_screen ^= 1 # Toggle caps self.load_keyboard() elif key == '\f': - self.kb_screen = 3 # Symbols Set 2 - self.load_keyboard() - elif key == '\v': - self.kb_screen = 2 # Symbols Set 1 + self.kb_screen = self.kb_screen - 2 ^ 1 + 2 # Toggle symbols self.load_keyboard() elif key == '\a': self.kb_screen = 0 # Letters diff --git a/xpt2046.py b/xpt2046.py index 2a12bf2..b1e8751 100644 --- a/xpt2046.py +++ b/xpt2046.py @@ -99,7 +99,6 @@ class Touch(object): elif pin.value() and self.int_locked: sleep(.1) # Debounce rising edge self.int_locked = False # Unlock interrupt - return def normalize(self, x, y): """Normalize mean X,Y values to match LCD screen."""