Speed testen (anfang)

This commit is contained in:
ChK
2026-04-10 07:20:23 +02:00
parent 753952d4ac
commit 9328747fe6
5 changed files with 121 additions and 15 deletions

View File

@@ -38,6 +38,45 @@ describe('GCode Speed Tests', () => {
// But since x,y,z changed, telnetSender1 should have the command
});
test('G1 with Feedrate F300 - mit env', () => {
const previousValue = process.env.ROBOT_USE_SPEED_CALC;
process.env.ROBOT_USE_SPEED_CALC = 'true';
const L1 = 300;
const L2 = 300;
const L3 = 20;
const Robot2 = require('../robot/Robot'); // neu geladen
const robot = new Robot2(L1, L2, L3);
const telnetSender1 = new TelnetSender("test.test", 5000, "x", "y", "z");
robot.cmdReceivers.push(telnetSender1);
// G1 with F300
robot.useSpeedCalc = true; // Aktiviere die neue Logik
GCode.receiveGCode(robot, "G90 G1 x0 f700"); // Absolut!!
GCode.receiveGCode(robot, "G91 G1 x120 f700"); // relativ!!
// Check telnetSender1 (x,y,z axes)
expect(telnetSender1.tSocket.written).toContain('G1');
expect(telnetSender1.tSocket.written).toContain('f700');
expect(telnetSender1.tSocket.written).toMatch(/f700\.00/); // Exact format
// telnetSender2 and telnetSender3 might not have output if no changes
// But since x,y,z changed, telnetSender1 should have the command
if (previousValue === undefined) {
delete process.env.ROBOT_USE_SPEED_CALC;
} else {
process.env.ROBOT_USE_SPEED_CALC = previousValue;
}
});
test('G1 without Feedrate - should use default f200', () => {
const L1 = 300;
const L2 = 300;