Preserve Web machine reset protocol continuity
This commit is contained in:
@@ -21,6 +21,9 @@ send("SESSION_ATTACH");
|
||||
const loaded = send("LOAD_WORKSPACE", { root_path: "/workspace", configuration: toWorkerConfiguration(bundle) });
|
||||
assert.equal(loaded.payload.panel_snapshot.axis_state.machine_state, "ESTOP_RESET");
|
||||
assert.equal(send("PROGRAM_LOAD", { source: PROGRAM, path: "button.ngc" }).payload.status, "verified");
|
||||
assert.equal(send("RESET").payload.gate_reason, "xyzac_machine_off");
|
||||
const restarted = send("PROGRAM_RESTART");
|
||||
assert.equal(restarted.payload.program.path, "button.ngc");
|
||||
|
||||
for (const [kind, payload, reason] of [["PROGRAM_RUN", {}, "xyzac_machine_off"], ["HOME", { all: true }, "xyzac_machine_off"], ["JOG_START", { axis: "x", direction: 1, speed: 1 }, "xyzac_machine_off"], ["MDI_EXECUTE", { block: "G0 X1" }, "xyzac_machine_off"], ["KINEMATICS_SELECT", { type: 1 }, "xyzac_machine_off"], ["POWER", { active: false }, "xyzac_power_already_off"]]) {
|
||||
const blocked = send(kind, payload);
|
||||
@@ -32,12 +35,16 @@ const powered = send("POWER", { active: true });
|
||||
assert.equal(powered.payload.panel_snapshot.axis_state.machine_state, "ON");
|
||||
assert.equal(send("HOME", { all: true }).payload.wasm_home_limit.state.homed, true);
|
||||
assert.equal(send("KINEMATICS_SELECT", { type: 1 }).payload.kinematics.active_type, 1);
|
||||
assert.equal(send("RESET").payload.command, "RESET");
|
||||
assert.equal(send("MDI_EXECUTE", { block: "G0 X1" }).payload.task.mode, "MDI");
|
||||
assert.equal(send("JOG_STOP").payload.command, "JOG_STOP");
|
||||
assert.equal(send("SET_MODE", { mode: "MANUAL" }).payload.mode, "MANUAL");
|
||||
assert.equal(send("POWER", { active: false }).payload.panel_snapshot.axis_state.machine_state, "OFF");
|
||||
assert.equal(send("PROGRAM_RUN").payload.gate_reason, "xyzac_machine_off");
|
||||
assert.equal(send("POWER", { active: true }).payload.panel_snapshot.axis_state.machine_state, "ON");
|
||||
|
||||
assert.equal(send("PROGRAM_RUN").payload.task.state, "RUNNING");
|
||||
for (const [kind, payload, reason] of [["HOME", { all: true }, "xyzac_interp_running"], ["MDI_EXECUTE", { block: "G0 X1" }, "mdi_while_program_active"], ["KINEMATICS_SELECT", { type: 0 }, "xyzac_interp_running"]]) {
|
||||
for (const [kind, payload, reason] of [["HOME", { all: true }, "xyzac_interp_running"], ["MDI_EXECUTE", { block: "G0 X1" }, "mdi_while_program_active"], ["KINEMATICS_SELECT", { type: 0 }, "xyzac_interp_running"], ["SET_MODE", { mode: "MANUAL" }, "linuxcnc_wasm_auto_interp_active"]]) {
|
||||
const blocked = send(kind, payload);
|
||||
assert.equal(blocked.kind, "ERROR", kind);
|
||||
assert.equal(blocked.payload.gate_reason, reason, kind);
|
||||
@@ -59,6 +66,6 @@ console.log(JSON.stringify({
|
||||
case: CASE,
|
||||
sequence: ["ESTOP", "ESTOP_RESET", "POWER_ON", "HOME", "IDLE", "RUNNING", "PAUSED", "RESUME", "ABORT", "ESTOP"],
|
||||
authority: "linuxcnc-wasm-worker",
|
||||
gates: { off_blocks_motion: true, running_blocks_manual: true, running_blocks_power_off: true, pause_resume_exclusive: true },
|
||||
gates: { off_blocks_motion: true, running_blocks_manual: true, running_allows_power_off: true, power_off_aborts_running: true, pause_resume_exclusive: true, mdi_requires_home: true },
|
||||
state_hash: reset.payload.panel_snapshot.state_hash,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user