继续按 align-linuxcnc 约束:补 G7G8 源链接回归

结论:新增 LinuxCNC-backed lathe diameter/radius fixture,依据 interp_convert.cc::convert_lathe_diameter_mode 与 interp_namedparams.cc readonly 参数,在 native librs274 与 source-link runner 中验证 G7/G8 同块 X 缩放和 #<_lathe_diameter_mode>/#<_lathe_radius_mode> 分支;未扩展 smoke,test-native 与 test-linuxcnc-source-link 均通过。
This commit is contained in:
cnc
2026-06-02 15:27:31 +08:00
parent 6266887fec
commit 6e0a5627f0
6 changed files with 59 additions and 1 deletions

View File

@@ -220,6 +220,12 @@ CNC_SIM_RS274_VAR="$var_file" \
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_threading_cycle.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_threading_cycle.json"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc
# convert_lathe_diameter_mode() scales G7/G8 X words; interp_namedparams.cc
# exposes #<_lathe_diameter_mode> and #<_lathe_radius_mode>.
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_lathe_diameter_mode.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_lathe_diameter_mode.json"
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_tool_number.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_tool_number.json"
@@ -1073,6 +1079,21 @@ if not any(
if not any(event["type"] == "program-end" and event["line"] == 5 for event in threading_cycle):
raise SystemExit("missing source-linked G76 program end line number")
lathe_diameter_mode = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_lathe_diameter_mode.json").read_text())
lathe_feeds = [
(event["line"], event["end"]["x"], event["end"]["y"])
for event in lathe_diameter_mode
if event["type"] == "linear-feed"
]
expected_lathe_feeds = [
(3, 5, 0),
(5, 5, 1),
(7, 6, 1),
(9, 6, 2),
]
if lathe_feeds != expected_lathe_feeds:
raise SystemExit(f"unexpected source-linked G7/G8 lathe diameter-mode feeds: {lathe_feeds!r}")
tool_number = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_tool_number.json").read_text())
if not any(
event["type"] == "tool-change" and
@@ -2469,6 +2490,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_source_modal_state.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_modal_autorestore.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_threading_sync.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_threading_cycle.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_lathe_diameter_mode.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_tool_number.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_program_stops.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_coolant.json"