Make large G-code loading and execution robust
This commit is contained in:
@@ -239,6 +239,9 @@ export function App() {
|
||||
.then(() => dispatch("PROGRAM_RUN", {}, false))
|
||||
.catch(() => undefined);
|
||||
};
|
||||
const clearLoadedPreview = async () => {
|
||||
await operationController.execute("VISUAL_CLEAR", {}, { state: axisState, gate: false });
|
||||
};
|
||||
const loadCase = async () => {
|
||||
if (programLoading || programRunning) return;
|
||||
setProgramLoading(true);
|
||||
@@ -256,6 +259,7 @@ export function App() {
|
||||
const operation = await operationController.execute("LOAD_WORKSPACE", { root_path: "/workspace", configuration: toWorkerConfiguration(bundle) }, { state: axisState, gate: false });
|
||||
const resultPayload = (operation.response as { payload?: { configuration?: { state?: string } } }).payload;
|
||||
setProgramText(normalizedSource); setProgramPath(PROGRAM_PATH); setPlotCleared(false);
|
||||
await clearLoadedPreview();
|
||||
await operationController.execute("PROGRAM_LOAD", { source: normalizedSource, path: PROGRAM_PATH }, { state: axisState, gate: false });
|
||||
setOperationTrace(operationController.exportTrace());
|
||||
setCommandStatus("PROGRAM_LOAD acknowledged");
|
||||
@@ -277,6 +281,7 @@ export function App() {
|
||||
const source = normalizeProgramSource(await response.text());
|
||||
if (!source.trim()) throw new Error("program_asset_empty");
|
||||
setProgramText(source); setProgramPath(path); setPlotCleared(false);
|
||||
await clearLoadedPreview();
|
||||
await operationController.execute("PROGRAM_LOAD", { source, path }, { state: axisState, gate: false });
|
||||
setOperationTrace(operationController.exportTrace());
|
||||
setCommandStatus("PROGRAM_LOAD acknowledged");
|
||||
@@ -291,7 +296,7 @@ export function App() {
|
||||
setProgramLoading(true);
|
||||
setCommandStatus("PROGRAM_LOAD pending: waiting for LinuxCNC WASM preview");
|
||||
setPlotCleared(false);
|
||||
void dispatch("PROGRAM_LOAD", { source: programText, path: programPath })
|
||||
void clearLoadedPreview().then(() => dispatch("PROGRAM_LOAD", { source: programText, path: programPath }))
|
||||
.then(() => setCaseStatus(`${programPath} loaded through linuxcnc-wasm`))
|
||||
.catch(() => undefined)
|
||||
.finally(() => setProgramLoading(false));
|
||||
|
||||
Reference in New Issue
Block a user