External library stuck in infinite loop - How to edit

Hello, I'm using the Adafruit_PN532 library for a simple RFID card reader setup. The script appears to be stuck trying to perform some function referenced in the library and won't continue with the rest of my void loop. (Or at least that's what I think is going on because the code in my main loop [referenced below] only prints "Void loop test point 1" to the serial monitor.)

However, once a card is detected, the script will continue through the full void loop but once again freeze at the nfc.readPassiveTargetID() function.

My goal is to adjust the timeout so the rest of my script can continue unimpeded, which I need it to do in order to detect button presses. Thanks for any advice you can give me. I'm afraid I just don't understand C well enough yet to fully grasp the syntax and flow of the language to be able to tinker with this on my own. Here's some extractions of the relevant sections from the .h and .cpp files. But first, my main void loop:

(Note: the comments are provided in the iso1443a_uid example sketch included with the library)

void loop(void) {
  Serial.println("loop began");
  boolean success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID
  uint8_t uidLength;               // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

  Serial.println("Void loop test point 1");
  // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);
  Serial.println("Void loop test point 2");

Here's the section in the .cpp file that references the "readPassiveTargetID function:

/**************************************************************************/
/*!
    Sets the MxRtyPassiveActivation byte of the RFConfiguration register

    @param  maxRetries    0xFF to wait forever, 0x00..0xFE to timeout
                          after mxRetries

    @returns 1 if everything executed properly, 0 for an error
*/
/**************************************************************************/
bool Adafruit_PN532::setPassiveActivationRetries(uint8_t maxRetries) {
  pn532_packetbuffer[0] = PN532_COMMAND_RFCONFIGURATION;
  pn532_packetbuffer[1] = 5;    // Config item 5 (MaxRetries)
  pn532_packetbuffer[2] = 0xFF; // MxRtyATR (default = 0xFF)
  pn532_packetbuffer[3] = 0x01; // MxRtyPSL (default = 0x01)
  pn532_packetbuffer[4] = maxRetries;

  #ifdef MIFAREDEBUG
    PN532DEBUGPRINT.print(F("Setting MxRtyPassiveActivation to ")); PN532DEBUGPRINT.print(maxRetries, DEC); PN532DEBUGPRINT.println(F(" "));
  #endif

  if (! sendCommandCheckAck(pn532_packetbuffer, 5))
    return 0x0;  // no ACK

  return 1;
}

and here in the .h file:

// ISO14443A functions
  bool readPassiveTargetID(uint8_t cardbaudrate, uint8_t * uid, uint8_t * uidLength, uint16_t timeout = 0); //timeout 0 means no timeout - will block forever.
  // my comment: I changed the 0 to a 1 in the above to circumvent the stall. but it didn't work
  bool inDataExchange(uint8_t * send, uint8_t sendLength, uint8_t * response, uint8_t * responseLength);
  bool inListPassiveTarget();

Any suggestions?

// my comment: I changed the 0 to a 1 in the above to circumvent the stall. but it didn't work

That was the wrong thing to do. The proper thing to do is to pass a non-zero value to the function when you call it.

I'd post the rest of the answer, but you didn't post ALL of your code...

PaulS: That was the wrong thing to do. The proper thing to do is to pass a non-zero value to the function when you call it.

I'd post the rest of the answer, but you didn't post ALL of your code...

Thank you for all of this! I finally figured this out, and in the process realized why it's important to post ALL of my code! :)

Turns out, there is another variable in my sketch that sets the maximum number of retries to make, and it was set to 'indefinite' LOL. It seems obvious, but before this, I didn't even know what a .h or .cpp file was! So I thought the problem had to do with modifying the library.

This little problem taught me how to navigate .h and .cpp files, how they work, syntax for calling functions from libraries, hexadecimal notation, octal notation (the perils of not learning with perfect efficiency), function return datatypes, etc.

Anyway, your suggestion was enough to boost me back into productivity and I learned a ton more than if you had just given me the answer. Thanks a bunch!

Anyway, your suggestion was enough to boost me back into productivity and I learned a ton more than if you had just given me the answer. Thanks a bunch!

I like that attitude. Thank you!