forked from sebmatton/jQuery-Flight-Indicators
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdashboard.html
112 lines (89 loc) · 3.85 KB
/
dashboard.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!--
Skyhawk Flight Instruments (https://github.com/uw-ray/Skyhawk-Flight-Instruments)
By Raymond Blaga (raymond.blaga@gmail.com), Edward Hanna (edward.hanna@senecacollege.ca), Pavlo Kuzhel (pavlo.kuzhel@senecacollege.ca)
Forked from jQuery Flight Indicators (https://github.com/sebmatton/jQuery-Flight-Indicators)
By Sébastien Matton (seb_matton@hotmail.com)
Published under GPLv3 License.
-->
<!DOCTYPE html>
<meta charset="utf-8">
<html lang="en" dir="ltr">
<head>
<title>Skyhawk Flight Instruments Dashboard</title>
<script src="js/jquery-1.11.3.js"></script>
<script src="js/d3.min.js"></script>
<script src="js/jquery.flightindicators.js"></script>
<link rel="stylesheet" type="text/css" href="css/flightindicators.css" />
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<style>
body {
text-align: center;
}
</style>
</head>
<body>
<div class="instruments">
<div>
<div class="instrument" id="airspeed"></div>
<div class="instrument" id="attitude"></div>
<div class="instrument" id="altimeter"></div>
</div>
<div>
<div class="instrument" id="turn_coordinator"></div>
<div class="instrument" id="heading"></div>
<div class="instrument" id="variometer"></div>
</div>
</div>
<script type="text/javascript">
var settings = {
off_flag: true,
size: 300,
showBox: false,
showScrews: true
};
var increment = 0;
var increment_vario = 0;
var ball_increment = 0.5;
var ball_right = true;
var clockwise_vario = true;
var airspeed = $.flightIndicator('#airspeed', 'airspeed', settings);
var attitude = $.flightIndicator('#attitude', 'attitude', settings);
var altimeter = $.flightIndicator('#altimeter', 'altimeter', settings);
var turn_coordinator = $.flightIndicator('#turn_coordinator', 'turn_coordinator', settings);
var heading = $.flightIndicator('#heading', 'heading', settings);
var variometer = $.flightIndicator('#variometer', 'variometer', settings);
setInterval(function() {
// Airspeed update
//airspeed.setAirSpeed(80 * Math.sin(increment/10));
airspeed.setAirSpeed(increment);
// Attitude update
attitude.setRoll(30*Math.sin(increment/10));
attitude.setPitch(50*Math.sin(increment/20));
attitude.setILSLocalizer(15*Math.sin(increment/30));
attitude.setILSGlideslope(20*Math.sin(increment/30));
// Altimeter update
altimeter.setAltitude(10*increment);
altimeter.setPressure(30+3*Math.sin(increment/50)/10);
increment++;
// TC update - note that the TC appears opposite the angle of the attitude indicator, as it mirrors the actual wing up/down position
turn_coordinator.setTurn((30*Math.sin(increment/10))*-1);
turn_coordinator.setSlip(ball_increment);
if (ball_increment <= 0) ball_right = true;
if (ball_increment >= 1) ball_right = false;
if (ball_right == false) ball_increment -= 0.01;
else ball_increment += 0.01;
// Heading update
heading.setHeading(increment);
heading.setBeaconOne(increment * 0.5, true);
heading.setBeaconTwo(-increment * 0.75, true);
// Vario update
if (increment_vario > 45) clockwise_vario = false;
if (increment_vario < - 45) clockwise_vario = true;
if (clockwise_vario) increment_vario += 0.3;
else increment_vario -= 0.3;
variometer.setVario(increment_vario);
}, 50);
</script>
</body>
</html>