From c7855c5ab690092bcfacfd1b89029c0b4b732757 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Thu, 15 Jun 2017 22:36:23 +0100 Subject: [PATCH] Feed more data to skyview, basic display updates. --- net_io.c | 18 ++++++++-- public_html/index.html | 56 +++++++++++++++++++++++++++++-- public_html/planeObject.js | 69 +++++++++++++++++++++++++++++--------- public_html/script.js | 27 ++++++++++++--- 4 files changed, 146 insertions(+), 24 deletions(-) diff --git a/net_io.c b/net_io.c index 59ea606..20a7ffd 100644 --- a/net_io.c +++ b/net_io.c @@ -1113,8 +1113,16 @@ static char *append_flags(char *p, char *end, struct aircraft *a, datasource_t s p += snprintf(p, end-p, "\"altitude\","); if (a->track_valid.source == source) p += snprintf(p, end-p, "\"track\","); + if (a->mag_heading_valid.source == source) + p += snprintf(p, end-p, "\"mag_heading\","); + if (a->true_heading_valid.source == source) + p += snprintf(p, end-p, "\"true_heading\","); if (a->gs_valid.source == source) - p += snprintf(p, end-p, "\"speed\","); + p += snprintf(p, end-p, "\"gs\","); + if (a->ias_valid.source == source) + p += snprintf(p, end-p, "\"ias\","); + if (a->tas_valid.source == source) + p += snprintf(p, end-p, "\"tas\","); if (a->baro_rate_valid.source == source) p += snprintf(p, end-p, "\"baro_rate\","); if (a->geom_rate_valid.source == source) @@ -1191,7 +1199,7 @@ char *generateAircraftJson(const char *url_path, int *len) { if (trackDataValid(&a->altitude_valid)) p += snprintf(p, end-p, ",\"altitude\":%d", a->altitude); if (trackDataValid(&a->altitude_geom_valid)) - p += snprintf(p, end-p, ",\"altitude_geom\":%d", a->altitude_geom); + p += snprintf(p, end-p, ",\"alt_geom\":%d", a->altitude_geom); } if (trackDataValid(&a->baro_rate_valid)) p += snprintf(p, end-p, ",\"baro_rate\":%d", a->baro_rate); @@ -1217,6 +1225,12 @@ char *generateAircraftJson(const char *url_path, int *len) { p += snprintf(p, end-p, ",\"roll\":%.1f", a->roll); if (trackDataValid(&a->category_valid)) p += snprintf(p, end-p, ",\"category\":\"%02X\"", a->category); + if (trackDataValid(&a->intent_altitude_valid)) + p += snprintf(p, end-p, ",\"intent_alt\":%d", a->intent_altitude); + if (trackDataValid(&a->intent_heading_valid)) + p += snprintf(p, end-p, ",\"intent_heading\":%.1f", a->intent_heading); + if (trackDataValid(&a->alt_setting_valid)) + p += snprintf(p, end-p, ",\"alt_setting\":%.1f", a->alt_setting); p += snprintf(p, end-p, ",\"mlat\":"); p = append_flags(p, end, a, SOURCE_MLAT); diff --git a/public_html/index.html b/public_html/index.html index 1a2acbc..62d5a39 100644 --- a/public_html/index.html +++ b/public_html/index.html @@ -170,11 +170,63 @@ - + + +
+
+
Alt (geom):
+
+
Geom rate:
+
+
+
+ +
+
+
Mag heading:
+
+
True heading:
+
+
+
+
Roll:
+
+
Track rate:
+
+
+
+ +
+
+
IAS:
+
+
TAS:
+
+
+
+
Mach:
+
+
+
+ +
+
+
AP alt:
+
+
AP heading:
+
+
+
+
Alt setting:
+
+
+
+ +
AirFrames.org - + diff --git a/public_html/planeObject.js b/public_html/planeObject.js index a0df910..2269174 100644 --- a/public_html/planeObject.js +++ b/public_html/planeObject.js @@ -10,9 +10,23 @@ function PlaneObject(icao) { this.category = null; // Basic location information - this.altitude = null; - this.speed = null; - this.track = null; + this.altitude = null; + this.alt_geom = null; + this.gs = null; + this.ias = null; + this.tas = null; + this.track = null; + this.track_rate = null; + this.mag_heading = null; + this.true_heading = null; + this.mach = null; + this.roll = null; + this.intent_alt = null; + this.intent_heading = null; + this.alt_setting = null; + this.baro_rate = null; + this.geom_rate = null; + this.prev_position = null; this.position = null; this.position_from_mlat = false @@ -417,13 +431,44 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) { this.addrtype = 'adsb_icao'; if (typeof data.altitude !== "undefined") - this.altitude = data.altitude; - if (typeof data.vert_rate !== "undefined") - this.vert_rate = data.vert_rate; - if (typeof data.speed !== "undefined") - this.speed = data.speed; + this.altitude = data.altitude; + if (typeof data.alt_geom !== "undefined") + this.alt_geom = data.alt_geom; + if (typeof data.gs !== "undefined") + this.gs = data.gs; + if (typeof data.ias !== "undefined") + this.ias = data.ias; + if (typeof data.tas !== "undefined") + this.tas = data.tas; if (typeof data.track !== "undefined") - this.track = data.track; + this.track = data.track; + if (typeof data.track_rate !== "undefined") + this.track_rate = data.track_rate; + if (typeof data.mag_heading !== "undefined") + this.mag_heading = data.mag_heading; + if (typeof data.true_heading !== "undefined") + this.true_heading = data.true_heading; + if (typeof data.mach !== "undefined") + this.mach = data.mach; + if (typeof data.roll !== "undefined") + this.roll = data.roll; + if (typeof data.intent_alt !== "undefined") + this.intent_alt = data.intent_alt; + if (typeof data.intent_heading !== "undefined") + this.intent_heading = data.intent_heading; + if (typeof data.alt_setting !== "undefined") + this.alt_setting = data.alt_setting; + if (typeof data.baro_rate !== "undefined") + this.baro_rate = data.baro_rate; + if (typeof data.geom_rate !== "undefined") + this.geom_rate = data.geom_rate; + if (typeof data.flight !== "undefined") + this.flight = data.flight; + if (typeof data.squawk !== "undefined") + this.squawk = data.squawk; + if (typeof data.category !== "undefined") + this.category = data.category; + if (typeof data.lat !== "undefined") { this.position = [data.lon, data.lat]; this.last_position_time = receiver_timestamp - data.seen_pos; @@ -443,12 +488,6 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) { } } } - if (typeof data.flight !== "undefined") - this.flight = data.flight; - if (typeof data.squawk !== "undefined") - this.squawk = data.squawk; - if (typeof data.category !== "undefined") - this.category = data.category; }; PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp) { diff --git a/public_html/script.js b/public_html/script.js index 1075c54..0dac429 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -872,7 +872,7 @@ function refreshSelected() { // emerg.className = 'hidden'; // } - $("#selected_altitude").text(format_altitude_long(selected.altitude, selected.vert_rate, DisplayUnits)); + $("#selected_altitude").text(format_altitude_long(selected.altitude, selected.baro_rate, DisplayUnits)); if (selected.squawk === null || selected.squawk === '0000') { $('#selected_squawk').text('n/a'); @@ -880,8 +880,8 @@ function refreshSelected() { $('#selected_squawk').text(selected.squawk); } - $('#selected_speed').text(format_speed_long(selected.speed, DisplayUnits)); - $('#selected_vertical_rate').text(format_vert_rate_long(selected.vert_rate, DisplayUnits)); + $('#selected_speed').text(format_speed_long(selected.gs, DisplayUnits)); + $('#selected_vertical_rate').text(format_vert_rate_long(selected.baro_rate, DisplayUnits)); $('#selected_icao').text(selected.icao.toUpperCase()); $('#airframes_post_icao').attr('value',selected.icao); $('#selected_track').text(format_track_long(selected.track)); @@ -933,6 +933,23 @@ function refreshSelected() { $('#selected_rssi').text(selected.rssi.toFixed(1) + ' dBFS'); $('#selected_message_count').text(selected.messages); $('#selected_photo_link').html(getFlightAwarePhotoLink(selected.registration)); + + $('#selected_alt_geom').text(format_altitude_long(selected.alt_geom, selected.geom_rate, DisplayUnits)); + $('#selected_mag_heading').text(format_track_long(selected.mag_heading)); + $('#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)); + $('#selected_geom_rate').text(format_vert_rate_long(selected.geom_rate, DisplayUnits)); + if (selected.alt_setting == null) { + $('#selected_alt_setting').text("n/a"); + } else { + $('#selected_alt_setting').text(selected.alt_setting.toFixed(1) + " hPa"); + } + $('#selected_intent_alt').text(format_altitude_long(selected.intent_alt, 0, DisplayUnits)); + $('#selected_intent_heading').text(format_track_long(selected.intent_heading)) } function refreshHighlighted() { @@ -964,9 +981,9 @@ function refreshHighlighted() { } - $('#highlighted_speed').text(format_speed_long(highlighted.speed, DisplayUnits)); + $('#highlighted_speed').text(format_speed_long(highlighted.gs, DisplayUnits)); - $("#highlighted_altitude").text(format_altitude_long(highlighted.altitude, highlighted.vert_rate, DisplayUnits)); + $("#highlighted_altitude").text(format_altitude_long(highlighted.altitude, highlighted.baro_rate, DisplayUnits)); $('#highlighted_icao').text(highlighted.icao.toUpperCase());