Skip to content

Begin response confuses getVersion #32

Open
@philrittenhouse

Description

@philrittenhouse

This issue started when I noticed an intermittent failure of the camera getVersion() command. Adding some debug I found the verifyResponse was failing. In my case it was reading the string ‘Init end’ instead of the expected command response. The problem turned out to be the reset in begin() which triggers the camera to respond with:

VC0703 1.00
Ctrl infr exist
User-defined sensor
525
Init end

For anyone that is seeing a similar problem, as a work-around, I have found that running CamSerial.find("Init end") or just a 1 second delay after calling begin() will allow that output to be flushed out.

While exploring this issue I also realized that the getVersion() command only appeared to be working for me because it was returning the output of the begin() call before it. The problem was, as NickWaterton (https://github.com/NickWaterton) pointed out in his ticket ##12, the arg value for GEN_VERSION command should be 0x00 not 0x01. Also, the returned string needs to skip over the standard response header in order to return the version string.

Rather than use the work-around above, I have added the code to consume the "basic configuration information" to the reset() function itself. I have created a pull request to make these changes here: ##31

This is what my test code looks like:

  CamSerial.begin(38400, SERIAL_8N1, CAM1_RX, CAM1_TX, false, 20000UL);    
  delay(500);

  if (Cam.begin()) {
    Serial.println("Camera Found");
  } else {
    Serial.println("No camera found?");
    HACF();
    return false;
  }

  char *reply = Cam.getVersion();
  if (reply == 0) {
    Serial.print("Failed to get version");
  } else {
    Serial.printf("Version: %s\n", reply);
  }

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