-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathZCAM-controller.html
362 lines (294 loc) · 7.61 KB
/
ZCAM-controller.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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
<html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Z-CAM Controller</title>
<script language="JavaScript">
// Send a request
function httpGet(theUrl, VARf) {
theUrl = theUrl + VARf;
let xmlHttpReq = new XMLHttpRequest();
xmlHttpReq.open("GET", theUrl, false);
xmlHttpReq.send(null);
console.log(VARf);
return xmlHttpReq.responseText;
}
// Send a command to change configuration
function setConfig(command, def) {
theCompleteUrl = 'http://10.98.32.1/ctrl/set?' + command + "=" + def;
let xmlHttpReq = new XMLHttpRequest();
xmlHttpReq.open("GET", theCompleteUrl, false);
xmlHttpReq.send(null);
console.log(theCompleteUrl);
return xmlHttpReq.responseText;
}
// Update the slider
function updateSlider(slideAmount) {
var sliderDiv = document.getElementById("sliderAmount");
sliderDiv.innerHTML = slideAmount;
}
// Display the new value
function DisplayChange(newvalue) {
document.getElementById(
"value").innerHTML = newvalue;
}
// Toggles the checkbox from OFF to ON and vice-versa.
function toggle(checkbox) {
switch (checkbox.value) {
case "ON":
checkbox.value = "OFF";
httpGet('http://10.98.32.1/ctrl/rec?action=','start');
start();
break;
case "OFF":
checkbox.value = "ON";
httpGet('http://10.98.32.1/ctrl/rec?action=','stop');
end();
break;
}
}
// update remaining time
function updateRecRemaining() {
httpGet('http://10.98.32.1/ctrl/rec?action=','remain'); {
if (response.code != 0) {
$("#info_remain").text("00h00m");
$("#info_remain").css("color", "yellow");
} else {
updateRemainLable(response.msg);
}
};
}
// calculate video time
var startTime, endTime;
function start() {
startTime = performance.now();
};
function end() {
endTime = performance.now();
var timeDiff = endTime - startTime; //in ms
// strip the ms
timeDiff /= 1000;
// get seconds
var seconds = Math.round(timeDiff);
console.log(seconds + " seconds");
}
</script>
<style>
body {
margin:5px 5px 0px 5px;
height:100%;
background-color: #3a464f;
font-family: Georgia, "Times New Roman", Times, serif;
color: white;
}
h2 {
border-left: 6px solid DodgerBlue;
border-right: 6px solid DodgerBlue;
text-align: center;
}
h4 {
text-align: left;
margin: 4px 2px;
}
h5 {
text-align: left;
}
p {
text-align: left;
}
.button {
border: white;
border-radius: 4px;
color: white;
padding: 8px 16px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.buttonOthers {
background-color: #3a464f;
border: 1px solid #968c8c;
}
.buttonOthers:hover {
background-color: #008CBA;
color: white;
}
.slidecontainer {
width: 100%;
color: white;
}
.slider {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 15px;
border-radius: 5px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #046daa;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
border-radius: 50%;
background: #046daa;
cursor: pointer;
}
#preview {
position: relative;
width: 75%;
height: 100%;
float: left;
}
#stream {
position: absolute;
width: 100%;
}
#info_bar {
position: relative;
margin: 20px 20px;
color: white;
}
.info {
display: inline;
text-shadow:#000 1px 0px 2px;
}
#info_bar :not(:nth-child(2)) {
margin-left: 2em;
}
#info_bar :first-child {
margin-left: 0px;
}
#info_bar :nth-child(2) {
margin-left: 0.3em;
}
/* toggle in label designing */
.toggle {
position : relative ;
display : inline-block;
width: 100px;
height: 50px;
background-color: rgb(179, 12, 12);
border-radius: 30px;
border: 2px solid gray;
}
/* After slide changes */
.toggle:after {
content: '';
position: absolute;
width: 49px;
height: 48px;
border-radius: 50%;
background-color: gray;
top: 1px;
left: 1px;
transition: all 0.5s;
}
/* Checkbox checked effect */
.checkbox:checked + .toggle::after {
left : 51px;
}
/* Checkbox checked toggle label bg color */
.checkbox:checked + .toggle {
background-color: green;
}
/* Checkbox vanished */
.checkbox {
display : none;
}
</style>
</head>
<h2> Z-CAM Small Controller - 24 July 2022</h2>
<hr>
<center>
<span><strong>Record</strong></span>
<input
type="checkbox"
id="switch"
class="checkbox"
value="ON"
onclick="toggle(this);" />
<label for="switch" class="toggle">
<p>STOP START</p>
</label>
<p class="info" id="seconds">00s</p>
</center>
<hr>
<div class="slidecontainer">
<input type="range"
id="rangeInput"
name="rangeInput"
value="0"
min="-3757"
max="5000"
class="slider"
oninput="DisplayChange(this.value)"
onchange="setConfig('lens_focus_pos', 'value')">
<h4> <strong> Focus Slider </strong> <span id="value">0</span> </h4>
</div>
<hr>
<div>
<button class="button buttonOthers" accesskey="-" onclick="setConfig('mf_drive', +10)" oninput="DisplayChange(this.value)">Focus -</button>
<button class="button buttonOthers" onclick="setConfig('mf_drive', +50)">Focus --</button>
<button class="button buttonOthers" onclick="setConfig('mf_drive', +100)">Focus ---</button>
<button class="button buttonOthers" onclick="setConfig('mf_drive', -100)">Focus +++</button>
<button class="button buttonOthers" onclick="setConfig('mf_drive', -50)">Focus ++</button>
<button class="button buttonOthers" accesskey="+" onclick="setConfig('mf_drive', -10)">Focus +</button>
</div>
<div>
<button class="button buttonOthers" onclick="setConfig('lens_focus_pos', -3757)">Focus MIN</button>
<button class="button buttonOthers" onclick="setConfig('lens_focus_pos', 0)">Focus MED-</button>
<button class="button buttonOthers" onclick="setConfig('lens_focus_pos', 4000)">Focus MED+</button>
<button class="button buttonOthers" onclick="setConfig('lens_focus_pos', 5000)">Infinito</button>
</div>
<div>
<button class="button buttonOthers"
onclick="setConfig('lens_zoom', 'in')">TEST</button>
</div>
<hr>
<div id="preview">
<!--<img id="stream" src="http://10.98.32.1/mjpeg_stream" />--->
<span style="display:inline-block">
<label for=shutter style="display:block">Shutter</label>
<input type=number id="shutter" name="shutter"
value="1" min="1" max="2000"
onchange="setConfig('iris', 'value')"/>
</span>
<span style="display:inline-block">
<label for=aperture style="display:block">Aperture</label>
<input type=number id="aperture" name="aperture"
value="2.8" min="2.8" max="22"
onchange="setConfig('iris', 'value')"/>
</span>
<span style="display:inline-block">
<label for=ISO style="display:block">ISO</label>
<input type=number id="ISO" name="ISO"
value="3200" min="400" max="128000"
onchange="setConfig('iso', 'value')"/>
</span>
<span style="display:inline-block">
<label for=WB style="display:block">WB (K)</label>
<input type=number id="WB" name="WB"
value="3500" min="400" max="128000"
onchange="setConfig('mwb', 'value')"/>
</span>
</div>
</div>
</html>