对齐 gmoccapy XYZAB 模式互锁

This commit is contained in:
2026-06-26 18:19:49 -04:00
parent 0664ea9bd7
commit 544bfd4b4b
13 changed files with 591 additions and 6 deletions

View File

@@ -15,18 +15,41 @@ let gate = gateLinuxCncTaskAction(store.getState(), { type: "RUN" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "run blocked: machine must be on");
gate = gateLinuxCncTaskAction(store.getState(), { type: "SET_MODE", mode: "manual" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "mode blocked: machine must be on before MANUAL");
gate = gateLinuxCncTaskAction(store.getState(), { type: "SET_MODE", mode: "mdi" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "mode blocked: machine must be on before MDI");
gate = gateLinuxCncTaskAction(store.getState(), { type: "SET_MODE", mode: "auto" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "mode blocked: machine must be on before AUTO");
store.dispatch({ type: "TOGGLE_POWER" });
gate = gateLinuxCncTaskAction(store.getState(), { type: "SET_MODE", mode: "manual" });
assert.equal(gate.allowed, true);
gate = gateLinuxCncTaskAction(store.getState(), { type: "RUN" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "run blocked: switch to auto mode first");
gate = gateLinuxCncTaskAction(store.getState(), { type: "SET_MODE", mode: "auto" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "mode blocked: home machine before AUTO");
store.dispatch({ type: "SET_MODE", mode: "auto" });
assert.equal(store.getState().machine.mode, "manual");
assert.equal(store.getState().operatorMessage, "mode blocked: home machine before AUTO");
gate = gateLinuxCncTaskAction(store.getState(), { type: "RUN" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "run blocked: home machine first");
assert.equal(gate.operatorMessage, "run blocked: switch to auto mode first");
gate = gateLinuxCncTaskAction(store.getState(), { type: "SET_MODE", mode: "mdi" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "mode blocked: home machine before MDI");
store.dispatch({ type: "SET_MODE", mode: "manual" });
store.dispatch({ type: "HOME" });
gate = gateLinuxCncTaskAction(store.getState(), { type: "SET_MODE", mode: "auto" });
assert.equal(gate.allowed, true);
store.dispatch({ type: "SET_MODE", mode: "auto" });
gate = gateLinuxCncTaskAction(store.getState(), { type: "RUN" });
assert.equal(gate.allowed, false);

View File

@@ -134,10 +134,14 @@ gate = gateLinuxCncTaskAction(store.getState(), { type: "RUN" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "run blocked: switch to auto mode first");
gate = gateLinuxCncTaskAction(store.getState(), { type: "SET_MODE", mode: "auto" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "mode blocked: home machine before AUTO");
store.dispatch({ type: "SET_MODE", mode: "auto" });
assert.equal(store.getState().machine.mode, "manual");
gate = gateLinuxCncTaskAction(store.getState(), { type: "RUN" });
assert.equal(gate.allowed, false);
assert.equal(gate.operatorMessage, "run blocked: home machine first");
assert.equal(gate.operatorMessage, "run blocked: switch to auto mode first");
store.dispatch({ type: "HOME" });
store.dispatch({ type: "SET_MODE", mode: "manual" });