推进 INI 面板 run readiness workflow helper

This commit is contained in:
2026-06-15 05:21:01 +08:00
parent a883af2d3e
commit 4a307f63f6
8 changed files with 322 additions and 11 deletions

View File

@@ -32,6 +32,7 @@ import {
summarizeRunResult,
} from "./run-summary.js";
import {
createRunSessionReadinessState,
runGcodeSessionWorkflow,
} from "./run-workflow.js";
import {
@@ -772,8 +773,28 @@ document.getElementById("restore-load-session").addEventListener("click", async
document.getElementById("run-gcode").addEventListener("click", async () => {
try {
if (!loadedSession) {
throw new Error("Load a machine session before running G-code.");
const readiness = createRunSessionReadinessState({
loadedSession,
snapshot: restoredSessionSnapshot,
defaultFilename: UI_SESSION.defaultGcodeFilename,
defaultOpfsPath: defaultGcodeOpfsPath(),
wasmPath: UI_SESSION.gcodeWasmPath,
gcodeFilenameFromProgramPath,
});
updatePanelMachineSessionState({
runReadiness: readiness,
selectedProgram: readiness.program,
fields: {
sessionGcode: readiness.program.opfsPath,
runSource: readiness.program.source,
runOpfsPath: readiness.program.opfsPath,
runWasmPath: readiness.program.wasmPath,
},
lastAction: "run-gcode-readiness",
error: readiness.runButton.reason,
});
if (!readiness.canRun) {
throw new Error(readiness.runButton.reason ?? "Load a machine session before running G-code.");
}
const interp = requireInterpSdk();
clearRunPlayback();
@@ -803,6 +824,7 @@ document.getElementById("run-gcode").addEventListener("click", async () => {
setField("runStatus", workflow.fields.runStatus);
setLastRunSummary(workflow.summary);
updatePanelMachineSessionState({
runReadiness: workflow.readiness,
selectedProgram: {
source: workflow.program.source,
opfsPath: workflow.program.opfsPath,