Stream long G-code execution history with scrollable panes
This commit is contained in:
@@ -27,6 +27,10 @@ export type FrontendState = {
|
||||
executionTrace: Array<{ line: number; text: string; program_status?: string | null }>;
|
||||
};
|
||||
|
||||
// Keep enough authoritative WASM execution lines for long files while bounding
|
||||
// browser memory when a session runs continuously.
|
||||
export const EXECUTION_TRACE_CACHE_LIMIT = 8192;
|
||||
|
||||
export const INITIAL_STATE: FrontendState = {
|
||||
status: "disconnected",
|
||||
contextId: "linuxcnc-2.10.0-pre0-wasm-m1-py-c1",
|
||||
@@ -64,7 +68,7 @@ function projection(result: Record<string, unknown>, message: MessageEnvelope, p
|
||||
.filter((entry) => Number.isSafeInteger(entry.line) && entry.line > 0)
|
||||
: [];
|
||||
const resetExecutionTrace = ["PROGRAM_LOAD", "PROGRAM_RESTART"].includes(String(result.command ?? ""));
|
||||
const executionTrace = resetExecutionTrace ? trace.slice(-32) : trace.length ? [...previous.executionTrace, ...trace].slice(-32) : previous.executionTrace;
|
||||
const executionTrace = resetExecutionTrace ? trace.slice(-EXECUTION_TRACE_CACHE_LIMIT) : trace.length ? [...previous.executionTrace, ...trace].slice(-EXECUTION_TRACE_CACHE_LIMIT) : previous.executionTrace;
|
||||
const delta = result.motion_sample as { tick?: number; pose?: Record<string, number>; joints?: number[]; active_segment_id?: number; active_progress?: number } | undefined;
|
||||
if (!panel && delta && previous.snapshot) {
|
||||
const pose = delta.pose ?? {};
|
||||
|
||||
Reference in New Issue
Block a user