ATTAG handshake between blaster and host part 2

My intentions to keep the communication as small as possible reached some insane level I guess. After I got mad about some limits of C++ that really made me angry (Goddamn I am not a programmer.) I came to the conclusion that 1 byte is enough for the talk between blaster and host. As follows:

A byte contains 8 bits. I will use the first 4 bits to identify the blaster as 4 bits can describe 2^4 states. The 5th bit will describe the status and the remaining bits will be used as identification as ATTAG.

Why so short? Speed and reduction of possible transmission errors.

I am not yet sure if this will make any sense at the end but to run the HC-12 even at very low baudrates, it makes sense to keep the traffic as low as possible.

// the first player 0 starts at decimal 7, the binary code 0000 0111
// the first 4 bits are the player id, the 5th bit describes status available=0 and ready=1
// the last 3 bits 111 stay as identification of attag
// the next player 1 with status "available" is baseplayer+16=23 
// the status ready for that player then is baseplayer+24=31

// get the playerid from a potvalue later
playerid=4; // just for simulation now

int baseplayer=7; // player zero
int pavailable=baseplayer+playerid*16; 
int pready=baseplayer+playerid*16+8;

Leave a Reply

Your email address will not be published. Required fields are marked *