Added Libs and TTN Decoder
This commit is contained in:
parent
66681b4ce1
commit
f657340655
BIN
libs/AXP202X_Library.zip
Normal file
BIN
libs/AXP202X_Library.zip
Normal file
Binary file not shown.
BIN
libs/TinyGPSPlus.zip
Normal file
BIN
libs/TinyGPSPlus.zip
Normal file
Binary file not shown.
BIN
libs/arduino-lmic.zip
Normal file
BIN
libs/arduino-lmic.zip
Normal file
Binary file not shown.
BIN
libs/esp8266-oled-ssd1306.zip
Normal file
BIN
libs/esp8266-oled-ssd1306.zip
Normal file
Binary file not shown.
20
thethingsnetwork/decoder.txt
Normal file
20
thethingsnetwork/decoder.txt
Normal file
@ -0,0 +1,20 @@
|
||||
function Decoder(bytes, port) {
|
||||
var decoded = {};
|
||||
|
||||
decoded.latitude = ((bytes[0]<<16)>>>0) + ((bytes[1]<<8)>>>0) + bytes[2];
|
||||
decoded.latitude = (decoded.latitude / 16777215.0 * 180) - 90;
|
||||
|
||||
decoded.longitude = ((bytes[3]<<16)>>>0) + ((bytes[4]<<8)>>>0) + bytes[5];
|
||||
decoded.longitude = (decoded.longitude / 16777215.0 * 360) - 180;
|
||||
|
||||
var altValue = ((bytes[6]<<8)>>>0) + bytes[7];
|
||||
var sign = bytes[6] & (1 << 7);
|
||||
if(sign) decoded.altitude = 0xFFFF0000 | altValue;
|
||||
else decoded.altitude = altValue;
|
||||
|
||||
decoded.hdop = bytes[8] / 10.0;
|
||||
decoded.sats = bytes[9];
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user