Ask Your Question

Revision history [back]

The basic idea is to grab the 2-byte value and only add it to the tree after some computation is performed on it. Below is a simple Lua snippet to illustrate the idea and assumes the byte-order is big-endian (use le_uint() instead of uint() if it's little-endian:

abc = buf(offset, 2):uint()
abc_tree:add(f_abc, buf(offset, 2)):set_text(string.format("ABC: %f", -5.0 + (abc * 65.0/65535)))

The basic idea is to grab the 2-byte value and only add it to the tree after some computation is performed on it. Below is a simple Lua snippet to illustrate the idea and assumes the byte-order is big-endian (use le_uint() instead of uint() if it's little-endian:little-endian):

abc = buf(offset, 2):uint()
abc_tree:add(f_abc, buf(offset, 2)):set_text(string.format("ABC: %f", -5.0 + (abc * 65.0/65535)))