Block

From Lazer Swarm Wiki
Jump to navigation Jump to search

The Phoenix LTX Accessory Protocol uses blocks to transmit data.

Blocks have the following format:

Name Description
BType Block type
BDataN Block data (optional)
BSum Block checksum

Each element in the block is one 8-bit byte.

The checksum is calculated as follows:

  • Initialize the checksum to 0xFF.
  • Subtract each byte of block data from the checksum.
  • Underflows wrap around from 0x00 to 0xFF.

A simple way to verify the checksum is to subtract it as well. If it is valid, the result will be 0.