Minimal changes needed to display aircraft with mlat positions differently.

This commit is contained in:
Oliver Jowett 2015-07-01 19:48:23 +01:00
parent 161c11d10f
commit 2cf1a40eb6
6 changed files with 19 additions and 3 deletions

View File

@ -141,6 +141,7 @@
#define MODES_ACFLAGS_FS_VALID (1<<13) // Aircraft Flight Status is known
#define MODES_ACFLAGS_NSEWSPD_VALID (1<<14) // Aircraft EW and NS Speed is known
#define MODES_ACFLAGS_LATLON_REL_OK (1<<15) // Indicates it's OK to do a relative CPR
#define MODES_ACFLAGS_MLAT (1<<16) // Position is from mlat
#define MODES_ACFLAGS_LLEITHER_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID)
#define MODES_ACFLAGS_LLBOTH_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID)

View File

@ -371,6 +371,10 @@ struct aircraft *interactiveReceiveData(struct modesMessage *mm, struct client *
//If we sucessfully decoded, back copy the results to mm so that we can print them in list output
if (location_ok) {
mm->bFlags |= MODES_ACFLAGS_LATLON_VALID;
if (mm->timestampMsg == 0xFF004D4C4154) // Magic mlat timestamp
mm->bFlags |= MODES_ACFLAGS_MLAT;
else
a->bFlags &= ~MODES_ACFLAGS_MLAT;
mm->fLat = a->lat;
mm->fLon = a->lon;
}

View File

@ -681,9 +681,10 @@ char *aircraftsToJson(int *len) {
l = snprintf(p,buflen,
"{\"hex\":\"%06x\", \"squawk\":\"%04x\", \"flight\":\"%s\", \"lat\":%f, "
"\"lon\":%f, \"validposition\":%d, \"altitude\":%d, \"vert_rate\":%d,\"track\":%d, \"validtrack\":%d,"
"\"speed\":%d, \"messages\":%ld, \"seen\":%d},\n",
"\"speed\":%d, \"messages\":%ld, \"seen\":%d, \"mlat\":%s},\n",
a->addr, a->modeA, a->flight, a->lat, a->lon, position, a->altitude, a->vert_rate, a->track, track,
a->speed, a->messages, (int)(now - a->seen));
a->speed, a->messages, (int)(now - a->seen),
(a->bFlags & MODES_ACFLAGS_MLAT) ? "true" : "false");
p += l; buflen -= l;
//Resize if needed

View File

@ -23,6 +23,7 @@ var planeObject = {
// Vaild...
vPosition : false,
vTrack : false,
mlat : false,
// GMap Details
marker : null,
@ -142,6 +143,7 @@ var planeObject = {
this.icao = data.hex;
this.messages = data.messages;
this.seen = data.seen;
this.mlat = data.mlat;
// If no packet in over 58 seconds, consider the plane reapable
// This way we can hold it, but not show it just in case the plane comes back

View File

@ -326,6 +326,9 @@ function refreshSelected() {
html += '<tr><td colspan="' + columns + '" align="center">Lat/Long: ';
if (selected && selected.vPosition) {
if (selected.mlat) {
html += "MLAT: ";
}
html += selected.latitude + ', ' + selected.longitude + '</td></tr>';
// Let's show some extra data if we have site coordinates
@ -426,7 +429,11 @@ function refreshTableInfo() {
}
if (tableplane.vPosition == true) {
html += '<tr onclick="planeTRclick(\''+tableplane.icao+'\')" class="plane_table_row vPosition' + specialStyle + '">';
if (tableplane.mlat == true) {
html += '<tr onclick="planeTRclick(\''+tableplane.icao+'\')" class="plane_table_row mlat' + specialStyle + '">';
} else {
html += '<tr onclick="planeTRclick(\''+tableplane.icao+'\')" class="plane_table_row vPosition' + specialStyle + '">';
}
} else {
html += '<tr onclick="planeTRclick(\''+tableplane.icao+'\')" class="plane_table_row ' + specialStyle + '">';
}

View File

@ -25,6 +25,7 @@ table#optionsTabs { width: 100%; font-size: small; font-family: monospace; backg
#tableinfo, #sudo_buttons { font-size: x-small; font-family: monospace; }
.vPosition { font-weight: bold; background-color: #d5ffd5; }
.mlat { font-weight: bold; background-color: #d5d5ff; }
.squawk7500 { font-weight: bold; background-color: #ff5555; }
.squawk7600 { font-weight: bold; background-color: #00ffff; }
.squawk7700 { font-weight: bold; background-color: #ffff00; }