diff --git a/html/formatter.js b/html/formatter.js index ec032df..99cd008 100644 --- a/html/formatter.js +++ b/html/formatter.js @@ -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]; diff --git a/html/planeObject.js b/html/planeObject.js index 65bde92..eced2b3 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -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));