Closed erinaceous closed 2 years ago
Hi erinaceous,
Thank you for providing this patch. It seems to work fine and I included your contribution into the master branch. Also, now I know what those 17 bytes that follow the ascii header, are meant for :-)
Thanks a lot!
Addressing #6!
Was expecting to have to deal with lots of segfaults but refreshing my C less painful than anticipated :)
In
read_sensor_value
the bit-shifting stuff where floats and doubles were being read into one byte at a time, I replaced with calls tofread
- that appears to work fine with all the.[ts]bd
files I've thrown at it on our dockserver (mostly G2s, with 3 G3s). If the magic number0x1234
isn't read from the third field in the "known bytes binary cycle" (aint16
), the values read are byte-swapped before they're cast to doubles.Have added an example tbd/sbd pair from
unit_887
which is a G3 with the different byte-order.Also I've never seen them used before, but apparently the format also supports sending back
shorts
, so added that in.