Open joshtenorio opened 2 years ago
Current solution:
it is possible to transfer SPEED
and DAMPER
with only one byte of data, besides the parentheses.
The first bit transmits the status of the wheel's magnet sensor. Only 0 or 1. Calculations to convert that to actual speed can be done later.
The remaining 7 bits transfer a percentage of the damper's maximum extension. We know the maximum extension to be around 2.5 inches, so this percentage of extension can be converted to inches later.
T
can be eliminated as long as this is case is the only serial communication with one byte of data. The length of the communication can be used as an identifier.
Commas will be eliminated because only byte of information is passed.
Therefore, only 3 bytes will need to be passed: the two parentheses and the lone speed/damper byte.
Currently, serial communication between the Teensy boards is very slow (~8 Hz), likely due to the size of each packet.
Packets are encoded as strings, where each character in the string is a byte. The current packet format is:
where
T
is the type of data (1 byte),SPEED
is the wheel speed (~4 bytes) andDAMPER
is the damper travel (~4 bytes). This results in a packet that is about 13 bytes in length.One improvement that can be made is by redesigning the packet format to use less bytes per packet. This could entail using arrays of
uint8_t
and bit shifting/masking.