Skip to content

Commit

Permalink
Merge pull request #49 from prcutler/issue32
Browse files Browse the repository at this point in the history
Fix Issue32 - remove flush argument
  • Loading branch information
tekktrik authored Oct 4, 2022
2 parents 4fcaaa3 + 460deeb commit 5bfa6b6
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 44 deletions.
18 changes: 9 additions & 9 deletions examples/fingerprint_r503.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_fingerprint():
def get_fingerprint_detail():
"""Get a finger print image, template it, and see if it matches!
This time, print out each error instead of just returning on failure"""
print("Getting image...", end="", flush=True)
print("Getting image...", end="")
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
Expand All @@ -52,7 +52,7 @@ def get_fingerprint_detail():
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(1)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -67,7 +67,7 @@ def get_fingerprint_detail():
print("Other error")
return False

print("Searching...", end="", flush=True)
print("Searching...", end="")
i = finger.finger_fast_search()
# pylint: disable=no-else-return
# This block needs to be refactored when it can be tested.
Expand All @@ -87,25 +87,25 @@ def enroll_finger(location):
"""Take a 2 finger images and template it, then store in 'location'"""
for fingerimg in range(1, 3):
if fingerimg == 1:
print("Place finger on sensor...", end="", flush=True)
print("Place finger on sensor...", end="")
else:
print("Place same finger again...", end="", flush=True)
print("Place same finger again...", end="")

while True:
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
break
if i == adafruit_fingerprint.NOFINGER:
print(".", end="", flush=True)
print(".", end="")
elif i == adafruit_fingerprint.IMAGEFAIL:
print("Imaging error")
return False
else:
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(fingerimg)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -126,7 +126,7 @@ def enroll_finger(location):
while i != adafruit_fingerprint.NOFINGER:
i = finger.get_image()

print("Creating model...", end="", flush=True)
print("Creating model...", end="")
i = finger.create_model()
if i == adafruit_fingerprint.OK:
print("Created")
Expand All @@ -137,7 +137,7 @@ def enroll_finger(location):
print("Other error")
return False

print("Storing model #%d..." % location, end="", flush=True)
print("Storing model #%d..." % location, end="")
i = finger.store_model(location)
if i == adafruit_fingerprint.OK:
print("Stored")
Expand Down
22 changes: 11 additions & 11 deletions examples/fingerprint_r503_rpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_fingerprint():
def get_fingerprint_detail():
"""Get a finger print image, template it, and see if it matches!
This time, print out each error instead of just returning on failure"""
print("Getting image...", end="", flush=True)
print("Getting image...", end="")
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
Expand All @@ -54,7 +54,7 @@ def get_fingerprint_detail():
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(1)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -69,7 +69,7 @@ def get_fingerprint_detail():
print("Other error")
return False

print("Searching...", end="", flush=True)
print("Searching...", end="")
i = finger.finger_fast_search()
# pylint: disable=no-else-return
# This block needs to be refactored when it can be tested.
Expand All @@ -89,25 +89,25 @@ def enroll_finger(location):
"""Take a 2 finger images and template it, then store in 'location'"""
for fingerimg in range(1, 3):
if fingerimg == 1:
print("Place finger on sensor...", end="", flush=True)
print("Place finger on sensor...", end="")
else:
print("Place same finger again...", end="", flush=True)
print("Place same finger again...", end="")

while True:
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
break
if i == adafruit_fingerprint.NOFINGER:
print(".", end="", flush=True)
print(".", end="")
elif i == adafruit_fingerprint.IMAGEFAIL:
print("Imaging error")
return False
else:
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(fingerimg)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -128,7 +128,7 @@ def enroll_finger(location):
while i != adafruit_fingerprint.NOFINGER:
i = finger.get_image()

print("Creating model...", end="", flush=True)
print("Creating model...", end="")
i = finger.create_model()
if i == adafruit_fingerprint.OK:
print("Created")
Expand All @@ -139,7 +139,7 @@ def enroll_finger(location):
print("Other error")
return False

print("Storing model #%d..." % location, end="", flush=True)
print("Storing model #%d..." % location, end="")
i = finger.store_model(location)
if i == adafruit_fingerprint.OK:
print("Stored")
Expand All @@ -157,14 +157,14 @@ def enroll_finger(location):

def save_fingerprint_image(filename):
"""Scan fingerprint then save image to filename."""
print("Place finger on sensor...", end="", flush=True)
print("Place finger on sensor...", end="")
while True:
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
break
if i == adafruit_fingerprint.NOFINGER:
print(".", end="", flush=True)
print(".", end="")
elif i == adafruit_fingerprint.IMAGEFAIL:
print("Imaging error")
return False
Expand Down
18 changes: 9 additions & 9 deletions examples/fingerprint_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_fingerprint():
def get_fingerprint_detail():
"""Get a finger print image, template it, and see if it matches!
This time, print out each error instead of just returning on failure"""
print("Getting image...", end="", flush=True)
print("Getting image...", end="")
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
Expand All @@ -56,7 +56,7 @@ def get_fingerprint_detail():
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(1)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -71,7 +71,7 @@ def get_fingerprint_detail():
print("Other error")
return False

