Skip to content

Can't template file compare with SEN0188 #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DNTM2802 opened this issue Dec 14, 2021 · 2 comments · Fixed by #47
Closed

Can't template file compare with SEN0188 #39

DNTM2802 opened this issue Dec 14, 2021 · 2 comments · Fixed by #47

Comments

@DNTM2802
Copy link

I want to store a fingerprint template in a file, and then compare it with one newly obtained with the sensor. For that I'm using the code in the example you provided (examples/fingerprint_tempalte_file_compare.py).

Im getting the following error:

Traceback (most recent call last):
  File "/home/pi/biometrics/tests/fingerprint_compare_files.py", line 200, in <module>
    fingerprint_check_file()
  File "/home/pi/biometrics/tests/fingerprint_compare_files.py", line 72, in fingerprint_check_file
    i = finger.compare_templates()
  File "/usr/local/lib/python3.9/dist-packages/adafruit_fingerprint.py", line 324, in compare_templates
    self.confidence = struct.unpack(">H", bytes(r[1:3]))
struct.error: unpack requires a buffer of 2 bytes

Which is relted to this function:

def compare_templates(self) -> int:
    self._send_packet([_COMPARE])
    r = self._get_packet(14)
    self.confidence = struct.unpack(">H", bytes(r[1:3]))
    self._print_debug("compare_templates confidence:", self.confidence)
    return r[0]

The value of r after r = self._get_packet(14) is [1], which is the code for PACKETRECIEVEERR.
So what is happening? The sensor is unable to make the comparison? The problem is the _COMPARE instruction or it may be the data that was sended before?
Note that everything works for the flash memory option (examples/fingerprint_simpletest_rpi.py).

Thank you.

@decentralMind
Copy link

Hi, I'm facing similar issue with R307 fingerprint sensor. Did you solved the problem?

@ajiekurniawansaputra
Copy link
Contributor

Hi guys, I have solved the problem, it's in the _send_data function, the checksum should concatenate ENDDATAPACKET on the last send. I have request pull on the main branch, I hope they accept my request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants