Skip to content

Writes get truncated at 255 characters #84

Description

@hb020

I can't believe I didn't catch this earlier. This is a serious and trivial bug for my use, where I can send much more than 255 characters.

Prologix is limited to 127 characters in the present implementation, and will have all kinds of problems when you get over that limit: You'll get an EOI in the middle of a command, etc.
I'm not addressing that issue for now, I'm addressing the issue for my use case.

Simple uint8_t to uint16_t change.

void GPIBbus::sendData(const char *data, uint8_t dsize, bool isLastPacket)

should be

void GPIBbus::sendData(const char *data, uint16_t dsize, bool isLastPacket)

And while you're at it, you may want to do this in sendData():

#ifdef DEBUG_GPIBbus_SEND
    DB_RAW_PRINT(data[i]);
#endif

    if (state != HANDSHAKE_COMPLETE) break;
  }

#ifdef DEBUG_GPIBbus_SEND
  DB_PRINT(F("<- End of send loop."), "");
#endif

does not catch an abort. It is better when you do this:

#ifdef DEBUG_GPIBbus_SEND
    DB_RAW_PRINT(data[i]);
#endif

    if (state != HANDSHAKE_COMPLETE) {
#ifdef DEBUG_GPIBbus_SEND
      DB_RAW_PRINT("\n");
      DB_PRINT(F("ERR: Writing aborted at character "), i);
      DB_PRINT(F("End of send loop. State: "), state);
#endif
      break;
    }
  }

#ifdef DEBUG_GPIBbus_SEND
  DB_RAW_PRINT("\n");
  DB_PRINT(F("<- End of send loop."), "");
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions