Expand WASM sim-config staging coverage
This commit is contained in:
@@ -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/);
|
||||
|
||||
Reference in New Issue
Block a user