按规划继续工作

结论:接入 LinuxCNC iniFindBool 到 INI WASM/SDK,并让 machine-session bridge 通过 vendored INI 解析 [EMCIO]RANDOM_TOOLCHANGER 后透传给 tooldata;native、WASM、OPFS 和浏览器 smoke 验证已通过。
This commit is contained in:
2026-06-08 08:49:38 +08:00
parent 3f4eb06b47
commit cf0887e0e7
16 changed files with 151 additions and 20 deletions

View File

@@ -197,6 +197,22 @@ const bridgeInterp = {
},
};
const bridgeIniSdk = {
writeTextFile(path, text) {
bridgeFiles.set(`ini:${path}`, text);
},
getBool(path, section, tag) {
if (
path === "/work/ini-derived-session.ini" &&
section === "EMCIO" &&
tag === "RANDOM_TOOLCHANGER"
) {
return true;
}
return null;
},
};
const restoredParameters = await restoreMachineParametersFromOpfs(
bridgeInterp,
"xyzab-tdr",
@@ -314,6 +330,26 @@ assert.equal(
"tooldata_load=0\nload_tool_path=/work/random-session-tool.tbl\nrandom_toolchanger=1\n",
);
const loadedIniDerivedRandomSession = await loadMachineSessionFromOpfs(
bridgeInterp,
"xyzab-tdr",
{
storage,
iniSdk: bridgeIniSdk,
iniWasmPath: "/work/ini-derived-session.ini",
parameterWasmPath: "/work/ini-derived-session.var",
toolTableWasmPath: "/work/ini-derived-session-tool.tbl",
},
);
assert.equal(
bridgeFiles.get("ini:/work/ini-derived-session.ini"),
"[EMC]\nMACHINE = xyzab-tdr\n",
);
assert.equal(
loadedIniDerivedRandomSession.toolTable.result,
"tooldata_load=0\nload_tool_path=/work/ini-derived-session-tool.tbl\nrandom_toolchanger=1\n",
);
await assert.rejects(
() => loadTextFile("linuxcnc/machines/missing.ini", storage),
/missing file/,