LogAir_Application_XOS issueshttps://gitlab.unige.ch/Maya.Boeckh/la_app_xos/-/issues2020-02-26T15:26:27Zhttps://gitlab.unige.ch/Maya.Boeckh/la_app_xos/-/issues/4Modify firmware data stream2020-02-26T15:26:27ZMaya BoeckhModify firmware data streamRender packets lightweight.
Data stream is ASCII, which means it interprets 2 bytes at a time to create "Text" -> Loss of data/efficiency
Implement new data model, where sent bitwise. :
| 8 bits | n bits | 32 bits | 32 bits | 16 bits...Render packets lightweight.
Data stream is ASCII, which means it interprets 2 bytes at a time to create "Text" -> Loss of data/efficiency
Implement new data model, where sent bitwise. :
| 8 bits | n bits | 32 bits | 32 bits | 16 bits |
| --- | --- | --- | --- | --- |
| # specifiers =: n | non-zero or -null mapping | specifier type(float) | specifier type(int) | CRC_16 |
For any packet, such as the `[,,,,,32.3,68.4,101154.1,,276,,279$`, we would represent it as the following :
(Using `CRC_16\ARC`, `polynomial := 0b1000000000000101`, `init := 0b0000000000000000`)
=> `[ | 12 packets | [∅, ∅, ∅, ∅, ∅, x, x, x, ∅, x, ∅, x], 32.3, 68.4, 101154.1, 276, 279 | CRC_16 | $`
=> `[ | 00001100 | 000001110101 | 01000010000000010011001100110011, 01000010100010001100110011001101, 01000111110001011001000100001101, 00000000000000000000000100010100, 00000000000000000000000100010111 | CRC_16 | $`
=> `[ | 000011000000011101010100001000000001001100110011001101000010100010001100110011001101010001111100010110010001000011010000000000000000000000010001010000000000000000000000000100010111 | CRC_16 | $`
Then we 0 pad to a multiple of 8. => `[ | 0000000011000000011101010100001000000001001100110011001101000010100010001100110011001101010001111100010110010001000011010000000000000000000000010001010000000000000000000000000100010111 | CRC_16 | $`
Then we calculate the CRC value =>
`[ | 00000000110000000111010101000010000000010011001100110011010000101000100011001100110011010100011111000101100100010000110100000000000000000000000100010100000000000000000000000001000101110111001100110011 | $`
Then for each group of 8 bits, we convert to a ASCII character, in the end we have a string -> `[\x00ÀuB\x0133B\x88ÌÍGÅ\x91\r\x00\x00\x01\x14\x00\x00\x01\x17s3$` which is 54 bytes long, compared to the 70 bytes originally, but with added integrity check.
For a full packet, we can expect floats to take (32+1 bits) opposed to (5*8 bits) in a normal packet.
We lose compressability with integer representation, but that enables fast splitting and decoding.
CRC code to get started : https://gitlab.unige.ch/Nicolas.Boeckh/ftp-server-client/blob/master/common/crc.c
Attached is the C code to obtain an IEEE 756 representation of a floating point number.
[float.c](/uploads/23d7c16306a0362e45c29df190c7dba4/float.c)
Have fun.0.1.1Emmanuel KellnerEmmanuel Kellner