完善 working5 gmoccapy HAL 输入对标
This commit is contained in:
@@ -282,6 +282,25 @@
|
||||
throw new Error(`missing gmoccapy icon ${selector} expected ${iconName}, got ${button?.dataset.iconName}`);
|
||||
}
|
||||
}
|
||||
for (const [selector, pin, panel, index] of [
|
||||
['[data-action="estop"]', "gmoccapy.v-button.button-0", "right", "0"],
|
||||
['[data-action="power"]', "gmoccapy.v-button.button-1", "right", "1"],
|
||||
['[data-action="mode-manual"]', "gmoccapy.v-button.button-2", "right", "2"],
|
||||
['[data-action="mode-mdi"]', "gmoccapy.v-button.button-3", "right", "3"],
|
||||
['[data-action="mode-auto"]', "gmoccapy.v-button.button-4", "right", "4"],
|
||||
['[data-action="mode-jog"]', "gmoccapy.v-button.button-5", "right", "5"],
|
||||
['[data-action="HOME"]', "gmoccapy.h-button.button-0", "bottom", "0"],
|
||||
]) {
|
||||
const button = doc.querySelector(selector);
|
||||
if (
|
||||
!button ||
|
||||
button.dataset.gmoccapyHalPin !== pin ||
|
||||
button.dataset.gmoccapyNativePanel !== panel ||
|
||||
button.dataset.gmoccapyNativeButtonIndex !== index
|
||||
) {
|
||||
throw new Error(`gmoccapy hard-button mapping mismatch ${selector}: ${JSON.stringify(button?.dataset)}`);
|
||||
}
|
||||
}
|
||||
if (!doc.querySelector('[data-gmoccapy-comm="boundary"]')?.textContent.includes("native_gmoccapy_nml_hal_reference")) {
|
||||
throw new Error("missing gmoccapy communication boundary diagnostic");
|
||||
}
|
||||
@@ -294,6 +313,60 @@
|
||||
if (!doc.querySelector('[data-gmoccapy-hal="postgui"]')?.textContent.includes("tool-change-loop")) {
|
||||
throw new Error("missing gmoccapy HAL postgui diagnostic");
|
||||
}
|
||||
const halInputDiagnostic = doc.querySelector('[data-gmoccapy-hal="operator-inputs"]')?.textContent || "";
|
||||
if (
|
||||
!halInputDiagnostic.includes("3 operator pins") ||
|
||||
!halInputDiagnostic.includes("optional-stop -> block delete") ||
|
||||
!halInputDiagnostic.includes("blockdelete -> optional stop") ||
|
||||
!halInputDiagnostic.includes("ignore-limits off")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy HAL operator input diagnostic: ${halInputDiagnostic}`);
|
||||
}
|
||||
const overrideInputDiagnostic = doc.querySelector('[data-gmoccapy-hal="override-inputs"]')?.textContent || "";
|
||||
if (
|
||||
!overrideInputDiagnostic.includes("4 override targets") ||
|
||||
!overrideInputDiagnostic.includes("counts require enable") ||
|
||||
!overrideInputDiagnostic.includes("direct-value requires analog-enable") ||
|
||||
!overrideInputDiagnostic.includes("reset rising-edge-only")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy HAL override diagnostic: ${overrideInputDiagnostic}`);
|
||||
}
|
||||
const jogInputDiagnostic = doc.querySelector('[data-gmoccapy-hal="jog-inputs"]')?.textContent || "";
|
||||
if (
|
||||
!jogInputDiagnostic.includes("10 axis jog pins") ||
|
||||
!jogInputDiagnostic.includes("6 jog-inc pins") ||
|
||||
!jogInputDiagnostic.includes("press/release level") ||
|
||||
!jogInputDiagnostic.includes("jog-inc rising-edge-only") ||
|
||||
!jogInputDiagnostic.includes("jog-inc-0 continuous")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy HAL jog diagnostic: ${jogInputDiagnostic}`);
|
||||
}
|
||||
const messageInputDiagnostic = doc.querySelector('[data-gmoccapy-hal="message-inputs"]')?.textContent || "";
|
||||
if (
|
||||
!messageInputDiagnostic.includes("3 message pins") ||
|
||||
!messageInputDiagnostic.includes("delete-message rising-edge-only") ||
|
||||
!messageInputDiagnostic.includes("warning-confirm level-polled")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy HAL message diagnostic: ${messageInputDiagnostic}`);
|
||||
}
|
||||
const hardButtonDiagnostic = doc.querySelector('[data-gmoccapy-hal="hard-buttons"]')?.textContent || "";
|
||||
if (
|
||||
!hardButtonDiagnostic.includes("7 right v-button pins") ||
|
||||
!hardButtonDiagnostic.includes("4 bottom h-button main refs") ||
|
||||
!hardButtonDiagnostic.includes("7 mapped Web buttons") ||
|
||||
!hardButtonDiagnostic.includes("rising-edge-only") ||
|
||||
!hardButtonDiagnostic.includes("insensitive ignored")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy hard-button diagnostic: ${hardButtonDiagnostic}`);
|
||||
}
|
||||
const toolChangeDiagnostic = doc.querySelector('[data-gmoccapy-hal="tool-change"]')?.textContent || "";
|
||||
if (
|
||||
!toolChangeDiagnostic.includes("iocontrol-loopback") ||
|
||||
!toolChangeDiagnostic.includes("manual GUI pins disconnected") ||
|
||||
!toolChangeDiagnostic.includes("3 postgui unlinkp")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy HAL tool-change diagnostic: ${toolChangeDiagnostic}`);
|
||||
}
|
||||
if (!doc.querySelector('[data-tool-preview="summary"]')?.textContent.includes("T1")) {
|
||||
throw new Error("missing tool preview summary");
|
||||
}
|
||||
@@ -877,6 +950,16 @@
|
||||
if (win.webRtcp5AxisSimulation.getState().runState !== "idle") {
|
||||
throw new Error("RESET did not return to idle");
|
||||
}
|
||||
doc.querySelector('[data-action="power"]').click();
|
||||
await wait(50);
|
||||
if (win.webRtcp5AxisSimulation.getState().machine.powerOn !== true) {
|
||||
throw new Error("POWER did not re-enable machine before override tests");
|
||||
}
|
||||
doc.querySelector('[data-action="mode-manual"]').click();
|
||||
await wait(50);
|
||||
if (win.webRtcp5AxisSimulation.getState().machine.mode !== "manual") {
|
||||
throw new Error("MANUAL mode did not re-enable before HAL jog tests");
|
||||
}
|
||||
doc.querySelector('[data-action="feed-override-down"]').click();
|
||||
await wait(50);
|
||||
if (win.webRtcp5AxisSimulation.getState().feed.feedOverride !== 90) {
|
||||
@@ -885,6 +968,11 @@
|
||||
if (doc.querySelector('[data-value="feed-override"]')?.textContent.trim() !== "90 %") {
|
||||
throw new Error("feed override DOM did not update");
|
||||
}
|
||||
doc.querySelector('[data-action="feed-override-reset"]').click();
|
||||
await wait(50);
|
||||
if (win.webRtcp5AxisSimulation.getState().feed.feedOverride !== 100) {
|
||||
throw new Error("feed override reset button did not update state");
|
||||
}
|
||||
doc.querySelector('[data-action="rapid-override-up"]').click();
|
||||
await wait(50);
|
||||
if (win.webRtcp5AxisSimulation.getState().feed.rapidOverride !== 110) {
|
||||
@@ -895,6 +983,121 @@
|
||||
if (win.webRtcp5AxisSimulation.getState().spindle.override !== 110) {
|
||||
throw new Error("spindle override button did not update state");
|
||||
}
|
||||
doc.querySelector('[data-action="spindle-override-reset"]').click();
|
||||
await wait(50);
|
||||
if (win.webRtcp5AxisSimulation.getState().spindle.override !== 100) {
|
||||
throw new Error("spindle override reset button did not update state");
|
||||
}
|
||||
doc.querySelector('[data-action="ignore-limits"]').click();
|
||||
doc.querySelector('[data-action="block-delete"]').click();
|
||||
doc.querySelector('[data-action="optional-stop"]').click();
|
||||
await wait(50);
|
||||
const guiState = win.webRtcp5AxisSimulation.getState().gmoccapyGui;
|
||||
if (guiState.ignoreLimits !== true || guiState.optionalBlocks !== true || guiState.optionalStop !== true) {
|
||||
throw new Error(`gmoccapy HAL input buttons did not update state: ${JSON.stringify(guiState)}`);
|
||||
}
|
||||
if (!doc.querySelector('[data-value="gmoccapy-hal-last"]')?.textContent.includes("optional stop set from Web control")) {
|
||||
throw new Error("gmoccapy HAL last input DOM did not update");
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.optional-stop",
|
||||
value: false,
|
||||
});
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.blockdelete",
|
||||
value: false,
|
||||
});
|
||||
await wait(50);
|
||||
const crossedGuiState = win.webRtcp5AxisSimulation.getState().gmoccapyGui;
|
||||
if (crossedGuiState.optionalBlocks !== false || crossedGuiState.optionalStop !== false) {
|
||||
throw new Error(`gmoccapy HAL crossed optional/blockdelete pins did not update state: ${JSON.stringify(crossedGuiState)}`);
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.jog.jog-inc-2",
|
||||
value: false,
|
||||
});
|
||||
await wait(25);
|
||||
if (win.webRtcp5AxisSimulation.getState().machine.jogIncrement !== 1) {
|
||||
throw new Error("gmoccapy HAL jog increment falling edge should not change Web machine jog increment");
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.jog.jog-inc-2",
|
||||
value: true,
|
||||
});
|
||||
await wait(25);
|
||||
let halJogGuiState = win.webRtcp5AxisSimulation.getState().gmoccapyGui;
|
||||
if (win.webRtcp5AxisSimulation.getState().machine.jogIncrement !== 0.1 || halJogGuiState.jogIncrementOutput !== 0.1) {
|
||||
throw new Error(`gmoccapy HAL jog-inc pin did not select 0.100 mm: ${JSON.stringify(halJogGuiState)}`);
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.jog.axis.jog-x-plus",
|
||||
value: true,
|
||||
});
|
||||
await wait(50);
|
||||
if (
|
||||
win.webRtcp5AxisSimulation.getState().runState !== "jogging" ||
|
||||
win.webRtcp5AxisSimulation.getState().gmoccapyGui.activeJogPin !== "gmoccapy.jog.axis.jog-x-plus"
|
||||
) {
|
||||
throw new Error(`gmoccapy HAL jog axis pin did not enter jogging state: ${JSON.stringify(win.webRtcp5AxisSimulation.getState().gmoccapyGui)}`);
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.jog.axis.jog-x-plus",
|
||||
value: false,
|
||||
});
|
||||
await wait(50);
|
||||
if (
|
||||
win.webRtcp5AxisSimulation.getState().runState !== "idle" ||
|
||||
win.webRtcp5AxisSimulation.getState().gmoccapyGui.activeJogPin !== null
|
||||
) {
|
||||
throw new Error("gmoccapy HAL jog release did not clear active jog pin");
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.jog.turtle-jog",
|
||||
value: true,
|
||||
});
|
||||
await wait(25);
|
||||
if (win.webRtcp5AxisSimulation.getState().gmoccapyGui.turtleJog !== true) {
|
||||
throw new Error("gmoccapy HAL turtle-jog pin did not update state");
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.delete-message",
|
||||
value: false,
|
||||
});
|
||||
await wait(25);
|
||||
if (win.webRtcp5AxisSimulation.getState().gmoccapyGui.deletedMessageCount !== 0) {
|
||||
throw new Error("gmoccapy HAL delete-message falling edge should be ignored");
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.delete-message",
|
||||
value: true,
|
||||
});
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.warning-confirm",
|
||||
value: true,
|
||||
});
|
||||
await wait(50);
|
||||
halJogGuiState = win.webRtcp5AxisSimulation.getState().gmoccapyGui;
|
||||
if (halJogGuiState.deletedMessageCount !== 1 || halJogGuiState.warningConfirm !== true) {
|
||||
throw new Error(`gmoccapy HAL message pins did not update state: ${JSON.stringify(halJogGuiState)}`);
|
||||
}
|
||||
const updatedJogDiagnostic = doc.querySelector('[data-gmoccapy-hal="jog-inputs"]')?.textContent || "";
|
||||
const updatedMessageDiagnostic = doc.querySelector('[data-gmoccapy-hal="message-inputs"]')?.textContent || "";
|
||||
if (!updatedJogDiagnostic.includes("turtle level-driven") || !updatedJogDiagnostic.includes("increment 0.100 mm=0.1")) {
|
||||
throw new Error(`gmoccapy HAL jog diagnostic did not refresh: ${updatedJogDiagnostic}`);
|
||||
}
|
||||
if (!updatedMessageDiagnostic.includes("deleted 1") || !updatedMessageDiagnostic.includes("confirm on")) {
|
||||
throw new Error(`gmoccapy HAL message diagnostic did not refresh: ${updatedMessageDiagnostic}`);
|
||||
}
|
||||
doc.querySelector('[data-action="toggle-flood"]').click();
|
||||
doc.querySelector('[data-action="toggle-mist"]').click();
|
||||
await wait(50);
|
||||
|
||||
Reference in New Issue
Block a user