Closed xijo closed 9 months ago
For now I worked around with something silly like
while True:
# Throttle until you find the first block readable
id, text = reader.read_no_block(11)
while not id:
id, text = reader.read_no_block(11)
sleep(0.5)
# Continue to read the next block
if id:
id2, text2 = reader.read_no_block(15)
while not id2:
id2, text2 = reader.read_no_block(15)
print("full text: ", text + text2)
But I still wonder if there's a smarter solution than that 🤔
Does that code solve your cpu consumption issue?? Try if increasing the sleep work If you could try adding a time.sleep(0.25) below the while loop in MFRC522.py line 307 lemme know if that works. if that works give me a pull request with the changes
On my PI it looks promising:
With no wait:
Active: active (running) since Wed 2024-01-10 09:57:38 GMT; 2min 28s ago
CPU: 2min 27.887s
With 0.1s wait:
Active: active (running) since Wed 2024-01-10 10:01:11 GMT; 2min 28s ago
CPU: 1min 9.658s
With 0.5s wait:
Active: active (running) since Wed 2024-01-10 10:04:12 GMT; 2min 28s ago
CPU: 25.453s
There was no difference in card detection and reading that I was able to spot.
fixed it!
Awesome lib, thanks a lot!
When running it in daemon mode and waiting for RFID input it is eating a lot of CPU though. Is there a way to throttle, that I did not find just yet?
Cheers, Johannes