Skip to content

Commit 3788a28

Browse files
committed
Add SNR / RSSI Data, multiple rx callsigns
1 parent df02ef4 commit 3788a28

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

js/tracker.js

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,12 @@ function drawLOSPaths(vcallsign) {
745745

746746
if(vehicle === undefined || vehicle.vehicle_type !== "balloon") return;
747747

748-
var callsigns = vehicle.curr_position.callsign.split(',');
748+
var callsigns = [];
749+
for (var rxcall in vehicle.curr_position.callsign){
750+
if (vehicle.curr_position.callsign.hasOwnProperty(rxcall)){
751+
callsigns.push(rxcall);
752+
}
753+
}
749754

750755
callsigns.forEach(function(callsign) {
751756
callsign = callsign.trim(' ');
@@ -1052,6 +1057,29 @@ function updateVehicleInfo(vcallsign, newPosition) {
10521057
var sonde_type = "";
10531058
}
10541059

1060+
var callsign_list = [];
1061+
1062+
for(var rxcall in newPosition.callsign){
1063+
if(newPosition.callsign.hasOwnProperty(rxcall)) {
1064+
_new_call = rxcall;
1065+
if(newPosition.callsign[rxcall].hasOwnProperty('snr')){
1066+
if(newPosition.callsign[rxcall].snr){
1067+
_new_call += " (" + newPosition.callsign[rxcall].snr.toFixed(0) + " dB)";
1068+
callsign_list.push(_new_call)
1069+
continue;
1070+
}
1071+
}
1072+
if(newPosition.callsign[rxcall].hasOwnProperty('rssi')){
1073+
if(newPosition.callsign[rxcall].rssi){
1074+
_new_call += " (" + newPosition.callsign[rxcall].snr.toFixed(0) + " dBm)";
1075+
callsign_list.push(_new_call)
1076+
continue;
1077+
}
1078+
}
1079+
}
1080+
}
1081+
callsign_list = callsign_list.join(", ");
1082+
10551083
var a = '<div class="header">' +
10561084
'<span>' + sonde_type + vcallsign + ' <i class="icon-target"></i></span>' +
10571085
//'<span>' + vcallsign + ' <i class="icon-target"></i></span>' +
@@ -1073,7 +1101,7 @@ function updateVehicleInfo(vcallsign, newPosition) {
10731101
'</div>' + // data
10741102
'';
10751103
var c = '<dt class="receivers">Received <i class="friendly-dtime" data-timestamp='+(convert_time(newPosition.server_time))+'></i> via:</dt><dd class="receivers">' +
1076-
newPosition.callsign.split(",").join(", ") + '</dd>';
1104+
callsign_list + '</dd>';
10771105

10781106
if(!newPosition.callsign) c = '';
10791107

@@ -2047,10 +2075,17 @@ function addPosition(position) {
20472075
var dt = (new_ts - curr_ts) / 1000; // convert to seconds
20482076

20492077
if(dt === 0 && vehicle.num_positions) {
2050-
var callsigns = vehicle.curr_position.callsign.split(', ');
2051-
var newcalls = callsigns.concat(position.callsign.split(', '));
2052-
2053-
vehicle.curr_position.callsign = array_unique(callsigns).join(', ');
2078+
// Removed the below. Don't think its needed anymore.
2079+
// var callsigns = [];
2080+
// for (var rxcall in vehicle.curr_position.callsign){
2081+
// if (vehicle.curr_position.callsign.hasOwnProperty(rxcall)){
2082+
// callsigns.push(rxcall);
2083+
// }
2084+
// }
2085+
// console.log(position);
2086+
// var newcalls = callsigns.concat(position.callsign.split(', '));
2087+
2088+
// vehicle.curr_position.callsign = array_unique(callsigns).join(', ');
20542089
}
20552090
else if(dt >= 0) {
20562091
if(vehicle.num_positions > 0) {

0 commit comments

Comments
 (0)