From bb227b525b582c7efb23e7d5977af958252bdd64 Mon Sep 17 00:00:00 2001 From: nerdyscout Date: Thu, 21 Nov 2019 17:04:55 +0000 Subject: [PATCH] additional decoder for short latLon on port4 --- src/TTN/packed_decoder.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TTN/packed_decoder.js b/src/TTN/packed_decoder.js index bf2c3b39..0624d885 100644 --- a/src/TTN/packed_decoder.js +++ b/src/TTN/packed_decoder.js @@ -50,7 +50,11 @@ function Decoder(bytes, port) { if (port === 4) { // gps data - return decode(bytes, [latLng, latLng, uint8, hdop, altitude], ['latitude', 'longitude', 'sats', 'hdop', 'altitude']); + if (bytes.length === 8) { + return decode(bytes, [latLng, latLng], ['latitude', 'longitude']); + } else { + return decode(bytes, [latLng, latLng, uint8, hdop, altitude], ['latitude', 'longitude', 'sats', 'hdop', 'altitude']); + } } if (port === 5) {