Skip to content

Can't template file compare with SEN0188 #39

Closed
@DNTM2802

Description

@DNTM2802

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions