nur wenn xyz genaendert, dann senden

This commit is contained in:
ChK
2026-04-07 09:30:46 +02:00
parent 3d33ecd747
commit a47c168a22
11 changed files with 250 additions and 159 deletions

View File

@@ -55,7 +55,7 @@ describe("Robot G92", () => {
});
// G92 y2.8 z131.0
test("ReadPosition -> G92()", () => {
test("ReadPosition -> G92() test ob nur bestimmte Achsen gesendet werden", () => {
// === Instanz A: Vorwärts-Kinematik (XYZ -> Motorwinkel) ===
const L1 = 300;
@@ -75,14 +75,43 @@ describe("Robot G92", () => {
GCode.receiveGCode(robot,"M92 y0.049 z2.286");
const strExpect1 = 'G92 x0.00 y2.81 z128.17\r\n';
//const strExpect1 = 'G92 x0.00 y2.81 z128.17\r\n';
const strExpect1 = 'G92 y2.81 z128.17\r\n'; // x soll eben nicht gesendet werden.
const strExpect2 = 'G92 y2.81 z128.17\r\n';
allowedValues = [strExpect1, strExpect2];
expect(allowedValues).toContain(telnetSender1.tSocket.written);
expect(telnetSender2.tSocket.written.length).toBe(0); // kein GCode für Ellbow
// ("Wenn nur G92 x3 gegeben wird, dann wird trotzdem auch y und z gesendet. schlecht." );
});
// G92 y2.8 z131.0
test("ReadPosition -> G92() test ob nur bestimmte Achsen gesendet werden", () => {
// === Instanz A: Vorwärts-Kinematik (XYZ -> Motorwinkel) ===
const L1 = 300;
const L2 = 300;
const L3 = 20;
const robot = new Robot(L1, L2, L3)
var telnetSender1 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 2300, xAxisGrbl = "x", yAxisGrbl = "y", zAxisGrbl = "z");
var telnetSender2 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 5000, xAxisGrbl = "a", yAxisGrbl = null, zAxisGrbl = null);
var telnetSender3 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 5000, xAxisGrbl = "c", yAxisGrbl = "e", zAxisGrbl = "b");
robot.cmdReceivers.push(telnetSender1);
robot.cmdReceivers.push(telnetSender2);
robot.cmdReceivers.push(telnetSender3);
GCode.receiveGCode(robot,"M92 a0.20");
expect(telnetSender1.tSocket.written.length).toBe(0); // kein GCode für XYZ
expect(telnetSender2.tSocket.written).toBe('G92 x11.46\r\n');
expect(telnetSender3.tSocket.written.length).toBe(0); // kein GCode für XYZ
// ("Wenn nur G92 x3 gegeben wird, dann wird trotzdem auch y und z gesendet. schlecht." );
});
});