Enforce LinuxCNC WASM authority for XYZAC frontend

This commit is contained in:
2026-09-02 07:43:47 +08:00
parent c60e3a1e8f
commit 6b689fd69e
36 changed files with 514 additions and 210 deletions

View File

@@ -19,7 +19,7 @@ const send = (kind, payload = {}) => session.accept({ ...base, kind, seq: ++seq,
send("HELLO");
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(loaded.payload.panel_snapshot.axis_state.machine_state, "OFF");
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");
@@ -34,7 +34,15 @@ for (const [kind, payload, reason] of [["PROGRAM_RUN", {}, "xyzac_machine_off"],
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);
const readyGates = send("SNAPSHOT_REQUEST").payload.panel_snapshot.gates;
assert.equal(readyGates.spindle.enabled, true);
assert.equal(readyGates.coolant.enabled, true);
assert.equal(readyGates.tool.enabled, true);
assert.equal(readyGates.probe.enabled, true);
assert.equal(send("KINEMATICS_SELECT", { type: 1 }).payload.kinematics.active_type, 1);
const alternateKinematicsGates = send("SNAPSHOT_REQUEST").payload.panel_snapshot.gates;
assert.equal(alternateKinematicsGates.spindle.reason, "linuxcnc_wasm_mode_unavailable");
assert.equal(alternateKinematicsGates.tool.reason, "linuxcnc_wasm_mode_unavailable");
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");