helium / console-decoders

Payload decoder functions for console.
60 stars 62 forks source link

WINEX AN-106 codec error #38

Closed jjanderson closed 2 years ago

jjanderson commented 2 years ago

Hi,

I have been hunting for this everywhere, There was no documentation supplied with my device... grrr

I am however using chirpstack and am getting the following error:

"execute js error: js vm error: (anonymous): Line 14:24 Unexpected token * (and 4 more errors)"

here is the codec I am using:

function Decode(fPort, bytes)  {

var lat = ((bytes[0] << 16) | (bytes[1] << 8) | bytes[2])

if (lat & 0x800000)
    lat |= ~0xffffff;

var lon = ((bytes[3] << 16) | (bytes[4] << 8) | bytes[5])

if (lon & 0x800000)
    lon |= ~0xffffff;

  return {
    {latitude: lat / (2.**23 - 1) * 90,
    longitude: lon / (2.**23 - 1) * 180,
    altitude: (bytes[6] << 8) | bytes[7],
    accuracy: 0
};
}

I don't suppose you could let me know where I am going wrong?