Skip to content

Commit 5e7124c

Browse files
authored
Merge pull request #52 from darksidelemm/main
Clean up burst icons for float predictions
2 parents d897d21 + 472863a commit 5e7124c

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

js/tracker.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var position_id = 0;
33
var newdata_url = "https://api.v2.sondehub.org/amateur/telemetry";
44
var receivers_url = "https://api.v2.sondehub.org/amateur/listeners/telemetry";
55
var predictions_url = "https://api.v2.sondehub.org/amateur/predictions?vehicles=";
6+
var grafana_url = "https://grafana.v2.sondehub.org/d/HJgOZLq7k/basic?";
67

78
var livedata = "wss://ws-reader.v2.sondehub.org/";
89
var clientID = "SondeHub-Tracker-" + Math.floor(Math.random() * 10000000000);
@@ -1460,6 +1461,9 @@ function updateVehicleInfo(vcallsign, newPosition) {
14601461
timeChosen = timeSent;
14611462
}
14621463

1464+
// Generate Grafana Link
1465+
var grafana_dashboard_url = grafana_url + "var-Payload=" + vcallsign + "&from=" + vehicle.positions_ts[0] + "&to=" + vehicle.positions_ts[vehicle.positions_ts.length-1] + "&orgId=1";
1466+
14631467
//desktop
14641468
var a = '<div class="header">' +
14651469
'<span>' + sonde_type + vcallsign + ' <i class="icon-target"></i></span>' +
@@ -1816,7 +1820,7 @@ function redrawPrediction(vcallsign) {
18161820
vehicle.prediction_polyline.path_length = path_length;
18171821

18181822
var image_src;
1819-
if(vcallsign != "wb8elk2") { // WhiteStar
1823+
if(vcallsign != "wb8elk2") { // WhiteStar - Not sure the reasons behind a check for this? Seems odd. May be from when WB8ELK was first doing floater flights?
18201824
var html = "";
18211825
if(vehicle.prediction_target) {
18221826
vehicle.prediction_target.setLatLng(latlng);
@@ -1836,7 +1840,13 @@ function redrawPrediction(vcallsign) {
18361840
});
18371841
}
18381842
vehicle.prediction_target.pdata = data[data.length-1];
1843+
if(vehicle.prediction.descent_rate == null){
1844+
vehicle.prediction_target.pred_type = "Float Prediction";
1845+
} else {
1846+
vehicle.prediction_target.pred_type = "Standard, " + vehicle.prediction.descent_rate.toFixed(1) + " m/s descent rate.";
1847+
}
18391848
} else {
1849+
// Suspect this will never be called?
18401850
if(vehicle.prediction_target) vehicle.prediction_target = null;
18411851
}
18421852

@@ -1859,8 +1869,17 @@ function redrawPrediction(vcallsign) {
18591869
});
18601870
}
18611871
vehicle.prediction_burst.pdata = data[burst_index];
1872+
if(vehicle.prediction.descent_rate == null){
1873+
vehicle.prediction_burst.pred_type = "Float Prediction";
1874+
} else {
1875+
vehicle.prediction_burst.pred_type = "Standard, " + vehicle.prediction.descent_rate.toFixed(1) + " m/s descent rate.";
1876+
}
18621877
} else {
1863-
if(vehicle.prediction_burst) vehicle.prediction_burst = null;
1878+
if(vehicle.prediction_burst){
1879+
// Remove burst icon from the map if no burst data in prediction.
1880+
map.removeLayer(vehicle.prediction_burst);
1881+
vehicle.prediction_burst = null;
1882+
}
18641883
}
18651884
}
18661885

@@ -2165,6 +2184,7 @@ function mapInfoBox_handle_prediction(event) {
21652184
"<b>Altitude:</b> " + altitude + "\n" +
21662185
"<b>Latitude:</b> " + data.lat + "\n" +
21672186
"<b>Longitude:</b> " + data.lon + "\n" +
2187+
"<b>Prediction Type:</b> " + event.target.pred_type + "\n" +
21682188
"</pre>"
21692189
);
21702190
mapInfoBox.setLatLng(event.latlng);

0 commit comments

Comments
 (0)