Feed more data to skyview, basic display updates.

This commit is contained in:
Oliver Jowett 2017-06-15 22:36:23 +01:00
parent 1ec32903ba
commit c7855c5ab6
4 changed files with 146 additions and 24 deletions

View file

@ -1113,8 +1113,16 @@ static char *append_flags(char *p, char *end, struct aircraft *a, datasource_t s
p += snprintf(p, end-p, "\"altitude\","); p += snprintf(p, end-p, "\"altitude\",");
if (a->track_valid.source == source) if (a->track_valid.source == source)
p += snprintf(p, end-p, "\"track\","); 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) 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) if (a->baro_rate_valid.source == source)
p += snprintf(p, end-p, "\"baro_rate\","); p += snprintf(p, end-p, "\"baro_rate\",");
if (a->geom_rate_valid.source == source) if (a->geom_rate_valid.source == source)
@ -1191,7 +1199,7 @@ char *generateAircraftJson(const char *url_path, int *len) {
if (trackDataValid(&a->altitude_valid)) if (trackDataValid(&a->altitude_valid))
p += snprintf(p, end-p, ",\"altitude\":%d", a->altitude); p += snprintf(p, end-p, ",\"altitude\":%d", a->altitude);
if (trackDataValid(&a->altitude_geom_valid)) 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)) if (trackDataValid(&a->baro_rate_valid))
p += snprintf(p, end-p, ",\"baro_rate\":%d", a->baro_rate); 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); p += snprintf(p, end-p, ",\"roll\":%.1f", a->roll);
if (trackDataValid(&a->category_valid)) if (trackDataValid(&a->category_valid))
p += snprintf(p, end-p, ",\"category\":\"%02X\"", a->category); 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 += snprintf(p, end-p, ",\"mlat\":");
p = append_flags(p, end, a, SOURCE_MLAT); p = append_flags(p, end, a, SOURCE_MLAT);

View file

@ -170,6 +170,58 @@
</div> </div>
</div> </div>
</div> </div>
<div class="infoBlockSection lightGreyBackground">
<div>
<div class="infoHeading infoRowFluid fourColumnSection1">Alt (geom):</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_alt_geom"/></div>
<div class="infoHeading infoRowFluid fourColumnSection3">Geom rate:</div>
<div class="infoData infoRowFluid fourColumnSection4"><span id="selected_geom_rate"/></div>
</div>
</div>
<div class="infoBlockSection">
<div>
<div class="infoHeading infoRowFluid fourColumnSection1">Mag heading:</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_mag_heading"/></div>
<div class="infoHeading infoRowFluid fourColumnSection3">True heading:</div>
<div class="infoData infoRowFluid fourColumnSection4"><span id="selected_true_heading"/></div>
</div>
<div>
<div class="infoHeading infoRowFluid fourColumnSection1">Roll:</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_roll"/></div>
<div class="infoHeading infoRowFluid fourColumnSection3">Track rate:</div>
<div class="infoData infoRowFluid fourColumnSection4"><span id="selected_track_rate"/></div>
</div>
</div>
<div class="infoBlockSection lightGreyBackground">
<div>
<div class="infoHeading infoRowFluid fourColumnSection1">IAS:</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_ias"/></div>
<div class="infoHeading infoRowFluid fourColumnSection3">TAS:</div>
<div class="infoData infoRowFluid fourColumnSection4"><span id="selected_tas"/></div>
</div>
<div>
<div class="infoHeading infoRowFluid fourColumnSection1">Mach:</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_mach"/></div>
</div>
</div>
<div class="infoBlockSection">
<div>
<div class="infoHeading infoRowFluid fourColumnSection1">AP alt:</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_intent_alt"/></div>
<div class="infoHeading infoRowFluid fourColumnSection3">AP heading:</div>
<div class="infoData infoRowFluid fourColumnSection4"><span id="selected_intent_heading"/></div>
</div>
<div>
<div class="infoHeading infoRowFluid fourColumnSection1">Alt setting:</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_alt_setting"/></div>
</div>
</div>
<a href="http://www.airframes.org/" onclick="document.getElementById('horrible_hack').submit.call(document.getElementById('airframes_post')); return false;" class="link rightLink"> <a href="http://www.airframes.org/" onclick="document.getElementById('horrible_hack').submit.call(document.getElementById('airframes_post')); return false;" class="link rightLink">
AirFrames.org AirFrames.org
</a> </a>

View file

@ -11,8 +11,22 @@ function PlaneObject(icao) {
// Basic location information // Basic location information
this.altitude = null; this.altitude = null;
this.speed = null; this.alt_geom = null;
this.gs = null;
this.ias = null;
this.tas = null;
this.track = 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.prev_position = null;
this.position = null; this.position = null;
this.position_from_mlat = false this.position_from_mlat = false
@ -418,12 +432,43 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
if (typeof data.altitude !== "undefined") if (typeof data.altitude !== "undefined")
this.altitude = data.altitude; this.altitude = data.altitude;
if (typeof data.vert_rate !== "undefined") if (typeof data.alt_geom !== "undefined")
this.vert_rate = data.vert_rate; this.alt_geom = data.alt_geom;
if (typeof data.speed !== "undefined") if (typeof data.gs !== "undefined")
this.speed = data.speed; 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") 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") { if (typeof data.lat !== "undefined") {
this.position = [data.lon, data.lat]; this.position = [data.lon, data.lat];
this.last_position_time = receiver_timestamp - data.seen_pos; 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) { PlaneObject.prototype.updateTick = function(receiver_timestamp, last_timestamp) {

View file

@ -872,7 +872,7 @@ function refreshSelected() {
// emerg.className = 'hidden'; // 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') { if (selected.squawk === null || selected.squawk === '0000') {
$('#selected_squawk').text('n/a'); $('#selected_squawk').text('n/a');
@ -880,8 +880,8 @@ function refreshSelected() {
$('#selected_squawk').text(selected.squawk); $('#selected_squawk').text(selected.squawk);
} }
$('#selected_speed').text(format_speed_long(selected.speed, DisplayUnits)); $('#selected_speed').text(format_speed_long(selected.gs, DisplayUnits));
$('#selected_vertical_rate').text(format_vert_rate_long(selected.vert_rate, DisplayUnits)); $('#selected_vertical_rate').text(format_vert_rate_long(selected.baro_rate, DisplayUnits));
$('#selected_icao').text(selected.icao.toUpperCase()); $('#selected_icao').text(selected.icao.toUpperCase());
$('#airframes_post_icao').attr('value',selected.icao); $('#airframes_post_icao').attr('value',selected.icao);
$('#selected_track').text(format_track_long(selected.track)); $('#selected_track').text(format_track_long(selected.track));
@ -933,6 +933,23 @@ function refreshSelected() {
$('#selected_rssi').text(selected.rssi.toFixed(1) + ' dBFS'); $('#selected_rssi').text(selected.rssi.toFixed(1) + ' dBFS');
$('#selected_message_count').text(selected.messages); $('#selected_message_count').text(selected.messages);
$('#selected_photo_link').html(getFlightAwarePhotoLink(selected.registration)); $('#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() { 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()); $('#highlighted_icao').text(highlighted.icao.toUpperCase());