Skip to content

Commit ec5095b

Browse files
committed
Cleanup graphs, burst-timer handling, use type field if available
1 parent 3f0106d commit ec5095b

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

js/tracker.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,22 @@ function habitat_data(jsondata, alternative) {
659659
.replace(/'/g, "'");
660660
}
661661

662+
// Handle Burst timer data.
663+
if(k === "burst_timer"){
664+
if(typeof v === "number"){
665+
if(v === 65535){
666+
v = "Inactive";
667+
} else {
668+
// Convert value to countdown.
669+
burst_temp = new Date(0);
670+
burst_temp.setSeconds(v);
671+
v = burst_temp.toISOString().substr(11,8);
672+
}
673+
} else {
674+
v = "Unknown";
675+
}
676+
}
677+
662678
if(typeof alternative == 'boolean' && alternative) {
663679
output += "<div><b>" + name + ":&nbsp;</b>" + v + suffix + "</div>";
664680
} else {
@@ -1029,11 +1045,14 @@ function updateVehicleInfo(vcallsign, newPosition) {
10291045
// start
10301046
// TABLE STUFF HERE
10311047

1032-
// TODO: Use type / subtype fields instead of this hack.
1033-
var sonde_type = newPosition.data.comment.split(' ')[0];
1048+
if (newPosition.hasOwnProperty("type")){
1049+
var sonde_type = newPosition.type + " ";
1050+
} else {
1051+
var sonde_type = "";
1052+
}
10341053

10351054
var a = '<div class="header">' +
1036-
'<span>' + sonde_type + " " + vcallsign + ' <i class="icon-target"></i></span>' +
1055+
'<span>' + sonde_type + vcallsign + ' <i class="icon-target"></i></span>' +
10371056
//'<span>' + vcallsign + ' <i class="icon-target"></i></span>' +
10381057
'<canvas class="graph"></canvas>' +
10391058
'<i class="arrow"></i></div>' +
@@ -2117,6 +2136,10 @@ function addPosition(position) {
21172136
return;
21182137
}
21192138

2139+
// Graph Stuff
2140+
2141+
var graph_inhibited_fields = ['frequency', 'burst_timer'];
2142+
21202143
function updateGraph(vcallsign, reset_selection) {
21212144
if(!plot || !plot_open) return;
21222145

@@ -2291,6 +2314,8 @@ function graphAddPosition(vcallsign, new_data) {
22912314
vehicle.graph_yaxes[1].max = vehicle.graph_yaxes[0].max;
22922315
}
22932316

2317+
2318+
22942319
// we don't record extra data, if there is no telemetry graph loaded
22952320
// altitude is used for altitude profile
22962321
if(plot && new_data.data !== "") {
@@ -2308,6 +2333,12 @@ function graphAddPosition(vcallsign, new_data) {
23082333

23092334
i = (k in vehicle.graph_data_map) ? vehicle.graph_data_map[k] : data.length;
23102335

2336+
// Disable plotting of a few fields.
2337+
if (graph_inhibited_fields.includes(k)){
2338+
return;
2339+
}
2340+
2341+
23112342
if(i >= 8) return; // up to 7 seperate data plots only, 1 taken by alt, 1 by prediction
23122343

23132344
if(data[i] === undefined) {

0 commit comments

Comments
 (0)