From 80e142a50d33f4ca9720b3b572a7baba2befc19e Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sat, 25 Nov 2023 01:47:07 -0500 Subject: [PATCH] [F] Fix spicetools not picking up presses --- receiver.py | 17 +++++++---------- requirements.txt | 1 - 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/receiver.py b/receiver.py index 37f86cd..c2766f8 100644 --- a/receiver.py +++ b/receiver.py @@ -4,6 +4,7 @@ import time import serial import re from vk import * +import winsound # Configure your serial port and baud rate SERIAL_PORT = 'COM3' # Replace 'COMx' with your serial port (e.g., 'COM3' on Windows or '/dev/ttyUSB0' on Linux) @@ -36,18 +37,14 @@ def parse_uid(data): PATH.write_text(uid) # Play audio effect - # If is Windows, use winsound - if os.name == 'nt': - import winsound - winsound.PlaySound(str(AUDIO_EFFECT), winsound.SND_FILENAME) - else: - from playsound import playsound - playsound(str(AUDIO_EFFECT)) + winsound.PlaySound(str(AUDIO_EFFECT), winsound.SND_FILENAME) # Press scan button - press_key() - time.sleep(2) - release_key() + for i in range(3): + press_key() + time.sleep(0.1) + release_key() + time.sleep(0.1) return uid diff --git a/requirements.txt b/requirements.txt index 66e805c..40c5ccd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ pyserial -playsound pynput \ No newline at end of file