Expand WASM sim-config staging coverage

This commit is contained in:
2026-06-09 07:32:15 +08:00
parent 2658ee3b72
commit 5116b9894d
26 changed files with 5989 additions and 141 deletions

View File

@@ -179,6 +179,52 @@ function parseRunMotion(resultText, programText) {
const axes = { x: 0, y: 0, z: 0, a: 0, b: 0, c: 0, u: 0, v: 0, w: 0 };
const snapshots = [];
const sourceLines = programLineMap(programText);
const motionByLine = new Map();
for (const line of resultText.split("\n")) {
const motion = line.match(/^canon_event=(STRAIGHT_TRAVERSE|STRAIGHT_FEED|ARC_FEED)\b/);
if (!motion) {
continue;
}
const sourceLine = readCanonicalNumber(line, "line");
if (Number.isFinite(sourceLine)) {
motionByLine.set(sourceLine, motion[1]);
}
}
for (const line of resultText.split("\n")) {
if (!line.startsWith("run_step phase=execute ")) {
continue;
}
for (const axis of Object.keys(axes)) {
const value = readCanonicalNumber(line, axis);
if (value !== null && Number.isFinite(value)) {
axes[axis] = value;
}
}
const sourceLine = readCanonicalNumber(line, "line");
const statementIndex = line.indexOf(" statement_uri=");
const statementValue =
statementIndex >= 0 ? line.slice(statementIndex + " statement_uri=".length).trim() : "";
let statement = "";
try {
statement = statementValue ? decodeURIComponent(statementValue) : "";
} catch {
statement = statementValue;
}
snapshots.push({
type: motionByLine.get(sourceLine) ?? "EXECUTE",
line: sourceLine,
statement: statement || (Number.isFinite(sourceLine) ? (sourceLines.get(sourceLine) ?? "-") : "-"),
axes: { ...axes },
});
}
if (snapshots.length > 0) {
return snapshots;
}
for (const line of resultText.split("\n")) {
const motion = line.match(/^canon_event=(STRAIGHT_TRAVERSE|STRAIGHT_FEED|ARC_FEED)\b/);