Skip to content

Want support for transferring bytes() #52

@PaulBouchier

Description

@PaulBouchier

bytes() is its own type in python3, and is common enough IMHO that pySerialTransfer should support it. Since bytes() do not need packing with struct.pack(), the proposed solution is to change the logic in txObj to check for type(val) == bytes and not attempt to pack it.

Currently, byte strings must be unpacked into ints then passed in with one call to txObj per byte, giving val_type_override as:
send_size = link.tx_obj(self.left_drive_pct, val_type_override='b')

The alternative - to send values as ints and convert them to bytes on the Arduino side, would consume 4X the bandwidth on the serial link.

Thoughts? I am willing to contribute this fix in a pull request if you support the idea.

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