print("Searching...", end="", flush=True)
print("Searching...", end="")
i = finger.finger_fast_search()
# pylint: disable=no-else-return
# This block needs to be refactored when it can be tested.
Expand All @@ -91,25 +91,25 @@ def enroll_finger(location):
"""Take a 2 finger images and template it, then store in 'location'"""
for fingerimg in range(1, 3):
if fingerimg == 1:
print("Place finger on sensor...", end="", flush=True)
print("Place finger on sensor...", end="")
else:
print("Place same finger again...", end="", flush=True)
print("Place same finger again...", end="")

while True:
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
break
if i == adafruit_fingerprint.NOFINGER:
print(".", end="", flush=True)
print(".", end="")
elif i == adafruit_fingerprint.IMAGEFAIL:
print("Imaging error")
return False
else:
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(fingerimg)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -130,7 +130,7 @@ def enroll_finger(location):
while i != adafruit_fingerprint.NOFINGER:
i = finger.get_image()

print("Creating model...", end="", flush=True)
print("Creating model...", end="")
i = finger.create_model()
if i == adafruit_fingerprint.OK:
print("Created")
Expand All @@ -141,7 +141,7 @@ def enroll_finger(location):
print("Other error")
return False

print("Storing model #%d..." % location, end="", flush=True)
print("Storing model #%d..." % location, end="")
i = finger.store_model(location)
if i == adafruit_fingerprint.OK:
print("Stored")
Expand Down
18 changes: 9 additions & 9 deletions examples/fingerprint_simpletest_rpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_fingerprint():
def get_fingerprint_detail():
"""Get a finger print image, template it, and see if it matches!
This time, print out each error instead of just returning on failure"""
print("Getting image...", end="", flush=True)
print("Getting image...", end="")
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
Expand All @@ -55,7 +55,7 @@ def get_fingerprint_detail():
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(1)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -70,7 +70,7 @@ def get_fingerprint_detail():
print("Other error")
return False

print("Searching...", end="", flush=True)
print("Searching...", end="")
i = finger.finger_fast_search()
# pylint: disable=no-else-return
# This block needs to be refactored when it can be tested.
Expand All @@ -90,25 +90,25 @@ def enroll_finger(location):
"""Take a 2 finger images and template it, then store in 'location'"""
for fingerimg in range(1, 3):
if fingerimg == 1:
print("Place finger on sensor...", end="", flush=True)
print("Place finger on sensor...", end="")
else:
print("Place same finger again...", end="", flush=True)
print("Place same finger again...", end="")

while True:
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
break
if i == adafruit_fingerprint.NOFINGER:
print(".", end="", flush=True)
print(".", end="")
elif i == adafruit_fingerprint.IMAGEFAIL:
print("Imaging error")
return False
else:
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(fingerimg)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -129,7 +129,7 @@ def enroll_finger(location):
while i != adafruit_fingerprint.NOFINGER:
i = finger.get_image()

print("Creating model...", end="", flush=True)
print("Creating model...", end="")
i = finger.create_model()
if i == adafruit_fingerprint.OK:
print("Created")
Expand All @@ -140,7 +140,7 @@ def enroll_finger(location):
print("Other error")
return False

print("Storing model #%d..." % location, end="", flush=True)
print("Storing model #%d..." % location, end="")
i = finger.store_model(location)
if i == adafruit_fingerprint.OK:
print("Stored")
Expand Down
12 changes: 6 additions & 6 deletions examples/fingerprint_template_file_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def fingerprint_check_file():
if finger.image_2_tz(1) != adafruit_fingerprint.OK:
return False

print("Loading file template...", end="", flush=True)
print("Loading file template...", end="")
with open("template0.dat", "rb") as file:
data = file.read()
finger.send_fpdata(list(data), "char", 2)
Expand All @@ -87,17 +87,17 @@ def enroll_save_to_file():
set_led_local(color=3, mode=1)
for fingerimg in range(1, 3):
if fingerimg == 1:
print("Place finger on sensor...", end="", flush=True)
print("Place finger on sensor...", end="")
else:
print("Place same finger again...", end="", flush=True)
print("Place same finger again...", end="")

while True:
i = finger.get_image()
if i == adafruit_fingerprint.OK:
print("Image taken")
break
if i == adafruit_fingerprint.NOFINGER:
print(".", end="", flush=True)
print(".", end="")
elif i == adafruit_fingerprint.IMAGEFAIL:
set_led_local(color=1, mode=2, speed=20, cycles=10)
print("Imaging error")
Expand All @@ -107,7 +107,7 @@ def enroll_save_to_file():
print("Other error")
return False

print("Templating...", end="", flush=True)
print("Templating...", end="")
i = finger.image_2_tz(fingerimg)
if i == adafruit_fingerprint.OK:
print("Templated")
Expand All @@ -131,7 +131,7 @@ def enroll_save_to_file():
while i != adafruit_fingerprint.NOFINGER:
i = finger.get_image()

print("Creating model...", end="", flush=True)
print("Creating model...", end="")
i = finger.create_model()
if i == adafruit_fingerprint.OK:
print("Created")
Expand Down

0 comments on commit 5bfa6b6

Please sign in to comment.