feat: complete working8 pause semantics

This commit is contained in:
wangdequan
2026-07-07 10:27:02 -04:00
parent 83402c506e
commit 4ba45b2ec5
987 changed files with 340641 additions and 65 deletions

View File

@@ -41,6 +41,8 @@ await verifyRunFeedbackLoop({
console.log("run_feedback_status_loop_smoke=ok");
console.log("run_ready_sequence_smoke=ok");
console.log("pause_uses_motion_paused_gate=ok");
console.log("pause_freezes_task_hal_status_loop=ok");
async function verifyRunFeedbackLoop({ profileId, sourceRel, stopAction }) {
const sdk = await createLinuxCncTaskHalSdk({
@@ -125,6 +127,35 @@ async function verifyRunFeedbackLoop({ profileId, sourceRel, stopAction }) {
assert.equal(state.taskHalStatus.summary.taskRuntimeReady, true);
assert.equal(state.taskHalStatus.summary.halSyncReady, true);
const activeLineBeforePause = state.activeLine;
const motionLineBeforePause = state.taskHalStatus.motionStatus.motion.programLine;
const motionAxisBeforePause = { ...state.taskHalStatus.motionStatus.axis };
store.dispatch({ type: "PAUSE_RESUME" });
await waitForTaskHalCommand(store);
state = store.getState();
assert.equal(state.runState, "paused");
assert.equal(state.machine.motionPaused, true);
assert.equal(state.machine.taskPaused, true);
assert.equal(state.taskHalStatus.ui.motionPaused, true);
assert.equal(state.taskHalStatus.motionStatus.motion.paused, true);
assert.equal(state.programRuntimeFeedback.paused, true);
assert.equal(state.activeLine, activeLineBeforePause);
assert.equal(state.taskHalStatus.motionStatus.motion.programLine, motionLineBeforePause);
assert.deepEqual(state.taskHalStatus.motionStatus.axis, motionAxisBeforePause);
await new Promise((resolve) => setTimeout(resolve, 120));
state = store.getState();
assert.equal(state.runState, "paused");
assert.equal(state.activeLine, activeLineBeforePause);
assert.equal(state.taskHalStatus.motionStatus.motion.programLine, motionLineBeforePause);
assert.deepEqual(state.taskHalStatus.motionStatus.axis, motionAxisBeforePause);
store.dispatch({ type: "PAUSE_RESUME" });
await waitForTaskHalCommand(store);
await waitForState(store, (nextState) => nextState.machine.motionPaused === false && nextState.runState !== "paused");
state = store.getState();
assert.equal(state.machine.motionPaused, false);
assert.equal(state.taskHalStatus.motionStatus.motion.paused, false);
const cycleAfterRun = state.taskHalStatus.ui.taskCycle;
store.dispatch({ type: "STEP" });
await waitForTaskHalCommand(store);
@@ -179,15 +210,25 @@ async function verifyRunReadySequence({ profileId, sourceRel }) {
store.dispatch({ type: "RUN_READY" });
await waitForTaskHalCommand(store);
await waitForState(store, (state) => state.machine.taskState === "on" && state.machine.mode === "auto");
await waitForState(store, (state) => state.taskHalSession?.programPath?.endsWith(sourceRel.split("/").at(-1)));
let state = store.getState();
assert.equal(state.machine.powerOn, false);
assert.equal(state.machine.taskState, "estop-reset");
assert.equal(state.machine.mode, "manual");
assert.equal(state.machine.allHomed, false);
assert.equal(state.taskHalSession?.programPath?.endsWith(sourceRel.split("/").at(-1)), true);
store.dispatch({ type: "TOGGLE_POWER" });
await waitForTaskHalCommand(store);
store.dispatch({ type: "HOME" });
store.dispatch({ type: "SET_MODE", mode: "auto" });
await waitForTaskHalCommand(store);
state = store.getState();
assert.equal(state.machine.powerOn, true);
assert.equal(state.machine.taskState, "on");
assert.equal(state.machine.mode, "auto");
assert.equal(state.machine.allHomed, true);
assert.equal(state.rtcpState, "on");
assert.equal(String(state.kinsType).startsWith("tcp-"), true);
store.dispatch({ type: "RUN" });
await waitForTaskHalCommand(store);