diff --git a/net_io.c b/net_io.c index 20a7ffd..d72ce6e 100644 --- a/net_io.c +++ b/net_io.c @@ -1187,6 +1187,8 @@ char *generateAircraftJson(const char *url_path, int *len) { p += snprintf(p, end-p, "\n {\"hex\":\"%s%06x\"", (a->addr & MODES_NON_ICAO_ADDRESS) ? "~" : "", a->addr & 0xFFFFFF); if (a->addrtype != ADDR_ADSB_ICAO) p += snprintf(p, end-p, ",\"type\":\"%s\"", addrtype_short_string(a->addrtype)); + if (a->adsb_version >= 0) + p += snprintf(p, end-p, ",\"version\":%d", a->adsb_version); if (trackDataValid(&a->squawk_valid)) p += snprintf(p, end-p, ",\"squawk\":\"%04x\"", a->squawk); if (trackDataValid(&a->callsign_valid)) @@ -2055,6 +2057,10 @@ static void writeFATSV() p += snprintf(p, bufsize(p, end), "\taddrtype\t%s", addrtype_short_string(a->addrtype)); } + if (a->adsb_version >= 0) { + p += snprintf(p, bufsize(p, end), "\tadsb_version\t%d", a->adsb_version); + } + if (trackDataValidEx(&a->callsign_valid, now, 35000, SOURCE_MODE_S) && strcmp(a->callsign, " ") != 0 && a->callsign_valid.updated > a->fatsv_last_emitted) { p += snprintf(p, bufsize(p,end), "\tident\t%s", a->callsign); memcpy(a->fatsv_emitted_callsign, a->callsign, sizeof(a->fatsv_emitted_callsign)); diff --git a/public_html/index.html b/public_html/index.html index 62d5a39..e479197 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -219,6 +219,8 @@
Alt setting:
+
ADS-B:
+
diff --git a/public_html/planeObject.js b/public_html/planeObject.js index 2269174..1d6eace 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -26,6 +26,7 @@ function PlaneObject(icao) { this.alt_setting = null; this.baro_rate = null; this.geom_rate = null; + this.version = null; this.prev_position = null; this.position = null; @@ -468,6 +469,8 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) { this.squawk = data.squawk; if (typeof data.category !== "undefined") this.category = data.category; + if (typeof data.version !== "undefined") + this.version = data.version; if (typeof data.lat !== "undefined") { this.position = [data.lon, data.lat]; diff --git a/public_html/script.js b/public_html/script.js index a6d8c69..c6d2cc8 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -939,9 +939,21 @@ function refreshSelected() { $('#selected_true_heading').text(format_track_long(selected.true_heading)); $('#selected_ias').text(format_speed_long(selected.ias, DisplayUnits)); $('#selected_tas').text(format_speed_long(selected.tas, DisplayUnits)); - $('#selected_mach').text(selected.mach.toFixed(3)); - $('#selected_roll').text(selected.roll.toFixed(2)); - $('#selected_track_rate').text(selected.track_rate.toFixed(2)); + if (selected.mach == null) { + $('#selected_mach').text('n/a'); + } else { + $('#selected_mach').text(selected.mach.toFixed(3)); + } + if (selected.roll == null) { + $('#selected_roll').text('n/a'); + } else { + $('#selected_roll').text(selected.roll.toFixed(1)); + } + if (selected.track_rate == null) { + $('#selected_track_rate').text('n/a'); + } else { + $('#selected_track_rate').text(selected.track_rate.toFixed(2)); + } $('#selected_geom_rate').text(format_vert_rate_long(selected.geom_rate, DisplayUnits)); if (selected.alt_setting == null) { $('#selected_alt_setting').text("n/a"); @@ -950,6 +962,18 @@ function refreshSelected() { } $('#selected_intent_alt').text(format_altitude_long(selected.intent_alt, 0, DisplayUnits)); $('#selected_intent_heading').text(format_track_long(selected.intent_heading)) + + if (selected.version == null) { + $('#selected_version').text('none'); + } else if (selected.version == 0) { + $('#selected_version').text('v0 (DO-260)'); + } else if (selected.version == 1) { + $('#selected_version').text('v1 (DO-260A)'); + } else if (selected.version == 2) { + $('#selected_version').text('v2 (DO-260B)'); + } else { + $('#selected_version').text('v' + selected.version); + } } function refreshHighlighted() {