• I cant really test it.. but i looked a bit at the index.js and saw i was testing a function for complete enrollment. A few minor changes i think and you should get it to work.

    Try this as a replacement for the index.js

    'use strict';
    
    let GT511CXX = require('./gt511cxx.js');
    
    GT511CXX.prototype.enroll = function(id) {
        let me = this,
            open = () => me.open(),
            start = () => me.enrollStart(id),
            capture = () => me.captureFinger(true),
            waitFinger = () => me.waitFinger(10000, false),
            waitReleaseFinger = () => me.waitFinger(10000, true),
            ledOn = () => me.switchLED(true),
            ledOff = () => me.switchLED(false),
            enroll1 = () => me.enroll1(),
            enroll2 = () => me.enroll2(),
            enroll3 = () => me.enroll3(),
            enrollDelay = () => new Promise(resolve => setTimeout(resolve, 500)),
            blinkDelay = () => new Promise(resolve => setTimeout(resolve, 100));
    
        return new Promise((resolve, reject) => {
            let errorHandler = (err) => { ledOff(); reject(err); },
                successHandler = () => { console.log('enroll success'); resolve(); };
    
            open()
                .then(ledOn)
                .then(() => console.log('press finger'))
                .then(waitFinger)
                .then(start)
                .then(capture)
                .then(enroll1)
                .then(() => console.log('enroll 1 done'))
                .then(ledOff)
                .then(blinkDelay)
                .then(ledOn)
                .then(() => console.log('release finger'))
                .then(waitReleaseFinger)
            .then(enrollDelay)
                .then(() => console.log('press finger'))
                .then(waitFinger)
                .then(capture)
                .then(enroll2)
                .then(() => console.log('enroll 2 done'))
                .then(ledOff)
                .then(blinkDelay)
                .then(ledOn)
                .then(() => console.log('release finger'))
                .then(waitReleaseFinger)
            .then(enrollDelay)
                .then(() => console.log('press finger'))
                .then(waitFinger)
                .then(capture)
                .then(enroll3)
                .then(() => console.log('enroll 3 done'))
                .then(ledOff)
            .then(successHandler)
            .catch(errorHandler);
        });
    };
    
    let fps = new GT511CXX(GT511CXX.Devices.GT511C1R, Serial1);
    
    fps.enroll(0); // ID 0 means first storage slot .. slot has to be empty
    

    The enrollment function itself shows a lot of the usage i had in mind.
    It is more a series of module calls then a module function itself.. but the
    complete enrollment process was so tedious that i wanted to provide a solution with
    the module i guess.

    Btw. pretty much all of the code is based on the documents i found here:
    http://www.adh-tech.com.tw/files/GT-511C­3_datasheet_V1%201_20131127.pdf
    http://www.adh-tech.com.tw/files/GT-511C­1R_datasheet_V2-2016-10-25.pdf

    --- Edit ---
    About the profile size.. its 506 or 498 bytes depending on the sensor model.
    As far as i can see i already can handle the profiles.. but the fingerprint images the sensor
    can capture are in the order of 50kb.. and with that i had no luck. But before i could really dig in to it i destroyed my GT-511C1R.. but i was lucky.. my espruino wifi survived.

About

Avatar for PaddeK @PaddeK started