Skip to content

Commit

Permalink
Merge pull request #2466 from wastlmuc/patch-2
Browse files Browse the repository at this point in the history
Fix card swipe detection issue after NTP update
  • Loading branch information
s-martin authored Dec 20, 2024
2 parents d8ab338 + 55d13af commit 088ea3a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/daemon_rfid_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
sspc = open('../settings/Second_Swipe_Pause_Controls', 'r')
sspc_nodelay = sspc.readline().strip()
previous_id = ""
previous_time = time.time()
previous_time = time.monotonic()

# get swipe or place configuration value
sop = open('../settings/Swipe_or_Place', 'r')
Expand Down Expand Up @@ -94,7 +94,7 @@ def handler(signum, frame):
# start the player script and pass on the cardid (but only if new card or otherwise
# "same_id_delay" seconds have passed)
if cardid is not None:
if cardid != previous_id or (time.time() - previous_time) >= float(same_id_delay) or cardid in str(ids):
if cardid != previous_id or (time.monotonic() - previous_time) >= float(same_id_delay) or cardid in str(ids):
logger.info('Trigger Play Cardid={cardid}'.format(cardid=cardid))
subprocess.call([dir_path + '/rfid_trigger_play.sh --cardid=' + cardid], shell=True)
previous_id = cardid
Expand All @@ -105,7 +105,7 @@ def handler(signum, frame):
same_id_delay=same_id_delay
))

previous_time = time.time()
previous_time = time.monotonic()

except OSError as e:
logger.error('Execution failed: {e}'.format(e=e))

0 comments on commit 088ea3a

Please sign in to comment.