Command handeling
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>2D Robot Control</title>
|
||||
<title>FluidNC Robot Control</title>
|
||||
<style>
|
||||
body {
|
||||
background: #234;
|
||||
@@ -91,6 +91,7 @@
|
||||
|
||||
<div id="posBox">
|
||||
<div>X: <span id="posX">0.000</span></div>
|
||||
<div>Y: <span id="posY">0.000</span></div>
|
||||
<div>Z: <span id="posZ">0.000</span></div>
|
||||
</div>
|
||||
|
||||
@@ -103,6 +104,12 @@
|
||||
<button onclick="jog('X', 1)">X +1</button>
|
||||
<button onclick="jog('X', 10)">X +10</button>
|
||||
|
||||
<button onclick="jog('Y', -10)">Y -10</button>
|
||||
<button onclick="jog('Y', -1)">Y -1</button>
|
||||
<button class="noMouseHover"></button>
|
||||
<button onclick="jog('Y', 1)">Y +1</button>
|
||||
<button onclick="jog('Y', 10)">Y +10</button>
|
||||
|
||||
<button onclick="jog('Z', -10)">Z -10</button>
|
||||
<button onclick="jog('Z', -1)">Z -1</button>
|
||||
<button class="noMouseHover"></button>
|
||||
@@ -180,8 +187,8 @@
|
||||
// 1) Versuche WPos direkt zu lesen
|
||||
const wposMatch = line.match(/WPos:([^|>]+)/);
|
||||
if (wposMatch) {
|
||||
const [x, , z] = wposMatch[1].split(",").map(Number);
|
||||
updateXZ(x, z);
|
||||
const [x, y, z] = wposMatch[1].split(",").map(Number);
|
||||
updateXZ(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -194,16 +201,19 @@
|
||||
const wco = wcoMatch[1].split(",").map(Number);
|
||||
|
||||
const x = (mpos[0] ?? 0) - (wco[0] ?? 0);
|
||||
const y = (mpos[1] ?? 0) - (wco[1] ?? 0);
|
||||
const z = (mpos[2] ?? 0) - (wco[2] ?? 0);
|
||||
|
||||
updateXZ(x, z);
|
||||
updateXZ(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
function updateXZ(x, z) {
|
||||
function updateXZ(x, y, z) {
|
||||
const elX = document.getElementById("posX");
|
||||
const elY = document.getElementById("posY");
|
||||
const elZ = document.getElementById("posZ");
|
||||
if (elX) elX.textContent = Number.isFinite(x) ? x.toFixed(3) : "—";
|
||||
if (elY) elY.textContent = Number.isFinite(y) ? y.toFixed(3) : "—";
|
||||
if (elZ) elZ.textContent = Number.isFinite(z) ? z.toFixed(3) : "—";
|
||||
}
|
||||
|
||||
@@ -226,7 +236,7 @@
|
||||
}
|
||||
|
||||
function setZero() {
|
||||
sendGcode("G92 X0 Z0");
|
||||
sendGcode("G92 X0 Y0 Z0");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user