-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainPageHtml.h
239 lines (228 loc) · 7.02 KB
/
MainPageHtml.h
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
const char MAIN_page[] = R"=====(
<!DOCTYPE html>
<html>
<body>
<div id="demo">
<h1>Pixel Tilt Photo Sphere</h1>
<table style="width:85%">
<caption>Motor Actions</caption>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="sendData(0, 2, 1000)" class="MoveButtons">Up 1000</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="sendData(0, 2, 500)" class="MoveButtons">Up 500</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="sendData(0, 2, 100)" class="MoveButtons">Up 100</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="sendData(0, 2, 10)" class="MoveButtons">Up 10</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td><button type="button" onclick="sendData(0, 1, 1000)" class="MoveButtons">Left 1000</button></td>
<td><button type="button" onclick="sendData(0, 1, 500)" class="MoveButtons">Left 500</button></td>
<td><button type="button" onclick="sendData(0, 1, 100)" class="MoveButtons">Left 100</button></td>
<td><button type="button" onclick="sendData(0, 1, 10)" class="MoveButtons">Left 10</button></td>
<td></td>
<td><button type="button" onclick="sendData(1, 1, 10)" class="MoveButtons">Right 10</button></td>
<td><button type="button" onclick="sendData(1, 1, 100)" class="MoveButtons">Right 100</button></td>
<td><button type="button" onclick="sendData(1, 1, 500)" class="MoveButtons">Right 500</button></td>
<td><button type="button" onclick="sendData(1, 1, 1000)" class="MoveButtons">Right 1000</button></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="sendData(1, 2, 10)" class="MoveButtons">Down 10</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="sendData(1, 2, 100)" class="MoveButtons">Down 100</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="sendData(1, 2, 500)" class="MoveButtons">Down 500</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td><button type="button" onclick="sendData(1, 2, 1000)" class="MoveButtons">Down 1000</button></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
<span id="PhotoProcessResult">NA</span>
<br/>
<br/>
<label>Time Delay</label>
<input id="TimeDelayClock" value="100"/>
<label>Steps</label>
<input id="clockStepsClock" value="10"/>
<button type="button" onclick="sendDataOld(1)">Turn Clockwise</button>
<br/>
<br/>
<br/>
<label>Time Delay</label>
<input id="TimeDelayCount" value="100"/>
<label>Steps</label>
<input id="clockStepsCount" value="10"/>
<button type="button" onclick="sendDataOld(0)">Turn Counter Clock</button><BR>
<br/>
<br/>
<label>Motor Number</label>
<input id="MotorNumber" value="1"/>
<br/>
<br/>
<label>Photo Actions</label>
<div class="input_wrap">
<input type="text" id="PhotoActions" value="%PhotoActions%"/>
</div>
<button type="button" onclick="updateActions()">Set Actions</button><BR>
<span id="actionsState">NA</span>
<br/>
<br/>
<button type="button" onclick="RunPhotoTake()">Run Photo Procoess</button><BR>
<span id="PhotoProcessResult">NA</span>
</div>
<br/>
<br/>
<br/>
<div>
ADC Value is : <span id="ADCValue">0</span><br>
LED State is : <span id="LEDState">NA</span>
</div>
<script>
function sendData(rotation, motorNumber, rotateValue) {
document.getElementById("LEDState").innerHTML = "Processing"
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("LEDState").innerHTML = this.responseText;
}
};
var delayValue = 10;
xhttp.open("GET", "SetMotorLocation?CLOCK=" + rotation + "&STEPS=" + rotateValue + "&TIMEDELAY=" + delayValue + "&MOTORNUMBER=" + motorNumber, true);
xhttp.send();
}
function sendDataOld(rotation) {
document.getElementById("LEDState").innerHTML = "Processing"
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("LEDState").innerHTML = this.responseText;
}
};
var rotateValue = document.getElementById("clockStepsClock").value;
var delayValue = document.getElementById("TimeDelayClock").value;
var motorNumber = document.getElementById("MotorNumber").value;
if(rotation == 0){
rotateValue = document.getElementById("clockStepsCount").value;
delayValue = document.getElementById("TimeDelayCount").value;
}
xhttp.open("GET", "SetMotorLocation?CLOCK=" + rotation + "&STEPS=" + rotateValue + "&TIMEDELAY=" + delayValue + "&MOTORNUMBER=" + motorNumber, true);
xhttp.send();
}
function updateActions() {
document.getElementById("actionsState").innerHTML = "Processing"
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("actionsState").innerHTML = this.responseText;
}
};
var actionsValue = document.getElementById("PhotoActions").value;
xhttp.open("GET", "SetPhotoActions?ACTIONS=" + actionsValue + "", true);
xhttp.send();
}
function RunPhotoTake() {
document.getElementById("PhotoProcessResult").innerHTML = "Processing"
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("PhotoProcessResult").innerHTML = this.responseText;
}
};
xhttp.open("GET", "RunPhotoSphere", true);
xhttp.send();
}
</script>
<style>
td {
padding: 10px;
width: 100%;
align: center;
}
button {
width: 150px;
height: 55px;
text-align: center;
}
div {
padding: 6px 17px; /* equal to negative input's margin for mimic normal `div` box-sizing */
}
input {
width: 100%; /* force to expand to container's width */
border: 7px solid #DFDFDF;
padding: 0 10px;
margin: 0 -17px; /* negative margin = border-width + horizontal padding */
}
</style>
<br><br>
</body>
</html>
)=====";