added continual directional press for letter selection

This commit is contained in:
newtonick
2021-05-07 08:34:51 -04:00
parent d950e21578
commit f1e2d2f03d
3 changed files with 6 additions and 3 deletions
+1
View File
@@ -1 +1,2 @@
.DS_Store .DS_Store
__pycache__/
+4 -2
View File
@@ -32,10 +32,12 @@ class Buttons:
return return
def wait_for(self, keys = [], check_release = True) -> int: def wait_for(self, keys = [], check_release = True, release_keys = []) -> int:
if not release_keys:
release_keys = keys
while True: while True:
for i in keys: for i in keys:
if check_release == False or (check_release == True and B.release_lock == True): if check_release == False or ((check_release == True and i in release_keys and B.release_lock == True) or check_release == True and i not in release_keys):
# when check release is False or the release lock is released (True) # when check release is False or the release lock is released (True)
if self.GPIO.input(i) == GPIO.LOW or self.override_ind == True: if self.GPIO.input(i) == GPIO.LOW or self.override_ind == True:
B.release_lock = False B.release_lock = False
+1 -1
View File
@@ -42,7 +42,7 @@ class SeedToolsView(View):
# Wait for Button Input (specifically menu selection/press) # Wait for Button Input (specifically menu selection/press)
while True: while True:
input = self.buttons.wait_for([B.KEY_UP, B.KEY_DOWN, B.KEY_PRESS, B.KEY_RIGHT, B.KEY_LEFT, B.KEY1, B.KEY2, B.KEY3]) input = self.buttons.wait_for([B.KEY_UP, B.KEY_DOWN, B.KEY_PRESS, B.KEY_RIGHT, B.KEY_LEFT, B.KEY1, B.KEY2, B.KEY3], True, [B.KEY_PRESS, B.KEY_RIGHT, B.KEY_LEFT, B.KEY1, B.KEY2, B.KEY3])
if input == B.KEY_UP: if input == B.KEY_UP:
ret_val = self.gather_words_up() ret_val = self.gather_words_up()
elif input == B.KEY_DOWN: elif input == B.KEY_DOWN: