Skip to content

Commit edac2a0

Browse files
no interpolation of large gaps in graph data
1 parent 869a945 commit edac2a0

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# version 63
2+
# version 71
33

44
# gogole maps files
55
http://maps.google.com/maps/api/js?v=3.10&sensor=false&key=AIzaSyCOqkcNey4CCyG4X0X5qxHAhCgD8g5DwXg

js/plot_config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ function updateLegend() {
9090
y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
9191
}
9292
y = y.toFixed(2);
93+
94+
if(p1[1] == null || p2[1] == null) y = null;
9395
}
9496
legend.eq(i).text(series.label.replace(/=.*/, "= " + y));
9597
}

js/tracker.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,6 @@ function updateVehicleInfo(index, position) {
413413
$('.portrait .vehicle'+index).html(a + p + b);
414414
$('.landscape .vehicle'+index).html(a + l + b);
415415

416-
// update graph is current vehicles is followed
417-
if(vehicles[index].follow) updateGraph(index);
418-
419416
return true;
420417
}
421418

@@ -713,6 +710,7 @@ function addPosition(position) {
713710
alt_list: [0],
714711
time_last_alt: 0,
715712
alt_max: 100,
713+
graph_data_updated: false,
716714
graph_data: [],
717715
graph_yaxes: []
718716
};
@@ -798,11 +796,22 @@ function updateGraph(idx) {
798796
function graphAddLastPosition(idx) {
799797
if(!plot) return;
800798

799+
vehicles[idx].graph_data_updated = true;
801800
var data = vehicles[idx].graph_data;
802801
var new_data = vehicles[idx].curr_position;
803802
var ts = (new Date(new_data.gps_time)).getTime(); // flot needs miliseconds for time
804803
var series_idx = 1;
805804

805+
//insert gap when there are 2mins, or more, without telemetry
806+
if(vehicles[idx].graph_data.length) {
807+
var ts_last_idx = vehicles[idx].graph_data[0].data.length - 1;
808+
var ts_last = vehicles[idx].graph_data[0].data[ts_last_idx][0];
809+
810+
if(ts_last + 120000 < ts) {
811+
$.each(vehicles[idx].graph_data, function(k,v) { v.data.push([ts_last+1, null]); })
812+
}
813+
}
814+
806815
// altitude is always the first series
807816
if(data[0] === undefined) {
808817
data[0] = {
@@ -1066,6 +1075,9 @@ function update(response) {
10661075
lastPPointer.push(vehicles[i].curr_position);
10671076
}
10681077

1078+
// update graph is current vehicles is followed
1079+
if(follow_vehicle != -1 && vehicles[follow_vehicle].graph_data_updated) updateGraph(follow_vehicle);
1080+
10691081
// store in localStorage
10701082
offline.set('positions', lastPositions);
10711083

0 commit comments

Comments
 (0)