UnitTest aktualisieren

This commit is contained in:
ChK
2026-04-23 20:45:49 +02:00
parent a16eb53aeb
commit 355925ebb4
8 changed files with 1660 additions and 16 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -12882,3 +12882,164 @@
2026-04-23T18:20:23.981Z ::ffff:172.21.0.6: Ping 2026-04-23T18:20:23.981Z ::ffff:172.21.0.6: Ping
2026-04-23T18:21:06.070Z ::ffff:172.21.0.6: Ping 2026-04-23T18:21:06.070Z ::ffff:172.21.0.6: Ping
2026-04-23T18:21:06.071Z ::ffff:172.21.0.6: Ping 2026-04-23T18:21:06.071Z ::ffff:172.21.0.6: Ping
2026-04-23T18:22:05.973Z ::ffff:172.21.0.6: Ping
2026-04-23T18:22:05.974Z ::ffff:172.21.0.6: Ping
2026-04-23T18:23:05.969Z ::ffff:172.21.0.6: Ping
2026-04-23T18:23:05.969Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:13.968Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:13.969Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:18.971Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:18.971Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:23.964Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:23.965Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:28.960Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:39.960Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:40.494Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:44.958Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:45.497Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:49.959Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:50.499Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:54.968Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:55.506Z ::ffff:172.21.0.6: Ping
2026-04-23T18:24:59.961Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:00.496Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:04.964Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:05.493Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:10.491Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:15.489Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:20.493Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:25.488Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:30.564Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:35.558Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:40.500Z ::ffff:172.21.0.6: Ping
2026-04-23T18:25:48.973Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:05.978Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:06.718Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:11.712Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:16.724Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:21.713Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:26.781Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:31.758Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:36.710Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:41.733Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:46.717Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:51.768Z ::ffff:172.21.0.6: Ping
2026-04-23T18:26:56.786Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:01.717Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:05.980Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:06.724Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:11.706Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:16.752Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:21.725Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:26.787Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:31.712Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:36.823Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:41.723Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:46.718Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:51.711Z ::ffff:172.21.0.6: Ping
2026-04-23T18:27:56.713Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:01.721Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:05.964Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:06.725Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:11.741Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:16.760Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:21.716Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:26.716Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:31.813Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:36.719Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:41.715Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:46.716Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:51.717Z ::ffff:172.21.0.6: Ping
2026-04-23T18:28:56.716Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:01.720Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:05.965Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:06.705Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:11.711Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:16.724Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:21.738Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:26.755Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:31.721Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:36.734Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:41.719Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:46.768Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:51.712Z ::ffff:172.21.0.6: Ping
2026-04-23T18:29:56.802Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:01.719Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:05.964Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:06.736Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:11.753Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:16.772Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:21.966Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:26.974Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:31.965Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:36.963Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:41.969Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:46.959Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:51.961Z ::ffff:172.21.0.6: Ping
2026-04-23T18:30:56.973Z ::ffff:172.21.0.6: Ping
2026-04-23T18:31:02.030Z ::ffff:172.21.0.6: Ping
2026-04-23T18:31:05.981Z ::ffff:172.21.0.6: Ping
2026-04-23T18:31:07.027Z ::ffff:172.21.0.6: Ping
2026-04-23T18:31:12.067Z ::ffff:172.21.0.6: Ping
2026-04-23T18:31:16.982Z ::ffff:172.21.0.6: Ping
2026-04-23T18:32:05.985Z ::ffff:172.21.0.6: Ping
2026-04-23T18:32:05.985Z ::ffff:172.21.0.6: Ping
2026-04-23T18:33:06.055Z ::ffff:172.21.0.6: Ping
2026-04-23T18:33:06.055Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:14.031Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:14.032Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:18.967Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:18.968Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:23.956Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:23.957Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:28.964Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:28.965Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:33.974Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:33.975Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:38.974Z ::ffff:172.21.0.6: Ping
2026-04-23T18:34:38.975Z ::ffff:172.21.0.6: Ping
2026-04-23T18:35:05.961Z ::ffff:172.21.0.6: Ping
2026-04-23T18:35:05.962Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:13.978Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:13.980Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:18.978Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:18.979Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:23.981Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:23.981Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:28.976Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:28.978Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:34.034Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:34.035Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:38.992Z ::ffff:172.21.0.6: Ping
2026-04-23T18:36:38.993Z ::ffff:172.21.0.6: Ping
2026-04-23T18:37:06.024Z ::ffff:172.21.0.6: Ping
2026-04-23T18:37:06.024Z ::ffff:172.21.0.6: Ping
2026-04-23T18:38:06.001Z ::ffff:172.21.0.6: Ping
2026-04-23T18:38:14.004Z ::ffff:172.21.0.6: Ping
2026-04-23T18:38:18.989Z ::ffff:172.21.0.6: Ping
2026-04-23T18:38:23.999Z ::ffff:172.21.0.6: Ping
2026-04-23T18:38:29.019Z ::ffff:172.21.0.6: Ping
2026-04-23T18:38:34.065Z ::ffff:172.21.0.6: Ping
2026-04-23T18:38:39.084Z ::ffff:172.21.0.6: Ping
2026-04-23T18:39:05.995Z ::ffff:172.21.0.6: Ping
2026-04-23T18:39:05.996Z ::ffff:172.21.0.6: Ping
2026-04-23T18:40:06.013Z ::ffff:172.21.0.6: Ping
2026-04-23T18:40:14.003Z ::ffff:172.21.0.6: Ping
2026-04-23T18:40:19.002Z ::ffff:172.21.0.6: Ping
2026-04-23T18:40:24.015Z ::ffff:172.21.0.6: Ping
2026-04-23T18:40:29.006Z ::ffff:172.21.0.6: Ping
2026-04-23T18:40:34.004Z ::ffff:172.21.0.6: Ping
2026-04-23T18:40:39.109Z ::ffff:172.21.0.6: Ping
2026-04-23T18:41:06.013Z ::ffff:172.21.0.6: Ping
2026-04-23T18:41:06.015Z ::ffff:172.21.0.6: Ping
2026-04-23T18:42:06.017Z ::ffff:172.21.0.6: Ping
2026-04-23T18:42:06.019Z ::ffff:172.21.0.6: Ping
2026-04-23T18:43:13.131Z ::ffff:172.21.0.6: Ping
2026-04-23T18:43:14.052Z ::ffff:172.21.0.6: Ping
2026-04-23T18:43:19.070Z ::ffff:172.21.0.6: Ping
2026-04-23T18:43:24.020Z ::ffff:172.21.0.6: Ping
2026-04-23T18:43:29.027Z ::ffff:172.21.0.6: Ping
2026-04-23T18:43:34.115Z ::ffff:172.21.0.6: Ping
2026-04-23T18:43:39.032Z ::ffff:172.21.0.6: Ping
2026-04-23T18:44:06.022Z ::ffff:172.21.0.6: Ping
2026-04-23T18:45:06.032Z ::ffff:172.21.0.6: Ping

