message rate / binCraft mods

This commit is contained in:
Matthias Wirth
2022-09-16 12:58:24 +02:00
parent ce4be3ddbd
commit 7b8fb3286e
2 changed files with 18 additions and 7 deletions

View File

@@ -403,12 +403,12 @@ function wqi(data) {
const INT32_MAX = 2147483647;
const buffer = data.buffer;
//console.log(buffer);
let vals = new Uint32Array(data.buffer, 0, 8);
data.now = vals[0] / 1000 + vals[1] * 4294967.296;
let u32 = new Uint32Array(data.buffer, 0, 11);
data.now = u32[0] / 1000 + u32[1] * 4294967.296;
//console.log(data.now);
let stride = vals[2];
data.global_ac_count_withpos = vals[3];
data.globeIndex = vals[4];
let stride = u32[2];
data.global_ac_count_withpos = u32[3];
data.globeIndex = u32[4];
let limits = new Int16Array(buffer, 20, 4);
data.south = limits[0];
@@ -416,12 +416,14 @@ function wqi(data) {
data.north = limits[2];
data.east = limits[3];
data.messages = vals[7];
data.messages = u32[7];
let s32 = new Int32Array(data.buffer, 0, stride / 4);
let receiver_lat = s32[8] / 1e6;
let receiver_lon = s32[9] / 1e6;
const binCraftVersion = u32[10];
if (receiver_lat != 0 && receiver_lon != 0) {
//console.log("receiver_lat: " + receiver_lat + " receiver_lon: " + receiver_lon);
let position = {
@@ -485,7 +487,12 @@ function wqi(data) {
ac.tas = u16[28];
ac.ias = u16[29];
ac.rc = u16[30];
ac.messages = u16[31];
if (globeIndex && binCraftVersion >= 20220916) {
ac.messageRate = u16[31] / 10;
} else {
ac.messages = u16[31];
}
ac.category = u8[64] ? u8[64].toString(16).toUpperCase() : undefined;
ac.nic = u8[65];

View File

@@ -1517,6 +1517,10 @@ PlaneObject.prototype.updateData = function(now, last, data, init) {
}
this.messages = data.messages;
if (data.messageRate != null) {
this.messageRate = data.messageRate;
}
if (data.rssi != null && data.rssi > -49.4) {
if (!globeIndex && this.rssi != null && RefreshInterval < 1500) {
let factor = Math.min(1, Math.log(2 - RefreshInterval / 1500));