Can someone please explain me the meaning of various terms like "idx, "sdx", "cmd" etc in the T2Message protocol, and also explain how the header and data payload information is extracted from this protocol at the receiving side.
The Talk2 Protocol is just a example/template which can be used to format your message. It basically slices the payload into small bits. You still can use the standard Radiohead library and format your payload the way you prefer.
Here a quick description:
29 bits to Headers
8 bytes to Payload
This has been selected to be compatible with CAN Bus message limitations.
In the headers you'll find the idx, sidx, cmd, src and dst.
IDX is a 3 bits, which can be used as a main filter for the message type
CMD is a 2 bit filed, which can be used to carry the command, like write, read, alert,
SIDX, is a 8 bits, it's the sub-type of a message.
SRC and DST are 8 bits files, to identify the source and destination.
Again, you don't need to use the Talk2 Message format, but you could use for example to format messages in your application:
IDX: 0x01 (Sensors)
SIDX: 0x0A (Temperature)
CMD: 0x01 (READ)
SRC: 0x99 (The node which is sending the info)
DST: 0x10 (The destination node)
MSG: 0x1234 (The temperature itself)
Now, you can create logic around those fields to filter and take action once the message is received.
All details about how the fields are created can be found on T2Message.h/T2Message.cpp - The message format is used on our examples so you can better understand how you could use those "free" fields.
Hi Lucky. I believe I spoke to you earlier. Just to share with other users, the easiest way to handle floating number is by not dealing with it ;)
For example, instead of trying to transmit 21.75, just for 21.75 * 100 and transmit 2175. Even better, when converting your data from the sensor strip out the need for a float variable by multiplying it by 10, 100 or 1000 for example.
Once you have, for example a uint16_t variable, you can unload it into the message by using bitshift operations: