113 lines
No EOL
3.2 KiB
HTML
113 lines
No EOL
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>GW - Control</title>
|
|
<style>
|
|
:root{
|
|
font-family: sans-serif;
|
|
background-color: black;
|
|
color: white;
|
|
font-size: 30px;
|
|
}
|
|
main{
|
|
width: 700px;
|
|
margin: 50px auto;
|
|
}
|
|
a{
|
|
background-color:lightblue;
|
|
color:white;
|
|
text-decoration: none;
|
|
cursor: pointer;
|
|
padding: 5px;
|
|
border-radius: 5px;
|
|
}
|
|
a:hover{
|
|
background-color: blue;
|
|
}
|
|
a:active{
|
|
background-color: red;;
|
|
}
|
|
li{
|
|
margin-top: 50px;
|
|
}
|
|
</style>
|
|
<script src="../worker_specs/reconnecting-websocket.min.js"></script>
|
|
<script>
|
|
|
|
let ws = new ReconnectingWebSocket('ws://'+location.hostname+':'+location.port+'/config/ws')
|
|
|
|
|
|
ws.addEventListener('open', () => {
|
|
// ws.send('hi server')
|
|
})
|
|
|
|
|
|
ws.addEventListener('message', (event) => {
|
|
console.log('message: ' + event.data)
|
|
|
|
let hits = JSON.parse(event.data)
|
|
let a = {};
|
|
for(let hitid in app.hits) {
|
|
a[hitid] = app.hits[hitid];
|
|
}
|
|
for(let hit of hits){
|
|
a[hit.id] = hit;
|
|
}
|
|
app.hits = a;
|
|
})
|
|
|
|
function disablemotors(el) {
|
|
ws.send(JSON.stringify({
|
|
'action': 'disable_motors',
|
|
}));
|
|
}
|
|
function resetPenPosition() {
|
|
ws.send(JSON.stringify({
|
|
'action': 'enable_motors',
|
|
}));
|
|
}
|
|
function testScanner() {
|
|
ws.send(JSON.stringify({
|
|
'action': 'scanner_test',
|
|
}));
|
|
}
|
|
function startServer() {
|
|
ws.send(JSON.stringify({
|
|
'action': 'start',
|
|
}));
|
|
}
|
|
function stopServer() {
|
|
ws.send(JSON.stringify({
|
|
'action': 'stop',
|
|
}));
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1>Guest Worker Control Panel</h1>
|
|
<ol>
|
|
<li><a onclick="disablemotors(this)">Disable motors</a> </li>
|
|
<li>Place pen in the holder and move it to position 0,0 (bottom left, as seen from the outside)</li>
|
|
<li><a onclick="resetPenPosition()">Pen to start position</a> [pen should now move to top right position]</li>
|
|
<li>Power on scanner, verify cog position</li>
|
|
<li><a onclick="testScanner()">Test scanner</a> - if it blinks orange: turn it off by holding power; turn on again and retry</li>
|
|
<li><a onclick="startServer()">Start the work!</a></li>
|
|
<li><a href="/backend">Exit setup</a></li>
|
|
</ol>
|
|
<br>
|
|
<br>
|
|
<hr>
|
|
|
|
<br>
|
|
<br>
|
|
<h3>Stop</h3>
|
|
<ol>
|
|
<li><a onclick="stopServer()">Stop the work</a> ... then wait a few minutes before powering off computer</li>
|
|
</ol>
|
|
</main>
|
|
</body>
|
|
</html> |