-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
136 lines (121 loc) · 4.96 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
// ===== Edit this values for your needs ======
var step = 1;
var feed = 1000;
var zed_feed = 500;
var spin_on = false;
// Need to set this if you place this file outside of esp-link internal web server
// For example:
// var your_esp_link_host = 'http://esp-link.local/'
var your_esp_link_host = '/';
var cmd = {
xp: '$J=G21G91X[STEP]Y0Z0F[FEED]',
xm: '$J=G21G91X-[STEP]Y0Z0F[FEED]',
yp: '$J=G21G91X0Y[STEP]Z0F[FEED]',
ym: '$J=G21G91X0Y-[STEP]Z0F[FEED]',
zu: '$J=G21G91X0Y0Z[STEP]F[ZED_FEED]',
zd: '$J=G21G91X0Y0Z-[STEP]F[ZED_FEED]',
hm: '$J=G90Z15F[ZED_FEED];$J=G90X0Y0Z15F[ZED_FEED]',
prb: 'G21G91G38.2Z-30F80;%0D%0AG0Z0.5;%0D%0AG38.2Z-1F5',
z_z: 'G92Z0%3B%20$#',
rst: '$X',
xy_z: 'G92X0Y0%3B%20$#',
spn_on: 'M3 S1000',
spn_off: 'M5'
};
function ch_sp(val) {
step = val;
document.getElementsByName('speed')[0].innerHTML = step;
}
function spin_on_off() {
if (spin_on) {
ss('spn_off');
spin_on = false;
} else {
ss('spn_on');
spin_on = true;
}
}
function ss(val) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
return;
}
xmlHttp.open("GET", your_esp_link_host + "console/send?text=" + cmd[val].replace(/\[FEED\]/g, feed).replace(/\[STEP\]/g, step).replace(/\[ZED_FEED\]/g, zed_feed) + ';%0D%0A', true); // true for asynchronous
xmlHttp.send(null);
console.log("/console/send?text=" + cmd[val].replace(/\[FEED\]/g, feed).replace(/\[STEP\]/g, step).replace(/\[ZED_FEED\]/g, zed_feed));// + "%0D%0A");
}
</script>
</head>
<body>
<!--
<a name=$$ onclick="ss(this.name)"> <<< </a>
<button name=plom onclick="ss(this.name)">Не давай мне лог!</button>
-->
<table class="xy_axis">
<tr>
<td name="speed">1</td>
<td><button name="yp" onclick="ss(this.name);">⇑</button></td>
<td />
<td><button name="zu" onclick="ss(this.name);">Z+</button></td>
</tr>
<tr>
<td><button name="xm" onclick="ss(this.name);">⇐</button></td>
<td><button name="tmp" onclick="spin_on_off();">SPN</button></td>
<td><button name="xp" onclick="ss(this.name);">⇒</button></td>
</tr>
<tr>
<td />
<td><button name="ym" onclick="ss(this.name);">⇓</button></td>
<td />
<td><button name="zd" onclick="ss(this.name);">Z-</button></td>
</tr>
</table>
<hr/>
<table>
<tr style="margin-top: 10px;">
<td><button onclick="ch_sp(this.innerHTML);">0.025</button></td>
<td><button onclick="ch_sp(this.innerHTML);">0.1</button></td>
<td><button onclick="ch_sp(this.innerHTML);">1 </button></td>
<td><button onclick="ch_sp(this.innerHTML);">5 </button></td>
<td><button onclick="ch_sp(this.innerHTML);">10 </button></td>
</tr>
</table>
<hr/>
<table>
<tr>
<td><button name="hm" onclick="ss(this.name);">🏠</button></td>
<td><button name="xy_z" onclick="ss(this.name);">XY ø</button></td>
<td><button name="prb" onclick="ss(this.name);">Probe</button></td>
<td><button name="z_z" onclick="ss(this.name);">Z ø</button></td>
</tr>
<tr>
<td><button name="rst" onclick="ss(this.name);">Reset</button></td>
</tr>
</table>
</body>
<style>
button {
width: 100%;
}
table {
border: 0;
width: 95%;
margin-top: 10px;
margin-left: 10px;
}
td {
width: 18%;
}
td.btn {
text-align: center;
border: 1px;
background: lightgray;
}
</style>
</html>