Keep long G-code execution running past full planner queue

This commit is contained in:
2026-08-30 06:34:59 +08:00
parent d87366eb75
commit 2d6d8bd1c2
5 changed files with 32 additions and 15 deletions

View File

@@ -151,7 +151,10 @@ export class SimSession {
const lightweightXyzacStep = input.kind === "SIM_STEP" && Boolean(this.xyzacProgram);
const currentMotion = this.wasmMotion.read();
const completedMotion = program.status === 4 && currentMotion.state?.queue_depth === 0;
const motionDelta = lightweightXyzacStep && input.payload?.response === "motion_delta" && !completedMotion;
// Compact payloads are only valid for successful motion samples. Error
// responses must retain their code/reason instead of being rewritten into
// a delta with undefined fields.
const motionDelta = kind === "COMMAND_RESULT" && lightweightXyzacStep && input.payload?.response === "motion_delta" && !completedMotion;
const panelSnapshot = motionDelta ? null : this.panelSnapshot({ task, program, input, tick, motionTrace: statePayload.motion_trace, includeToolpath: !lightweightXyzacStep, includeConfiguration: !lightweightXyzacStep, includeStableRuntime: !lightweightXyzacStep });
const compactProgram = motionDelta ? {
schema: program.schema,
@@ -1415,6 +1418,11 @@ export class SimSession {
if (this.xyzacProgram) {
const wasmState = this.xyzacProgram.snapshot();
if (![2, 3].includes(wasmState.status)) return;
// LinuxCNC's task/interpreter blocks on a full trajectory
// planner queue. Let the motion phase consume one segment
// before reading another source line instead of converting
// normal planner backpressure into a program fault.
if (this.wasmMotion.read().state.queue_depth >= this.wasmMotion.queueCapacity) return;
if (this.pendingProgramControl !== 0) {
if (this.wasmMotion.read().state.queue_depth !== 0) return;
const current = this.wasmMotion.read().state.position;