Enforce LinuxCNC WASM authority for XYZAC frontend
This commit is contained in:
@@ -37,21 +37,11 @@ export function axisState({ task = {}, program = {}, motion = {}, devices = {},
|
||||
const hasIoState = typeof ioState.estop === "boolean" || typeof ioState.estop === "number";
|
||||
const ioEstop = hasIoState && Boolean(ioState.estop);
|
||||
const ioReady = typeof ioState.ready === "boolean" || typeof ioState.ready === "number" ? Boolean(ioState.ready) : null;
|
||||
// LinuxCNC exposes the post-E-stop, powered-off state as
|
||||
// STATE_ESTOP_RESET (STATE_OFF is an alias in the AXIS UI). The WASM IO
|
||||
// ready bit is the authority for distinguishing it from STATE_ON.
|
||||
const estopReset = hasIoState && !ioEstop && ioReady === false;
|
||||
// A powered-off machine is OFF. ESTOP_RESET is distinct and is only
|
||||
// reported after the WASM IO latch has recorded the ESTOP edge.
|
||||
const estopReset = hasIoState && !ioEstop && ioReady === false && Number(ioState.last_error) === -904;
|
||||
let machineState = ioEstop || ["ESTOP", "FAULT"].includes(taskState) ? "ESTOP" : estopReset ? "ESTOP_RESET" : ioReady === false ? "OFF" : ["READY", "RUNNING", "PAUSED", "STOPPED"].includes(taskState) ? "ON" : "OFF";
|
||||
let operationState = programActivity(task, program);
|
||||
if (action === "ESTOP" && payload.active === true) machineState = "ESTOP";
|
||||
if (action === "ESTOP" && payload.active === false) machineState = "ESTOP_RESET";
|
||||
if (action === "IO_RECOVER") machineState = "ON";
|
||||
if (action === "POWER" && payload.active === true) machineState = "ON";
|
||||
if (action === "POWER" && payload.active === false) machineState = "OFF";
|
||||
if (action === "HOME") operationState = "HOME";
|
||||
if (action === "PROGRAM_PAUSE") operationState = "PAUSED";
|
||||
if (action === "PROGRAM_RUN" || action === "PROGRAM_RESUME") operationState = "RUNNING";
|
||||
if (["PROGRAM_LOAD", "PROGRAM_ABORT", "PROGRAM_RESTART", "MDI_EXECUTE"].includes(action)) operationState = "IDLE";
|
||||
const state = machineState === "ESTOP" || machineState === "ESTOP_RESET" ? machineState : operationState === "HOME" ? "HOME" : operationState === "RUNNING" ? "RUNNING" : operationState === "PAUSED" ? "PAUSED" : machineState === "OFF" ? "OFF" : "IDLE";
|
||||
const sourceTaskState = machineState === "ESTOP" ? "STATE_ESTOP" : machineState === "ESTOP_RESET" ? "STATE_ESTOP_RESET" : machineState === "OFF" ? "STATE_OFF" : "STATE_ON";
|
||||
const sourceInterpState = operationState === "PAUSED" ? "INTERP_PAUSED" : operationState === "RUNNING" ? "INTERP_READING" : "INTERP_IDLE";
|
||||
|
||||
Reference in New Issue
Block a user