Giter Site home page Giter Site logo

Upload template to AS608 about fpm HOT 3 CLOSED

brianrho avatar brianrho commented on July 18, 2024
Upload template to AS608

from fpm.

Comments (3)

brianrho avatar brianrho commented on July 18, 2024

Are you using the default example? No change at all except to change the BUFF_SZ?
Can you post your entire serial output/log?

from fpm.

farhad3113 avatar farhad3113 commented on July 18, 2024

No, it's not the default example.
I found out that templates move successfully to a new place and I can access them in that new fid but it returns "packet too long:130"

my functions:

bool uploadTemplate(uint16_t fid, uint8_t * buff, uint16_t buff_sz){
    #ifdef DEBUG_MODE
      debugSerial.println("[debug] ==== Upload FingerPrint ====");
    #endif
    uint16_t p = -1;
    p = finger.uploadModel(fid);
    if(p != FPM_OK){
        #ifdef DEBUG_MODE
          debugSerial.println("[debug] FPM: Error in Upload!");
        #endif
        return false;
    } 
    yield();
    finger.writeRaw(buff, buff_sz);
    
    p = finger.storeModel(fid);
    if(p != FPM_OK){
        #ifdef DEBUG_MODE
          debugSerial.println("[debug] FPM: Error in Store!");
        #endif
        return false;
    } 
    return true;
}



uint16_t donwloadTemplate(uint16_t fid, uint8_t *buff, uint16_t buff_sz){
    #ifdef DEBUG_MODE
      debugSerial.println("[debug] ==== Download FingerPrint ====");
    #endif
    uint16_t p = -1;
    p = finger.loadModel(fid);
    if(p != FPM_OK){
        #ifdef DEBUG_MODE
          debugSerial.println("[debug] FPM: Error in Load Model!");
        #endif
        return 0;
    }
    p = finger.downloadModel();
    if(p != FPM_OK){
        #ifdef DEBUG_MODE
          debugSerial.println("[debug] FPM: Error in Download!");
        #endif
        return 0;
    }
    bool read_finished;
    int16_t count = 0;
    uint16_t readlen = buff_sz;
    uint16_t pos = 0;
    while (true) {
        bool ret = finger.readRaw(FPM_OUTPUT_TO_BUFFER, buff+pos, &read_finished, &readlen);
        if (ret) {
            count++;
            pos += readlen;
            readlen = buff_sz - pos;
            if (read_finished) { break; }
        }
        else {
            #ifdef DEBUG_MODE
              debugSerial.printf("[debug] FPM: Error in receiving packet %u\n!", count);
            #endif
            return 0; 
        }
        yield();
    }
    uint16_t total_bytes = count * FPM::packet_lengths[params.packet_len];
    return total_bytes;
}

from fpm.

brianrho avatar brianrho commented on July 18, 2024

If you enable DEBUG prints in the midst of the template transfer itself, it can cause the process to fail as the sensor sends data faster than the MCU is processing it (because of your print statements). First try with the default templates example as is, and see if that works. If it doesn't, post the output from your serial monitor, not your sketch.
But if it works, then try with your own sketch without debug enabled. Whatever the result, provide the serial logs.

from fpm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.