SlicedSilver / iRduino

Interfaces between the iRacing API and an Arduino board. Can control displays, LEDs, buttons and much more. Supports custom iRacing Arduino projects.
GNU General Public License v2.0
18 stars 13 forks source link

New Serial Data Format #44

Closed SlicedSilver closed 11 years ago

SlicedSilver commented 11 years ago

Code a new serial data format that allows more than one different type of message to be sent. Split LEDS and Segments for TM Units messages. Each message should have its own arduino function for decoding. Need a queue system for sending serial messages that works with threading.

Proposed Serial Format

StartByte1 255 MessageID ANY Number : : MessageData : : Checksum includes messageID and Data MessageLength length EndByte 180

How to read it

Use current method of storing the serial buffer. When an incoming byte equals endbyte then using messageLength find the startByte. If found then read in the message (MessageID and MessageData) and do the checksum calculation. If the checksum is valid then pass the messageData to the correct function using the messageID for selecting the function via a switch statement.