View File

@@ -85,7 +85,7 @@ class GCode{
if(g == undefined) return; if(g == undefined) return;
if(g.length == 0) return; if(g.length == 0) return;
console.log("🔵 GCode.receiveGCode: Incoming command: " + g); // console.log("🔵 GCode.receiveGCode: Incoming command: " + g); // Moved to InputWS
g = g.toString("utf8"); g = g.toString("utf8");
@@ -129,7 +129,7 @@ class GCode{
if(s.toUpperCase().includes("B")){ robot.theta += Number(s.substring(1, s.length)); robot.bMotorChanged = true;} if(s.toUpperCase().includes("B")){ robot.theta += Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.psi += Number(s.substring(1, s.length)); robot.cMotorChanged = true;} if(s.toUpperCase().includes("C")){ robot.psi += Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e += Number(s.substring(1, s.length)); robot.eMotorChanged = true;} if(s.toUpperCase().includes("E")){ robot.e += Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
if(s.toUpperCase().includes("F")){ robot.feedrate = Number(s.substring(1, s.length)); console.log(" 📌 Feedrate set to: " + robot.feedrate); } if(s.toUpperCase().includes("F")){ robot.feedrate = Number(s.substring(1, s.length));}
}); });
} }
else if(g[0] == "M1" && robot.moveRelative){ else if(g[0] == "M1" && robot.moveRelative){
@@ -156,7 +156,7 @@ class GCode{
if(s.toUpperCase().includes("B")){ robot.theta = Number(s.substring(1, s.length)); robot.bMotorChanged = true;} if(s.toUpperCase().includes("B")){ robot.theta = Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.psi = Number(s.substring(1, s.length)); robot.cMotorChanged = true;} if(s.toUpperCase().includes("C")){ robot.psi = Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e = Number(s.substring(1, s.length)); robot.eMotorChanged = true;} if(s.toUpperCase().includes("E")){ robot.e = Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
if(s.toUpperCase().includes("F")){ robot.feedrate = Number(s.substring(1, s.length)); console.log(" 📌 Feedrate set to: " + robot.feedrate); } if(s.toUpperCase().includes("F")){ robot.feedrate = Number(s.substring(1, s.length)); }
}); });
} }
else if(g[0] == "M1" && !robot.moveRelative){ else if(g[0] == "M1" && !robot.moveRelative){

View File

@@ -216,7 +216,7 @@ module.exports = class TelnetSenderGRBL{
// abhngig vom FluidNC und dessen speed interpretation ist. // abhngig vom FluidNC und dessen speed interpretation ist.
} }
if(data.indexOf("G90") == -1){ if(data.indexOf("G90") == -1 && data.indexOf("G1 ") > 0){
data = "G90 " + data; data = "G90 " + data;
} }

View File

@@ -331,17 +331,16 @@ module.exports = class TelnetSenderGRBL{
data += " f"+(maxSpeedF.toFixed(2).toString()) data += " f"+(maxSpeedF.toFixed(2).toString())
dataStr = data.toString("utf-8");
if(this.tSocket && dataStr.length > 3){ if(this.tSocket && data.length > 3){
// Ensure that the command starts with G90 (absolute positioning) if it's not already included // Ensure that the command starts with G90 (absolute positioning) if it's not already included
if(dataStr.indexOf("G90") == -1){ if(data.indexOf("G90") == -1){
dataStr = "G90 " + dataStr; data = "G90 " + data;
} }
console.log("Driver send to 🤖 " + this.urlGRBLstr + " the message: " + data.toString("utf-8")) console.log("Driver send to 🤖 " + this.urlGRBLstr + " the message: " + data)
this.tSocket.write( data.toString("utf-8") + "\r\n"); this.tSocket.write( data + "\r\n");
} }
} }
} }

