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;
|
|
|
|
}
|
|
|
|
a{
|
|
|
|
background-color:lightblue;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
</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;
|
|
|
|
})
|
|
|
|
|
|
|
|
function disablemotors() {
|
|
|
|
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',
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<main>
|
|
|
|
<h1>Guest Worker Control Panel</h1>
|
|
|
|
<ol>
|
|
|
|
<li><a onclick="disablemotors()">Disable motors</a> & double check pen position is at 0,0 (bottom right, as seen from the inside)</li>
|
|
|
|
<li><a onclick="resetPenPosition()">Reset Pen position</a> to make sure it's in start position</li>
|
|
|
|
<li><a onclick="testScanner()">Test scanner</a></li>
|
|
|
|
<li><a onclick="startServer()">Start the server!</a></li>
|
|
|
|
<li><a href="/backend">Exit setup</a></li>
|
|
|
|
</ol>
|
|
|
|
</main>
|
|
|
|
</body>
|
|
|
|
</html>
|