... | ... |
@@ -42,13 +42,12 @@ var MapTiles = { |
42 | 42 |
|
43 | 43 |
# this is the callback that will be regularly called by the timer to update the map |
44 | 44 |
updateTiles : func() { |
45 |
- var lat = getprop('/position/latitude-deg'); |
|
46 |
- var lon = getprop('/position/longitude-deg'); |
|
45 |
+# me.group.setRotation(-data.hdg * D2R); |
|
47 | 46 |
|
48 | 47 |
var n = math.pow(2, me.zoom); |
49 | 48 |
var offset = [ |
50 |
- n * ((lon + 180) / 360) - me.center_tile_offset[0], |
|
51 |
- (1 - math.ln(math.tan(lat * math.pi/180) + 1 / math.cos(lat * math.pi/180)) / math.pi) / 2 * n - me.center_tile_offset[1] |
|
49 |
+ n * ((data.lon + 180) / 360) - me.center_tile_offset[0], |
|
50 |
+ (1 - math.ln(math.tan(data.lat * math.pi/180) + 1 / math.cos(data.lat * math.pi/180)) / math.pi) / 2 * n - me.center_tile_offset[1] |
|
52 | 51 |
]; |
53 | 52 |
var tile_index = [int(offset[0]), int(offset[1])]; |
54 | 53 |
|
... | ... |
@@ -28,6 +28,8 @@ var data = { # set of data common to all devices |
28 | 28 |
alt : 0, |
29 | 29 |
hdg : 0, |
30 | 30 |
wow : 1, |
31 |
+ lat : 0, |
|
32 |
+ lon : 0, |
|
31 | 33 |
timers : { |
32 | 34 |
'20Hz': maketimer ( |
33 | 35 |
0.05, |
... | ... |
@@ -44,6 +46,8 @@ var data = { # set of data common to all devices |
44 | 46 |
1, |
45 | 47 |
func { |
46 | 48 |
data.wow = getprop('/gear/gear/wow'); |
49 |
+ data.lat = getprop('/position/latitude-deg'); |
|
50 |
+ data.lon = getprop('/position/longitude-deg'); |
|
47 | 51 |
} |
48 | 52 |
), |
49 | 53 |
}, |