-
-
Save felixerdy/f959ac03df98c6947f1c7f35d537f23e to your computer and use it in GitHub Desktop.
Decoder for TTN Mapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Decoder(b, port) { | |
var lat = (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)) / 10000000; | |
var lon = (b[4] | (b[5] << 8) | (b[6] << 16) | (b[7] << 24)) / 10000000; | |
var alt = (b[8] | (b[9] << 8)) / 10; // in m | |
var pdop = (b[10] | (b[11] << 8)) / 100; | |
return { | |
latitude: lat, | |
longitude: lon, | |
altitude: alt, | |
hdop: pdop, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment