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

结论:新增 LinuxCNC-backed G7 G76 fixture,依据 interp_convert.cc::convert_lathe_diameter_mode 和 convert_threading_cycle 验证直径模式下 G76 I/J/K 几何缩放、最终 threading pass 与 taper sync pitch;未扩展 smoke,test-native 与 test-linuxcnc-source-link 均通过。
This commit is contained in:
cnc
2026-06-02 15:33:17 +08:00
parent 952d3ecfd2
commit 23284e528f
6 changed files with 60 additions and 8 deletions

View File

@@ -201,7 +201,7 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
| Spindle speed mode `G96/G97` | covered with Canon `SET_SPINDLE_MODE` preserved as mode state events, including `G96 D...` max-RPM value | `tests/gcode/linuxcnc_spindle_modes.ngc` |
| Spindle orientation `M19 R... P... Q...` | covered with Canon `ORIENT_SPINDLE` and `WAIT_SPINDLE_ORIENT_COMPLETE` preserved as temporary mode state events | `tests/gcode/linuxcnc_spindle_orient.ngc` |
| Spindle-synchronized feed and threading `G33/G33.1/G76` | covered through smoke, LinuxCNC native, and source-linked paths with Canon `START_SPEED_FEED_SYNCH`/`STOP_SPEED_FEED_SYNCH` preserved, rigid-tap line numbers normalized, and G76 multi-pass threading smoke-covered | `tests/gcode/linuxcnc_threading_sync.ngc`, `tests/gcode/linuxcnc_threading_cycle.ngc`, smoke API regression |
| Lathe diameter/radius mode `G7/G8` | covered through LinuxCNC native/source backends for same-block X scaling and `#<_lathe_diameter_mode>`/`#<_lathe_radius_mode>` readonly named-parameter state; G76 threading geometry interaction remains smoke-covered | `tests/gcode/linuxcnc_lathe_diameter_mode.ngc`, smoke API regression |
| Lathe diameter/radius mode `G7/G8` | covered through LinuxCNC native/source backends for same-block X scaling, `G76` I/J/K threading geometry interaction, and `#<_lathe_diameter_mode>`/`#<_lathe_radius_mode>` readonly named-parameter state | `tests/gcode/linuxcnc_lathe_diameter_mode.ngc`, `tests/gcode/linuxcnc_lathe_diameter_g76.ngc` |
| Digital/analog I/O `M62`-`M68` | covered with Canon digital output, analog output, and input wait callbacks preserved as temporary state events | `tests/gcode/linuxcnc_io_controls.ngc` |
| Override controls `M48`-`M53` | covered with Canon feed override, spindle speed override, adaptive feed, and feed hold callbacks preserved as temporary state events | `tests/gcode/linuxcnc_override_controls.ngc` |
| Modal state save/restore `M70`-`M73` | covered for main-program save/invalidate/restore plus O-word subroutine autorestore in smoke parser, with native/source regressions checking restored distance mode, units, and XY plane motion | `tests/gcode/linuxcnc_modal_state.ngc`, `tests/gcode/linuxcnc_modal_autorestore.ngc` |

View File

@@ -556,8 +556,9 @@ if grep -F 'read -r -a python_includes <<<"$(' list-linuxcnc-source-common-cxxfl
echo "source common cxxflags still hides python-config failures behind read" >&2
exit 1
fi
grep -F 'convert_lathe_diameter_mode() scales G7/G8 X words' test-native.sh >/dev/null
grep -F 'convert_lathe_diameter_mode() scales G7/G8 X words and G76 I/J/K words' test-native.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_lathe_diameter_mode.ngc' test-native.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_lathe_diameter_g76.ngc' test-native.sh >/dev/null
for script in \
test-native.sh \

View File

