Hi Losant Team: I have a need to process incoming 16bit ints from a modbus device into 32bit integers and floats. I have put together a Javascript function that works in the application workflows, but times out when run on the edge.
Is this a bug or intended behavior? If intended, why does the edge workflow timeout overall (not the function node)?
This can be tested with the following function simply using a virtual button, function node, and a debug node.
let measuredValueLowWord = 18417; // 16-bit value at offset 4
let measuredValueHighWord = 8293; // 16-bit value at offset 5
let measuredValue32Bit = (measuredValueHighWord << 16) | measuredValueLowWord;
let buf = new ArrayBuffer(4)
let ints = new Uint16Array(buf)
ints[0] = measuredValueHighWord
ints[1] = measuredValueLowWord
let convertToFloat = new Float32Array(buf)
let measuredValue32Float = convertToFloat[0]
console.log(measuredValue32Float)
console.log(measuredValue32Bit)