按规划继续工作

结论:新增命名参数直接查找的 WASM 和浏览器验证,继续通过 vendored LinuxCNC find_named_param 路径覆盖 INI/HAL 边界。
This commit is contained in:
2026-06-08 11:31:13 +08:00
parent d2d0ce8bc1
commit b0250b66e6
8 changed files with 139 additions and 13 deletions

View File

@@ -86,6 +86,12 @@ const interp = await createLinuxCncInterpSdk({
},
});
const namedParamIniPath = "/work/namedparams.ini";
interp.writeTextFile(
namedParamIniPath,
readFileSync(resolve(rootDir, "tests/fixtures/ini/namedparams.ini"), "utf8"),
);
verifyExpectedOutput(
"probe_init_and_synch",
interp.probeInitAndSynch(),
@@ -130,6 +136,31 @@ verifyExpectedOutput(
].join("\n"),
);
verifyExpectedOutput(
"probe_named_parameters",
interp.probeNamedParameters(namedParamIniPath),
[
"init_named_parameters=0",
"global_named_count=57",
"_metric_machine: rc=0 found=1 value=1",
"_motion_mode: rc=0 found=1 value=10",
"_metric: rc=0 found=1 value=1",
"_feed: rc=0 found=1 value=123.45",
"_rpm: rc=0 found=1 value=678.9",
"_x: rc=0 found=1 value=1.25",
"_current_tool: rc=0 found=1 value=12",
"_ini[traj]max_linear_velocity: rc=0 found=1 value=35",
"_hal[standalone.pin-bit]: rc=0 found=1 value=1",
"_hal[standalone.signal-float]: rc=0 found=1 value=98.25",
"_hal[standalone.param-s32]: rc=0 found=1 value=-17",
"_hal[standalone.pin-u32]: rc=0 found=1 value=1.23457e+08",
"_hal[standalone.signal-s64]: rc=0 found=1 value=-9e+09",
"_hal[standalone.param-u64]: rc=0 found=1 value=9e+09",
"_hal[standalone.disconnected-float]: rc=0 found=1 value=12.5",
"_hal[standalone.missing]: rc=0 found=0 value=0",
].join("\n"),
);
for (const fixtureName of INTERP_MDI_FIXTURES) {
const programText = readFileSync(
resolve(rootDir, `tests/fixtures/gcode/${fixtureName}.ngc`),
@@ -143,11 +174,6 @@ for (const fixtureName of INTERP_MDI_FIXTURES) {
verifyExpectedOutput(fixtureName, interp.runProgram(programText), expectedEvents);
}
const namedParamIniPath = "/work/namedparams.ini";
interp.writeTextFile(
namedParamIniPath,
readFileSync(resolve(rootDir, "tests/fixtures/ini/namedparams.ini"), "utf8"),
);
const namedParamProgramText = readFileSync(
resolve(rootDir, `tests/fixtures/gcode/${INTERP_INI_FIXTURE}.ngc`),
"utf8",