@@ -142,9 +142,11 @@ 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>.
# convert_lathe_diameter_mode() scales G7/G8 X words and G76 I/J/K 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_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_lathe_diameter_g76.ngc >"$output_dir/cnc_sim_linuxcnc_lathe_diameter_g76.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"
@@ -396,6 +398,24 @@ expected_lathe_feeds = [
if lathe_feeds != expected_lathe_feeds:
raise SystemExit(f"unexpected G7/G8 lathe diameter-mode feeds: {lathe_feeds!r}")
lathe_g76 = load("cnc_sim_linuxcnc_lathe_diameter_g76.json")
if not any(
event["type"] == "linear-feed" and
event["line"] == 4 and
abs(event["end"]["x"] - 0.98125) < 1e-9 and
event["end"]["z"] == -1
for event in lathe_g76
):
raise SystemExit("missing G7 diameter-mode G76 final threading pass")
if not any(
event["type"] == "comment" and
event["line"] == 4 and
event["reserved"] == 3301 and
abs(event["feed"] - 0.0515388) < 1e-7
for event in lathe_g76
):
raise SystemExit("missing G7 diameter-mode G76 taper sync pitch")
tool_number = load("cnc_sim_linuxcnc_tool_number.json")
if not any(
event["type"] == "tool-change" and
@@ -1206,6 +1226,7 @@ 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_lathe_diameter_g76.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"

View File

@@ -221,11 +221,15 @@ 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>.
# convert_lathe_diameter_mode() scales G7/G8 X words and G76 I/J/K 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_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_lathe_diameter_g76.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_lathe_diameter_g76.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"
@@ -1094,6 +1098,24 @@ expected_lathe_feeds = [
if lathe_feeds != expected_lathe_feeds:
raise SystemExit(f"unexpected source-linked G7/G8 lathe diameter-mode feeds: {lathe_feeds!r}")
lathe_g76 = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_lathe_diameter_g76.json").read_text())
if not any(
event["type"] == "linear-feed" and
event["line"] == 4 and
abs(event["end"]["x"] - 0.98125) < 1e-9 and
event["end"]["z"] == -1
for event in lathe_g76
):
raise SystemExit("missing source-linked G7 diameter-mode G76 final threading pass")
if not any(
event["type"] == "comment" and
event["line"] == 4 and
event["reserved"] == 3301 and
abs(event["feed"] - 0.0515388) < 1e-7
for event in lathe_g76
):
raise SystemExit("missing source-linked G7 diameter-mode G76 taper sync pitch")
tool_number = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_tool_number.json").read_text())
if not any(
event["type"] == "tool-change" and
@@ -2491,6 +2513,7 @@ 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_lathe_diameter_g76.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"

View File

@@ -140,9 +140,11 @@ grep -F 'expected LinuxCNC INI PARAMETER_FILE to restore numbered parameters' co
grep -F 'expected LinuxCNC config INI_FILE_NAME to back #<_ini[]> named parameters' core/tests/cnc_sim_api_linuxcnc_rs274_smoke.cpp >/dev/null
grep -F 'interp->ini_load(options.ini_file_name.c_str())' core/src/linuxcnc_rs274_backend.cpp >/dev/null
grep -F 'ScopedEnvironmentVariable ini_file_env("INI_FILE_NAME", options.ini_file_name)' core/src/linuxcnc_rs274_backend.cpp >/dev/null
grep -F 'convert_lathe_diameter_mode() scales G7/G8 X words' test-linuxcnc-rs274-native.sh >/dev/null
grep -F 'convert_lathe_diameter_mode() scales G7/G8 X words' test-linuxcnc-source-link.sh >/dev/null
grep -F 'convert_lathe_diameter_mode() scales G7/G8 X words and G76 I/J/K words' test-linuxcnc-rs274-native.sh >/dev/null
grep -F 'convert_lathe_diameter_mode() scales G7/G8 X words and G76 I/J/K words' test-linuxcnc-source-link.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_lathe_diameter_mode.ngc' docs/linuxcnc-porting.md >/dev/null
grep -F 'tests/gcode/linuxcnc_lathe_diameter_g76.ngc' docs/linuxcnc-porting.md >/dev/null
grep -F 'missing source-linked G7 diameter-mode G76 final threading pass' test-linuxcnc-source-link.sh >/dev/null
grep -F 'rs274ngc_pre.cc ini_load() consumes INI_FILE_NAME' test-web-wasm-node-smoke.cjs >/dev/null
grep -F 'rs274ngc_pre.cc ini_load() consumes INI_FILE_NAME' web/test-browser-wasm-smoke-linuxcnc-sections.js >/dev/null
grep -F 'metadata:src/emc/nml_intf/emcops.cc:source basis for native source-link EMC status constructor support object' linuxcnc-rs274-source-files.txt >/dev/null

View File

@@ -0,0 +1,5 @@
G20 G90 G18
S500 M3
G0 X1 Z0.1
G7 G76 P0.05 Z-1 I-.075 J0.008 K0.045 Q29.5 L2 E0.045
M30