Updated decoders

pull/1/head
Max-Plastix 2021-11-25 10:38:49 -08:00
rodzic 6a46b802b0
commit 04c18b51bd
3 zmienionych plików z 2 dodań i 43 usunięć

Wyświetl plik

@ -1,19 +0,0 @@
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;
}

Wyświetl plik

@ -1,22 +0,0 @@
// Decoder for TTGO_TBeam mapping
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.accuracy = bytes[8] / 10.0;
decoded.sats = bytes[9];
return decoded;
}

Wyświetl plik

@ -35,8 +35,8 @@ build_flags = -Wall
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
monitor_speed = 115200
monitor_port = COM17
upload_port = COM17
monitor_port = COM16
upload_port = COM16
lib_deps =
mcci-catena/MCCI LoRaWAN LMIC library @ ^4.0.0