Implement improved traffic UI. Clean up status and traffic help pages.

pull/259/head
AvSquirrel 2016-02-18 04:31:05 +00:00
rodzic a900a8942d
commit 370725eb53
7 zmienionych plików z 76 dodań i 79 usunięć

Wyświetl plik

@ -13,6 +13,7 @@ import (
"bufio"
"encoding/hex"
"encoding/json"
//"log"
"math"
"net"
"strconv"
@ -106,7 +107,14 @@ func sendTrafficUpdates() {
defer trafficMutex.Unlock()
cleanupOldEntries()
var msg []byte
for _, ti := range traffic { // TO-DO: Limit number of aircraft in traffic message. ForeFlight chokes at ~1000-2000 messages depending on iDevice RAM. Practical limit likely around 500-1000 aircraft
for icao, ti := range traffic { // TO-DO: Limit number of aircraft in traffic message. ForeFlight 7.5 chokes at ~1000-2000 messages depending on iDevice RAM. Practical limit likely around ~500 aircraft without filtering.
ti.Age = stratuxClock.Time.Sub(ti.Last_seen).Seconds()
traffic[icao] = ti
//log.Printf("Traffic age of %X is %f seconds\n",icao,ti.Age)
if ti.Age > 2 { // if nothing polls an inactive ti, it won't push to the webUI, and its Age won't update.
tiJSON, _ := json.Marshal(&ti)
trafficUpdate.Send(tiJSON)
}
if ti.Position_valid && ti.Age < 6 { // ... but don't pass stale data to the EFB. TO-DO: Coast old traffic? Need to determine how FF, WingX, etc deal with stale targets.
msg = append(msg, makeTrafficReportMsg(ti)...)
}
@ -117,7 +125,7 @@ func sendTrafficUpdates() {
}
}
// Send update to attached client.
// Send update to attached JSON client.
func registerTrafficUpdate(ti TrafficInfo) {
if !ti.Position_valid { // Don't send unless a valid position exists.
return
@ -377,7 +385,7 @@ func parseDownlinkReport(s string) {
ti.Last_source = TRAFFIC_SOURCE_UAT
ti.Last_seen = stratuxClock.Time
ti.Age = 0
//ti.Age = 0
// Parse tail number, if available.
if msg_type == 1 || msg_type == 3 { // Need "MS" portion of message.
@ -563,7 +571,7 @@ func esListen() {
// Update "last seen" (any type of message, as long as the ICAO addr can be parsed).
ti.Last_source = TRAFFIC_SOURCE_1090ES
ti.Last_seen = stratuxClock.Time
ti.Age = 0
//ti.Age = 0
ti.addr_type = 0 //FIXME: ADS-B with ICAO address. Not recognized by ForeFlight.
ti.emitter_category = 0x01 //FIXME. "Light"
@ -591,6 +599,11 @@ KOSH, once every five minutes.
Inputs are ICAO 24-bit hex code, tail number (8 chars max), relative altitude in feet,
groundspeed in knots, and bearing offset from 0 deg initial position.
Traffic on headings 150-240 (bearings 060-150) is intentionally suppressed from updating to allow
for testing of EFB and webUI response. Additionally, the "on ground" flag is set for headings 240-270,
and speed invalid flag is set for headings 135-150 to allow testing of response to those conditions.
*/
func updateDemoTraffic(icao uint32, tail string, relAlt float32, gs float64, offset int32) {
var ti TrafficInfo
@ -620,7 +633,10 @@ func updateDemoTraffic(icao uint32, tail string, relAlt float32, gs float64, off
ti.Alt = int32(mySituation.Alt + relAlt)
ti.Track = uint16(hdg)
ti.Speed = uint16(gs)
if hdg > 100 && hdg < 150 {
if hdg >= 240 && hdg < 270 {
ti.OnGround = true
}
if hdg > 135 && hdg < 150 {
ti.Speed_valid = false
} else {
ti.Speed_valid = true
@ -629,13 +645,13 @@ func updateDemoTraffic(icao uint32, tail string, relAlt float32, gs float64, off
ti.Tail = tail // "DEMO1234"
ti.Timestamp = time.Now()
ti.Last_seen = stratuxClock.Time
ti.Age = hdg / 1000
//ti.Age = math.Floor(ti.Age) + hdg / 1000
ti.Last_source = 1
if icao%7 == 1 { // make some of the traffic UAT sourced
ti.Last_source = 2
}
if hdg < 120 || hdg > 240 {
if hdg < 150 || hdg > 240 {
// now insert this into the traffic map...
trafficMutex.Lock()
defer trafficMutex.Unlock()

Wyświetl plik

@ -59,7 +59,7 @@ function StatusCtrl($rootScope, $scope, $state, $http, $interval) {
$scope.Clock = clockString;
var tempLocalClock = new Date;
$scope.LocalClock = tempLocalClock.toUTCString();
$scope.SecondsFast = (tempClock-tempLocalClock)/1000;
$scope.SecondsFast = (Math.round(tempClock-tempLocalClock)/1000).toFixed(2);
var uptime = status.Uptime;

Wyświetl plik

@ -52,25 +52,11 @@ function TrafficCtrl($rootScope, $scope, $state, $http, $interval) {
new_traffic.vspeed = Math.round(obj.Vvel / 100) * 100
var timestamp = Date.parse(obj.Timestamp);
new_traffic.time = utcTimeString(timestamp);
new_traffic.age = obj.Age;
new_traffic.age = (Math.round(obj.Age * 10)/10).toFixed(1);
new_traffic.src = obj.Last_source; // 1=ES, 2=UAT
// return new_aircraft;
}
/*
function getStratuxTime() {
// Simple GET request example (note: response is asynchronous)
$http.get(URL_STATUS_GET).
then(function (response) {
globalStatus = angular.fromJson(response.data);
$scope.UptimeClock = globalStatus.UptimeClock;
$scope.Clock = globalStatus.Clock;
$scope.LocalClock = new Date();
}, function (response) {
// nop
});
};
*/
function connect($scope) {
if (($scope === undefined) || ($scope === null))
@ -155,15 +141,14 @@ function TrafficCtrl($rootScope, $scope, $state, $http, $interval) {
// perform cleanup every 60 seconds
// perform cleanup every 10 seconds
var clearStaleTraffic = $interval(function () {
// remove stale aircraft = anything more than 180 seconds without an update
// remove stale aircraft = anything more than 60 seconds without an update
var dirty = false;
var cutoff = Date.now() - (180 * 1000);
var cutoff =60;
for (var i = len = $scope.data_list.length; i > 0; i--) {
if ($scope.data_list[i - 1].age < cutoff) {
if ($scope.data_list[i - 1].age > cutoff) {
$scope.data_list.splice(i - 1, 1);
dirty = true;
}
@ -172,7 +157,7 @@ function TrafficCtrl($rootScope, $scope, $state, $http, $interval) {
$scope.raw_data = "";
$scope.$apply();
}
}, (1000 * 60), 0, false);
}, (1000 * 10), 0, false);
$state.get('traffic').onEnter = function () {

Wyświetl plik

@ -1,17 +1,14 @@
<div class="section text-left help-page">
<p>The <strong>Status</strong> page provides an overview of your Stratux device.</p>
<p>The current state of you device is shown at th top - <code>Connected</code> in green or <code>Disconected</code>in red.</p>
<p>The current state of you device is shown at the top - <code>Connected</code> in green or <code>Disconected</code>in red.</p>
<p>Depending on the hardware you have installed in your Stratux, you will have status for the following:</p>
<p>Depending on the hardware you have installed in your Stratux, status messages will be shown for the following:</p>
<ul class="list-simple">
<li><strong>SDR</strong> (software defined radio) dongle tuned to 978Mhz for UAT (universal access transceiver) traffic and weather</li>
<li><strong>SDR</strong> (software defined radio) dongle tuned to 1090Mhz for ES (extended squitter) traffic</li>
<li><strong>GPS</strong> the RY835AI module receiving GPS data from satellites</li>
<li><strong>AHRS</strong> the RY835AI module generating attitude data from its pressure sensor, gyroscope, accelerometer, and magnetometer.</li>
<li><strong>Messages</strong> is the number of messages received by the UAT (978 MHz) and 1090 MHz radios. "Current" is the 60-second rolling total for each receiver; "Peak" is the maximum 60-second total. The 1090 total includes all 1090 MHz Mode S messages received, including all-call and TCAS interrogations that do not carry ADS-B position information. If a UAT radio is receiving uplinks from one or more ground-based transceivers (GBT), this will be indicated under <strong>UAT Towers</strong>, with more details available on the Towers page.</li>
<li><strong>GPS</strong> indicates the connection status of any attached GPS receivers. Reported data includes the type of position solution, the number of satellites used in that solution, the number of satellites being received, and the number of satellites tracked in the GPS almanac data. Position and accuracy details can be viewed on the <strong>GPS/AHRS</strong> page.</li>
<li><strong>AHRS</strong> indicates whether the pressure sensor and gyro on an RY835AI or similar 10-axis module are connected and enabled. If connected, attitude and pressure altitude can be viewed on the <strong>GPS/AHRS</strong> page.</li>
</ul>
<p class="text-warning">NOTE: This page only shows devices you have installed and turned on (via the <strong>Settings</strong> page.</p>
<p class="text-warning">Devices must be manually enabled on the <strong>Settings</strong> page.</p>
<p>The <strong>Messages</strong> section gives you details for messages received. There are statistics for the rolling average for the past 60 seconds as well as the peak average.</p>
<p>For GPS and AHRS you can view the number of satellites being received and if AHRS is configured and operating.</p>
<p>The <strong>Status</strong> page also gives you an indication of how long your Stratux devices has been operating since you turned it on, as well as reporting the on-board temperature sensor of the Raspberry Pi.</p>
<p>Additional statistics include the number of detected software-defined radios (SDRs), number of current DHCP network clients, uptime, temperature of the Raspberry Pi CPU, and the current clock settings on both the Raspberry Pi and the device / browser used to view this page.</p>
</div>

Wyświetl plik

@ -72,31 +72,32 @@
</div>
<div class="row"><span class="col-xs-1">&nbsp;</span></div>
<div class="separator"></div>
<div class="row">
<div class="col-sm-6 label_adj">
<strong class="col-xs-5">Uptime:</strong>
<div class="col-sm-4 label_adj">
<span class="col-xs-5"><strong>Uptime:</strong></span>
<span class="col-xs-7">{{Uptime}}</span>
</div>
<div class="col-sm-6 label_adj">
<strong class="col-xs-5">CPU Temp:</strong>
<div class="col-sm-4 label_adj">
<span class="col-xs-5"><strong>CPU Temp:</strong></span>
<span class="col-xs-7">{{CPUTemp}}</span>
</div>
</div>
<div class="separator"></div>
<div class="row">
<div class="col-sm-4 label_adj">
<strong class="col-xs-5">Stratux Clock:</strong>
<span class="col-xs-7">{{Clock}}</span>
<span class="col-xs-4"><strong>Stratux Clock:</strong></span>
<span class="col-xs-8">{{Clock}}</span>
</div>
<div class="col-sm-4 label_adj">
<strong class="col-xs-5">Device Clock:</strong>
<span class="col-xs-7">{{LocalClock}}</span>
<span class="col-xs-4"><strong>Device Clock:</strong></span>
<span class="col-xs-8">{{LocalClock}}</span>
</div>
<div class="col-sm-4 label_adj">
<strong class="col-xs-5">Difference [sec]:</strong>
<span class="col-xs-7">{{SecondsFast}}</span>
<span class="col-xs-4"><strong>Difference:</strong></span>
<span class="col-xs-8">{{SecondsFast}} sec</span>
</div>
</div>
</div>
</div>

Wyświetl plik

@ -1,18 +1,18 @@
<div class="section text-left help-page">
<p>The <strong>Traffic</strong> page provides a list of recent aircraft received. Each time a new aircraft is reported, it is added to the list. Each time a new report is received for an existing aircraft, the list is updated. If a report for an aircraft is not received for 3 minutes (180 seconds), the aircraft is removed from the list.</p>
<p>The <strong>Traffic</strong> page provides a list of all aircraft position reports received within the last 60 seconds. Each time a new aircraft is reported, it is added to the list. Each time a new report is received for an existing aircraft, the list is updated. If a report for an aircraft has not been received within the last 60 seconds, the aircraft is removed from the list.</p>
<p>For each aircraft, the list includes the following details:</p>
<ul class="list-simple">
<li><strong>Flight</strong> - either the aircraft tail number / ATC call sign or the ICAO number. When the ICAO number is used, it is displayed in grey.
<li><strong>Flight</strong> is aircraft tail number / call sign (when available) or the ICAO 24-bit code. When the ICAO code is used, it is displayed in gray.
<ul class="list-simple">
<li><span class="label traffic-style1">1090 ES</span> is displayed with a light blue background.</li>
<li><span class="label traffic-style2">978 UAT</span> is displayed with a light tan background.</li>
<li><span class="label traffic-style1">1090 ES</span> traffic is displayed with a light blue background.</li>
<li><span class="label traffic-style2">978 UAT</span> traffic is displayed with a light tan background.</li>
</ul>
</li>
<li><strong>Speed</strong> - current reported speed in knots</li>
<li><strong>Altitude</strong> - current reported altitude and climb/decent rate if when not reporting level flight</li>
<li><strong>Heading</strong> - direction of reported flight</li>
<li><strong>Location</strong> - the latitude and longitude reported</li>
<li><strong>Time</strong> - the last time (UTC) a report was received</li>
<li><strong>Speed</strong> - Reported ground speed, rounded to the nearest 5 knots. Invalid or missing values are shown as '---'.</li>
<li><strong>Altitude</strong> - Reported pressure altitude, feet MSL. Climb or descent rate is also shown if not in level flight.</li>
<li><strong>Course</strong> - Reported true course, rounded to the nearest 5°. Invalid or missing values are shown as '---'</li>
<li><strong>Location</strong> - Reported latitude and longitude, DD° mm' ss''.</li>
<li><strong>Age</strong> - Age of the last traffic report, seconds.</li>
</ul>
<p class="text-warning">NOTE: When this page becomes active (aka it is selected from the menu) it will display only new traffic. Older traffic and existing traffic will not appear until their next report.</p>
<p><strong>Stratux Clock</strong> and <strong>Device Clock</strong> are the UTC timestamps reported by the Stratux and by the web browser on your mobile device, respectively.</p>
</div>

Wyświetl plik

@ -11,12 +11,12 @@
<span class="col-xs-3"><strong>Flight</strong></span>
<span class="col-xs-3 text-right">Speed</span>
<span class="col-xs-3 text-right">Altitude</span><span class="col-xs-1 col-padding-shift-right">&nbsp;</span>
<span class="col-xs-2 text-right">Hdg</span>
<span class="col-xs-2 text-right">Course</span>
</div>
<div class="col-sm-6">
<span class="col-xs-2">&nbsp;</span>
<span class="col-xs-7">Location</span>
<span class="col-xs-3 text-right">Age [sec]</span>
<span class="col-xs-3 text-right">Age</span>
</div>
</div>
@ -44,24 +44,22 @@
</div>
</div>
</div>
<div class="panel-body traffic-footer">
<div class="separator"></div>
<div class="row">
<div class="col-sm-6 label_adj">
<span class="col-xs-4"><strong>Stratux Clock:</strong></span>
<span class="col-xs-8">{{Clock}}</span>
</div>
<div class="col-sm-6 label_adj">
<span class="col-xs-4"><strong>Device Clock:</strong></span>
<span class="col-xs-8">{{LocalClock}}</span>
</div>
</div>
</div>
</div>
</div>
<div class="separator"></div>
<div class="row">
<div class="col-sm-4 label_adj">
<strong class="col-xs-5">Stratux Clock:</strong>
<span class="col-xs-7">{{Clock}}</span>
</div>
<div class="col-sm-4 label_adj">
<strong class="col-xs-5">Device Clock:</strong>
<span class="col-xs-7">{{LocalClock}}</span>
</div>
<div class="col-sm-4 label_adj">
<strong class="col-xs-5">Uptime Clock</strong>
<span class="col-xs-7">{{UptimeClock}}</span>
</div>
</div>
<!--
<div class="col-sm-12">