PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 1996
Posted: 01:38pm 19 Jun 2024
Well 8 bytes is the maximum but the packets can be shorter.
If there is data in the buffer, I read one character. if the character = &HAA, that's my header so this could be a packet
Read the next character If the character = my_node_address then looks like it's for me. If not, continue to read the data anyway (to empty the buffer) but don't do anything with it.
Read the next character In my case, this is a control byte;upper nibble = command, lower nibble = # of data-bytes to follow.
Read each data-byte
Final byte is checksum
Perform checksum and if all is good, execute the command on the Pico TX a status byte indicating good/bad checksum and other status info
Go back and wait for more Edited 2024-06-19 23:42 by PhenixRising