Skip to content

SerialTransfer should support packets with 0 data bytes #88

@PaulBouchier

Description

@PaulBouchier

Is your feature request related to a problem? Please describe.
There are use cases where the arrival of a packet of a certain type in and of itself indicates what should happen. E.g. reboot, or ping (reply with pong).

Describe the solution you'd like
A packet received with 0 length payload data should be processed and cause the appropriate callback to be taken / message to be made available. The problem starts in line 167 of packet.cpp:
if ((recChar > 0) && (recChar <= MAX_PACKET_SIZE))
If recChar (the payload length) is 0, it goes back to find_start_byte state and declares a PAYLOAD_ERROR. IMHO the check for recChar > 0 shouldn't be there, or maybe if recChar is 0 it should jump straight to find_crc state

Describe alternatives you've considered
The workaround I'm currently using is to send a dummy int in the reboot and ping messages

Additional context
Add any other context or screenshots about the feature request here.

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