Skip to content

Switch start sequence away from using 3 zeros #99

@Elan456

Description

@Elan456

Currently, the start sequence uses three 0x00 bytes followed by a single distinct byte of 0x33.

The 0x00 bytes can be generated for many reasons, not just MARTHA trying to do a start sequence, which can cause the ground station to start parsing packets incorrectly. It's not a very distinct signal for the ground station to pick out.

Better Alternative

I propose that we should switch the start bytes from 0x00 0x00 0x00 0x33 to instead be the ASCII values for CURE which is:

0x43 0x55 0x52 0x45

It is far less likely to appear accidentally in the payload data.

Best Alternative

You can use COBS to entirely eliminate the problem by reserving a specific byte as the "delimiter" and then whenever that byte shows up in the payload, you replace that byte with the offset to the next byte that also was that special byte.

Here is an example where the reserved delimiter is 0xEE:

Packet (not encoded)

-- AA BB EE 05 C3 12 EE 04 01 EE <-- The EE at the end is the delimiter to separate from the next packet

The other EEs I put in the packet are to show examples where the payload contains the special delimiter, which would cause packet parsing issues if not handled.

Packet encoded

03 AA BB 04 05 C3 12 03 04 01 EE

The 03 at the start is the first offset to the first EE that appears in the payload.
Then, where the EE should be, is the offset to the next EE.
That continues until it hits the last EE.

The Wikipedia article linked above has more examples.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions