From 551737cc89fdf0f68f5aac111cfcb6c451eb484f Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Tue, 18 Dec 2018 10:43:59 +0100 Subject: [PATCH] plain_decoder.js: bugfix --- src/TTN/plain_decoder.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/TTN/plain_decoder.js b/src/TTN/plain_decoder.js index 17ce3f41..6534fb83 100644 --- a/src/TTN/plain_decoder.js +++ b/src/TTN/plain_decoder.js @@ -30,6 +30,15 @@ function Decoder(bytes, port) { decoded.reset1 = bytes[i++]; } + if (port === 4) { + var i = 0; + decoded.latitude = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]); + decoded.longitude = ((bytes[i++] << 24) | (bytes[i++] << 16) | (bytes[i++] << 8) | bytes[i++]); + decoded.sats = bytes[i++]; + decoded.hdop = (bytes[i++] << 8) | (bytes[i++]); + decoded.altitude = (bytes[i++] << 8) | (bytes[i++]); + } + if (port === 5) { var i = 0; decoded.button = bytes[i++];