Skip to content
Snippets Groups Projects
Commit bb62bb55 authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Avoid duplicates

parent aa4ce545
No related branches found
No related tags found
No related merge requests found
......@@ -356,6 +356,7 @@ def read_key_input(input_queue, config, logger):
# Buffer to store incoming keys till ENTER (keycode 28) is received
keybuffer = []
last_string = None
# Loop Forever over the Input
while True:
......@@ -381,7 +382,12 @@ def read_key_input(input_queue, config, logger):
# When enter is received put the joined string to the imput
# buffer where it will be processed by the requests thread
# and reset the keybuffer
input_queue.put("".join(keybuffer))
joined_string = "".join(keybuffer)
# Don't add the string to the queue if is the same as before to avoid duplicates
if last_string is not None and joined_string != last_string:
input_queue.put(joined_string)
last_string = joined_string
keybuffer = []
except (KeyboardInterrupt, SystemExit, OSError) as e:
cardreader.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment