Fix web homing motion and synchronize preview state

This commit is contained in:
2026-09-09 09:31:32 +08:00
parent bade560372
commit eb5c58cdb3
11 changed files with 375 additions and 33 deletions

View File

@@ -108,6 +108,17 @@ export class WasmHomeLimit {
return this.read();
}
// Resolve the canonical target of a home command without committing the
// homed mask or pose. The actual commit is performed only after the LinuxCNC
// TP has executed the queued move to this target.
previewHome(axis = null) {
const saved = this.exportState();
const target = this.home(0, axis);
try { this.restoreState(saved); } catch (error) { return { status: "error", code: String(error?.message ?? error) }; }
if (target.status !== "verified") return target;
return { status: "verified", state: target.state };
}
check(joints) {
if (!this.available) return this.read();
if (!Array.isArray(joints) || joints.length < this.jointCount || joints.some((value) => typeof value !== "number" || !Number.isFinite(value))) return { status: "error", code: "wasm_home_joints_invalid" };