Prevent XYZAC TP queue starvation
This commit is contained in:
@@ -1552,7 +1552,12 @@ export class SimSession {
|
||||
// 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;
|
||||
// TP_DEFAULT_QUEUE_SIZE includes the active TC slot. Leave
|
||||
// one slot available for the active segment before appending
|
||||
// another lookahead TC; the upstream queue otherwise rejects
|
||||
// the boundary insertion even though its reported depth is
|
||||
// one below the configured capacity.
|
||||
if (this.wasmMotion.read().state.queue_depth >= this.wasmMotion.queueCapacity - 1) return;
|
||||
if (this.pendingXyzacMotion) {
|
||||
const pendingMode = Number(this.pendingXyzacMotion.kinematics_mode ?? 0);
|
||||
if (this.xyzacAppendDeferredOnActive) return;
|
||||
@@ -1562,7 +1567,14 @@ export class SimSession {
|
||||
: Number(queueState.active_id ?? 0) === this.xyzacDeferredBlockedActiveId;
|
||||
const deferredSwitchMotion = this.xyzacDeferredPhysicalSwitchMode !== null && pendingMode === this.xyzacDeferredPhysicalSwitchMode && this.xyzacQueuedLookaheadTargetId === 0 && deferredControlReady;
|
||||
const queuedLookaheadReady = deferredSwitchMotion || (this.xyzacAllowQueuedLookahead && this.xyzacLastServoActiveId === this.xyzacQueuedLookaheadTargetId);
|
||||
if (queueState.queue_depth !== 0 && !queuedLookaheadReady) return;
|
||||
// Same-mode segments may be queued while the current TC is
|
||||
// active. LinuxCNC TP needs that lookahead to blend G64
|
||||
// paths; withholding it until the queue drains creates a
|
||||
// real zero-velocity servo sample between long runs. A
|
||||
// kinematics-mode change remains synchronized below and is
|
||||
// deliberately deferred until its existing TC boundary.
|
||||
const pendingModeChanged = pendingMode !== this.xyzacLastEnqueuedKinematicsMode;
|
||||
if (queueState.queue_depth !== 0 && pendingModeChanged && !queuedLookaheadReady) return;
|
||||
if (queuedLookaheadReady && !deferredSwitchMotion && this.xyzacAllowQueuedLookahead) {
|
||||
// The next segment is appended after the first servo
|
||||
// sample of the now-active target, matching LinuxCNC's
|
||||
|
||||
Reference in New Issue
Block a user