继续按 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

@@ -141,6 +141,10 @@ if CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/li
fi
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_threading_sync.ngc >"$output_dir/cnc_sim_linuxcnc_threading_sync.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_threading_cycle.ngc >"$output_dir/cnc_sim_linuxcnc_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_dump" tests/gcode/linuxcnc_lathe_diameter_mode.ngc >"$output_dir/cnc_sim_linuxcnc_lathe_diameter_mode.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_tool_number.ngc >"$output_dir/cnc_sim_linuxcnc_tool_number.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_program_stops.ngc >"$output_dir/cnc_sim_linuxcnc_program_stops.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_coolant.ngc >"$output_dir/cnc_sim_linuxcnc_coolant.json"
@@ -377,6 +381,21 @@ if not any(
if not any(event["type"] == "program-end" and event["line"] == 5 for event in threading_cycle):
raise SystemExit("missing G76 program end line number")
lathe_diameter_mode = load("cnc_sim_linuxcnc_lathe_diameter_mode.json")
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 G7/G8 lathe diameter-mode feeds: {lathe_feeds!r}")
tool_number = load("cnc_sim_linuxcnc_tool_number.json")
if not any(
event["type"] == "tool-change" and
@@ -1186,6 +1205,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_modal_state.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_modal_autorestore.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_threading_sync.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_threading_cycle.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_lathe_diameter_mode.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_tool_number.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_program_stops.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_coolant.json"