Emergency Stop

This commit is contained in:
chk
2026-06-12 18:16:15 +02:00
parent 6fc6605080
commit 59d4cf7df4
17 changed files with 1098 additions and 540 deletions

View File

@@ -177,3 +177,39 @@ describe('RobotConfig.load — heartbeatInterval', () => {
expect(cfg.controllers.base.heartbeatInterval).toBe(10000);
});
});
describe('RobotConfig.load — emergencyStop (Shelly)', () => {
test('DEFAULTS.controllers.emergencyStop hat protocol=shelly und url=null', () => {
expect(DEFAULTS.controllers.emergencyStop.protocol).toBe('shelly');
expect(DEFAULTS.controllers.emergencyStop.url).toBeNull();
});
test('emergencyStop.url aus robot.json wird übernommen', () => {
const shellyUrl = 'http://shelly.local/rpc/Switch.Set?id=0&on=false';
const json = {
...FULL_ROBOT_JSON,
controllers: {
...FULL_ROBOT_JSON.controllers,
emergencyStop: { protocol: 'shelly', url: shellyUrl }
}
};
const cfg = load(makeFs(JSON.stringify(json)), {}, log);
expect(cfg.controllers.emergencyStop.protocol).toBe('shelly');
expect(cfg.controllers.emergencyStop.url).toBe(shellyUrl);
});
test('fehlendes emergencyStop in robot.json → url=null (Default)', () => {
// FULL_ROBOT_JSON hat kein emergencyStop → fällt auf Default zurück
const cfg = load(makeFs(JSON.stringify(FULL_ROBOT_JSON)), {}, log);
expect(cfg.controllers.emergencyStop.protocol).toBe('shelly');
expect(cfg.controllers.emergencyStop.url).toBeNull();
});
test('emergencyStop hat keine ip/port/axes/heartbeatInterval Felder', () => {
const cfg = load(makeFailFs(), {}, log);
expect(cfg.controllers.emergencyStop.ip).toBeUndefined();
expect(cfg.controllers.emergencyStop.port).toBeUndefined();
expect(cfg.controllers.emergencyStop.axes).toBeUndefined();
expect(cfg.controllers.emergencyStop.heartbeatInterval).toBeUndefined();
});
});