guest_worker/www/config/control.html

113 lines
3.2 KiB
HTML
Raw Permalink Normal View History

2021-10-17 10:37:08 +02:00
<!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;
2021-10-20 10:03:45 +02:00
font-size: 30px;
}
main{
width: 700px;
margin: 50px auto;
2021-10-17 10:37:08 +02:00
}
a{
background-color:lightblue;
2021-10-20 10:03:45 +02:00
color:white;
text-decoration: none;
2021-10-17 10:37:08 +02:00
cursor: pointer;
2021-10-20 10:03:45 +02:00
padding: 5px;
border-radius: 5px;
}
a:hover{
background-color: blue;
}
a:active{
background-color: red;;
}
li{
margin-top: 50px;
2021-10-17 10:37:08 +02:00
}
</style>
<script src="../worker_specs/reconnecting-websocket.min.js"></script>
<script>
2021-10-17 10:39:37 +02:00
let ws = new ReconnectingWebSocket('ws://'+location.hostname+':'+location.port+'/config/ws')
2021-10-17 10:37:08 +02:00
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;
})
2021-10-20 10:03:45 +02:00
function disablemotors(el) {
2021-10-17 10:37:08 +02:00
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',
}));
}
2021-10-20 10:03:45 +02:00
function stopServer() {
ws.send(JSON.stringify({
'action': 'stop',
}));
}
2021-10-17 10:37:08 +02:00
</script>
</head>
<body>
<main>
<h1>Guest Worker Control Panel</h1>
<ol>
2021-10-20 10:03:45 +02:00
<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>
2021-10-17 10:37:08 +02:00
<li><a href="/backend">Exit setup</a></li>
</ol>
2021-10-20 10:03:45 +02:00
<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>
2021-10-17 10:37:08 +02:00
</main>
</body>
</html>