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.
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
MessageIDANY Number
: :MessageData
: : Checksumincludes messageID and Data
MessageLengthlength
EndByte180
How to read it
Use current method of storing the serial buffer. When an incoming byte equals
endbyte
then usingmessageLength
find thestartByte
. If found then read in the message (MessageID
andMessageData
) and do the checksum calculation. If thechecksum
is valid then pass themessageData
to the correct function using themessageID
for selecting the function via a switch statement.