Skip to content

Commit

Permalink
last_key_time only set when last_key changed
Browse files Browse the repository at this point in the history
deviloper-lab authored Mar 9, 2020
1 parent 553bde0 commit 845d5e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doorpi/keyboard/from_pn532.py
Original file line number Diff line number Diff line change
@@ -100,14 +100,14 @@ def pn532_recognized(self, tag):
logger.debug('found tag while bouncetime -> skip')
return

self.last_key_time = self.current_millisecond_timestamp
logger.debug('tag: %s', tag)
hmm = str(tag)
id = str(hmm.split('ID=')[-1:])[2:-2]
logger.debug('ID: %s', id)
logger.debug('Tag: %s ID: %s', tag, id)

if id in self._InputPins:
logger.debug('ID %s is registered', id)
self.last_key = id
self.last_key_time = time.time()
self._fire_OnKeyDown(self.last_key, __name__)
self._fire_OnKeyPressed(self.last_key, __name__)
self._fire_OnKeyUp(self.last_key, __name__)

0 comments on commit 845d5e4

Please sign in to comment.