View File

@@ -28,7 +28,7 @@ function initInputWS(server, robot, GCode, sharedState) {
/* ---------- GCode ---------- */ /* ---------- GCode ---------- */
if (GCode.containsCommand(message)) { if (GCode.containsCommand(message)) {
logCommand(sharedState, clientIP, message); console.log("🔵 GCode.receiveGCode: Incoming command: " + message);
GCode.receiveGCode(robot, message); GCode.receiveGCode(robot, message);
broadcast(wss, GCode.getM114(robot)); broadcast(wss, GCode.getM114(robot));
return; return;

View File

@@ -33,7 +33,7 @@ describe("TelnetSenderGRBL.execCommand - caseBackward", () => {
// y: 0.203 * 180 / PI ≈ 11.64 // y: 0.203 * 180 / PI ≈ 11.64
// z: (-0.192 * 180 / PI) - (0.203 * 180 / PI) ≈ -10.99 - 11.64 ≈ -22.63 // z: (-0.192 * 180 / PI) - (0.203 * 180 / PI) ≈ -10.99 - 11.64 ≈ -22.63
console.log("Actual output:", sender.tSocket.written); console.log("Actual output:", sender.tSocket.written);
expect(sender.tSocket.written).toBe("G1 x0.00 y11.63 z-22.63 f100.00\r\n"); expect(sender.tSocket.written.replace("G90 ","")).toBe("G1 x0.00 y11.63 z-22.63 f100.00\r\n");
}); });
}); });

View File

@@ -23,7 +23,7 @@ describe("WS-SenderGRBL.execCommand", () => {
sender.execCommand("G1", mOld, mNew); sender.execCommand("G1", mOld, mNew);
// ✅ verify output // ✅ verify output
expect(sender.tSocket.written).toBe("G1 x12.34 y57.30 z57.30 f2300.00\r\n"); expect(sender.tSocket.written).toBe("G90 G1 x12.34 y57.30 z57.30 f2300.00\r\n");
}); });
@@ -47,7 +47,7 @@ describe("WS-SenderGRBL.execCommand", () => {
sender.execCommand("G1", mOld, mNew); sender.execCommand("G1", mOld, mNew);
// ✅ verify output // ✅ verify output
expect(sender.tSocket.written).toBe("G1 x22.50 f2300.00\r\n"); expect(sender.tSocket.written).toBe("G90 G1 x22.50 f2300.00\r\n");
}); });
test("writes correct G-code G92 to mocked WS tSocket", () => { test("writes correct G-code G92 to mocked WS tSocket", () => {
@@ -70,7 +70,7 @@ describe("WS-SenderGRBL.execCommand", () => {
sender.execCommand("G92", mOld, mNew); sender.execCommand("G92", mOld, mNew);
// ✅ verify output // ✅ verify output
expect(sender.tSocket.written).toBe("G92 x12.34 y57.30 z57.30 f2300.00\r\n"); expect(sender.tSocket.written.replace("G90 ","")).toBe("G92 x12.34 y57.30 z57.30 f2300.00\r\n");
}); });
}); });