From 27d83995299808262ddd76d5ea3f72bbdafde933 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 19 Jan 2016 13:30:19 -0500 Subject: [PATCH] Clean up output We're printing "No tag read" many, many, MANY times each second to the log. Let's cut back a bit to make debugging easier. We should also print when we're clearing the cache in case we need to find that in the logs later. Signed-off-by: Anna Schumaker --- doors.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doors.py b/doors.py index 3a3f7a6..4c20a9a 100755 --- a/doors.py +++ b/doors.py @@ -120,6 +120,7 @@ def clear_cache(): today = datetime.date.today() if today.month != THIS_MONTH: + print("Clearing key cache") CACHED_KEYS.clear() THIS_MONTH = today.month @@ -158,9 +159,7 @@ RFID_SERIAL = serial.Serial(RFID_PATH, 2400, timeout=1) def _do_read_rfid(): string = RFID_SERIAL.read(12) - if len(string) == 0: - print("No tag read") - else: + if len(string) > 0: key = string[1:11].decode() #exclude start x0A and stop x0D bytes print("Read key: %s" % key) verify_key(key)