I was wondering if its possible to make an expression to take the 16-bit two’s complement of a binary number in the Math Node? Or would that require a function node to do it in Javascript?

I have integers that represent two’s complement encoding and I need to reverse that. E.g. 65437 is in my payload and that should be converted to -99.

A Function Node would be the way to go at the moment - we don’t have any operators in the Math Node that deal with binary data. A good request, though - we are seeing a number of requests for easier manipulation of binary data, so we will probably address that with a workflow node at some point in the future!

1 Like

That would be good.

We have a number of devices that have multiple binary states in a single 16bit register. (from modbus)

Being able to pull that apart more easily so that we get a each individual bit state mapped to a property would be great

T

1 Like