-
Notifications
You must be signed in to change notification settings - Fork 5
/
accelerometer.ejs
187 lines (149 loc) · 7.33 KB
/
accelerometer.ejs
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<head>
<title>SnapperGPS - Accelerometer</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css" />
<script src="js/deviceCommunication.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Measure accelerations with your SnapperGPS receiver.">
</head>
<body>
<!-- Nav bar -->
<%- include ('partials/navBar', {pageName: 'accelerometer'}) %>
<!-- Main body -->
<main class="container">
<div class="row">
<div class="col">
<h1>Measure accelerations with your SnapperGPS receiver</h1>
</div>
</div>
<div class="row" style="margin-bottom: 20px;">
<div class="col">
<i>
Did you know that this site works offline, too?
You can configure your SnapperGPS receiver in the field.
(If you do not clear your browser cache.)
</i>
</div>
</div>
<div class="row bg-white">
<div>
<%- include ('partials/webUsbSupport') %>
</div>
<div id="error-display" style="display: none;">
<div class="card text-white bg-danger mb-3" style="max-width: 100%;">
<div class="card-header"><b>Error</b></div>
<div class="card-body">
<p class="card-text" id="error-text">Error</p>
</div>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
Connect your SnapperGPS receiver
via USB.
If you used SnapperGPS before, then you can see some information
from your SnapperGPS receiver below.
Otherwise, click <i>Pair receiver</i> and select your SnapperGPS
receiver from the list.
</div>
</div>
<div class="row-ident">
<%- include ('partials/deviceInfo') %>
</div>
<div class="row btnrow row-ident">
<div class="col btncol">
<button class="btn btn-primary full-width" id="pair-button" style="min-width: 175px" disabled>Pair receiver</button>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
Download the accelerometer measurement log here.
</div>
</div>
<div class="row btnrow row-ident">
<div class="col btncol">
<button class="btn btn-primary full-width" id="download-log-button" style="min-width: 175px" disabled>Download log</button>
</div>
</div>
<div class="row row-ident">
<div class="col">
<span id="snapshot-count-transfer">
0 snapshots transferred.
</span>
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="display: none; margin-left: 5px" id="transfer-spinner"></span>
</div>
</div>
</div>
<div class="row bg-light" hidden>
<!-- Seven spans created with an ejs loop named ctrl-reg-0 to ctrl-reg-6 -->
<% for (let i = 0; i < 7; i++) { %>
<div class="row">
<div class="col">
CTRL_REG<%= i %>: <span id="ctrl-reg-<%= i %>-span">-</span>
</div>
</div>
<% } %>
<div class="row btnrow row-ident">
<div class="col btncol">
<button class="btn btn-primary full-width btncol" id="configure-accelerometer-button" style="min-width: 175px">Configure accelerometer</button>
<button class="btn btn-primary full-width btncol" id="download-config-button" style="min-width: 175px">Download configuration</button>
</div>
</div>
</div>
<div class="row bg-light">
<div class="row">
<div class="col">
X measurement: <span id="x-span">-</span> (<span id="x-si-span">-</span>)
</div>
</div>
<div class="row">
<div class="col">
Y measurement: <span id="y-span">-</span> (<span id="y-si-span">-</span>)
</div>
</div>
<div class="row">
<div class="col">
Z measurement: <span id="z-span">-</span> (<span id="z-si-span">-</span>)
</div>
</div>
<div class="row">
<canvas id="accelerationChart"></canvas>
</div>
<div class="row btnrow row-ident">
<div class="col btncol">
<button class="btn btn-primary full-width" id="clear-button" style="min-width: 175px">Clear</button>
</div>
</div>
</div>
<div class="row bg-light" hidden>
<div class="row row-ident">
<textarea id="code-textarea" rows="16" style="font-family: monospace;">
</textarea>
</div>
<div id="output" style="margin-bottom: 10px; font-family: monospace; margin-left: 20px"></div>
</div>
<div class="row bg-light" hidden>
<div class="row">
<div class="col" id="json-text"></div>
</div>
<div class="row btnrow row-ident">
<div class="col btncol">
<button class="btn btn-primary full-width" id="download-button" style="min-width: 175px">Download JSON</button>
</div>
</div>
</div>
</main>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="service-worker.js"></script>
<script src="js/accelerometer/accelerometerUI.js"></script>
</html>