From cde0bdaba614c5755945c0f1e791f15aca977b64 Mon Sep 17 00:00:00 2001 From: cnc Date: Tue, 2 Jun 2026 20:08:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E6=8C=89=20align-linuxcnc=20?= =?UTF-8?q?=E7=BA=A6=E6=9D=9F=EF=BC=9A=E8=A1=A5=E8=9E=BA=E7=BA=B9=E5=92=8C?= =?UTF-8?q?=E6=81=92=E7=BA=BF=E9=80=9F=E6=A0=A1=E9=AA=8C=E6=BA=90=E7=A0=81?= =?UTF-8?q?=E8=A6=86=E7=9B=96=EF=BC=8C=E6=B5=8B=E8=AF=95=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/linuxcnc-porting.md | 4 +-- test-linuxcnc-source-link.sh | 25 +++++++++++++++++++ tests/gcode/linuxcnc_g33_1_f_word_error.ngc | 4 +++ .../linuxcnc_g33_1_missing_k_word_error.ngc | 4 +++ tests/gcode/linuxcnc_g33_f_word_error.ngc | 4 +++ .../linuxcnc_g33_missing_k_word_error.ngc | 4 +++ .../linuxcnc_g76_missing_i_word_error.ngc | 4 +++ .../linuxcnc_g76_missing_j_word_error.ngc | 4 +++ .../linuxcnc_g76_missing_k_word_error.ngc | 4 +++ .../linuxcnc_g76_missing_p_word_error.ngc | 4 +++ .../linuxcnc_g96_missing_s_word_error.ngc | 3 +++ 11 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 tests/gcode/linuxcnc_g33_1_f_word_error.ngc create mode 100644 tests/gcode/linuxcnc_g33_1_missing_k_word_error.ngc create mode 100644 tests/gcode/linuxcnc_g33_f_word_error.ngc create mode 100644 tests/gcode/linuxcnc_g33_missing_k_word_error.ngc create mode 100644 tests/gcode/linuxcnc_g76_missing_i_word_error.ngc create mode 100644 tests/gcode/linuxcnc_g76_missing_j_word_error.ngc create mode 100644 tests/gcode/linuxcnc_g76_missing_k_word_error.ngc create mode 100644 tests/gcode/linuxcnc_g76_missing_p_word_error.ngc create mode 100644 tests/gcode/linuxcnc_g96_missing_s_word_error.ngc diff --git a/docs/linuxcnc-porting.md b/docs/linuxcnc-porting.md index 9d85d29..ab03b01 100644 --- a/docs/linuxcnc-porting.md +++ b/docs/linuxcnc-porting.md @@ -198,9 +198,9 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu | RTCP controls `G43.4/G43.5/G49` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` | | Kinematics switch `M428/M429/M430` | covered as simulator-owned control lines | `tests/gcode/linuxcnc_rtcp_controls.ngc` | | Spindle, coolant, program stops, and current tool number `M3/M4/M5`, `M7/M8/M9`, `M0/M1/M60/M30`, `M61 Q...` | covered through LinuxCNC native/source backends, including source-linked `convert_m()` rejection of out-of-range `M3/M4/M5 $` spindle selectors and negative `M61 Q` | `tests/gcode/linuxcnc_spindle_direction.ngc`, `tests/gcode/linuxcnc_coolant.ngc`, `tests/gcode/linuxcnc_program_stops.ngc`, `tests/gcode/linuxcnc_tool_number.ngc`, `tests/gcode/linuxcnc_m3_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m4_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m5_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m61_negative_q_error.ngc` | -| 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 speed mode `G96/G97` | covered with Canon `SET_SPINDLE_MODE` preserved as mode state events, including `G96 D...` max-RPM value and source-linked `check_other_codes()` rejection of missing `S` with `G96` | `tests/gcode/linuxcnc_spindle_modes.ngc`, `tests/gcode/linuxcnc_g96_missing_s_word_error.ngc` | | Spindle orientation `M19 R... P... Q...` | covered with Canon `ORIENT_SPINDLE` and `WAIT_SPINDLE_ORIENT_COMPLETE` preserved as temporary mode state events, including source-linked `check_other_codes()` validation for `P/R` words and `convert_m()` rejection of out-of-range `$` selectors and nonpositive `Q` waits | `tests/gcode/linuxcnc_spindle_orient.ngc`, `tests/gcode/linuxcnc_m19_spindle_dollar_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m19_p_not_integer_error.ngc`, `tests/gcode/linuxcnc_m19_p_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m19_r_out_of_range_error.ngc`, `tests/gcode/linuxcnc_m19_zero_q_error.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 | +| 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, G76 multi-pass threading smoke-covered, and source-linked `check_other_codes()` validation for required/disallowed `K/F/P/I/J` words | `tests/gcode/linuxcnc_threading_sync.ngc`, `tests/gcode/linuxcnc_threading_cycle.ngc`, `tests/gcode/linuxcnc_g33_missing_k_word_error.ngc`, `tests/gcode/linuxcnc_g33_f_word_error.ngc`, `tests/gcode/linuxcnc_g33_1_missing_k_word_error.ngc`, `tests/gcode/linuxcnc_g33_1_f_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_i_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_j_word_error.ngc`, `tests/gcode/linuxcnc_g76_missing_k_word_error.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, including source-linked `convert_m()` validation for required `P`/`E`, M66 input selection, M66 wait timeout, and analog wait restrictions | `tests/gcode/linuxcnc_io_controls.ngc`, `tests/gcode/linuxcnc_m62_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_m63_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_m64_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_m65_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_m66_missing_input_error.ngc`, `tests/gcode/linuxcnc_m66_both_inputs_error.ngc`, `tests/gcode/linuxcnc_m66_zero_timeout_error.ngc`, `tests/gcode/linuxcnc_m66_analog_wait_error.ngc`, `tests/gcode/linuxcnc_m67_missing_e_word_error.ngc`, `tests/gcode/linuxcnc_m68_missing_e_word_error.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` | diff --git a/test-linuxcnc-source-link.sh b/test-linuxcnc-source-link.sh index d87e89f..2635916 100755 --- a/test-linuxcnc-source-link.sh +++ b/test-linuxcnc-source-link.sh @@ -832,6 +832,31 @@ for case in "${unused_word_error_cases[@]}"; do fi grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err" done +# Source basis: LinuxCNC src/emc/rs274ngc/interp_check.cc +# check_other_codes() enforces required and disallowed words for G96, +# G33/G33.1, and G76 before motion conversion. +threading_check_error_cases=( + "linuxcnc_g96_missing_s_word_error|S word missing with G96" + "linuxcnc_g33_missing_k_word_error|K word missing with g33/g33.1" + "linuxcnc_g33_f_word_error|F word used with a g33/g33.1" + "linuxcnc_g33_1_missing_k_word_error|K word missing with g33/g33.1" + "linuxcnc_g33_1_f_word_error|F word used with a g33/g33.1" + "linuxcnc_g76_missing_p_word_error|P word missing with G76" + "linuxcnc_g76_missing_i_word_error|I J or K words missing with G76" + "linuxcnc_g76_missing_j_word_error|I J or K words missing with G76" + "linuxcnc_g76_missing_k_word_error|I J or K words missing with G76" +) +for case in "${threading_check_error_cases[@]}"; do + fixture=${case%%|*} + expected=${case#*|} + if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \ + "$build_dir/linuxcnc_rs274_source_dump" "tests/gcode/$fixture.ngc" \ + >"$output_dir/cnc_sim_linuxcnc_source_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_source_$fixture.err"; then + echo "expected $fixture.ngc to fail" >&2 + exit 1 + fi + grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err" +done # Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc # read_items() only consumes a leading N word before item dispatch; # read_one_item() then uses the default reader table from interp_array.cc diff --git a/tests/gcode/linuxcnc_g33_1_f_word_error.ngc b/tests/gcode/linuxcnc_g33_1_f_word_error.ngc new file mode 100644 index 0000000..9b52efc --- /dev/null +++ b/tests/gcode/linuxcnc_g33_1_f_word_error.ngc @@ -0,0 +1,4 @@ +G21 G90 G17 +S500 M3 +G33.1 Z0 K1 F100 +M30 diff --git a/tests/gcode/linuxcnc_g33_1_missing_k_word_error.ngc b/tests/gcode/linuxcnc_g33_1_missing_k_word_error.ngc new file mode 100644 index 0000000..03bab1d --- /dev/null +++ b/tests/gcode/linuxcnc_g33_1_missing_k_word_error.ngc @@ -0,0 +1,4 @@ +G21 G90 G17 +S500 M3 +G33.1 Z0 +M30 diff --git a/tests/gcode/linuxcnc_g33_f_word_error.ngc b/tests/gcode/linuxcnc_g33_f_word_error.ngc new file mode 100644 index 0000000..8290606 --- /dev/null +++ b/tests/gcode/linuxcnc_g33_f_word_error.ngc @@ -0,0 +1,4 @@ +G21 G90 G17 +S500 M3 +G33 Z0 K1 F100 +M30 diff --git a/tests/gcode/linuxcnc_g33_missing_k_word_error.ngc b/tests/gcode/linuxcnc_g33_missing_k_word_error.ngc new file mode 100644 index 0000000..c0a006b --- /dev/null +++ b/tests/gcode/linuxcnc_g33_missing_k_word_error.ngc @@ -0,0 +1,4 @@ +G21 G90 G17 +S500 M3 +G33 Z0 +M30 diff --git a/tests/gcode/linuxcnc_g76_missing_i_word_error.ngc b/tests/gcode/linuxcnc_g76_missing_i_word_error.ngc new file mode 100644 index 0000000..698eb2e --- /dev/null +++ b/tests/gcode/linuxcnc_g76_missing_i_word_error.ngc @@ -0,0 +1,4 @@ +G20 G90 G18 +S500 M3 +G76 P0.05 Z-1 J0.008 K0.045 Q29.5 L2 E0.045 +M30 diff --git a/tests/gcode/linuxcnc_g76_missing_j_word_error.ngc b/tests/gcode/linuxcnc_g76_missing_j_word_error.ngc new file mode 100644 index 0000000..774f24f --- /dev/null +++ b/tests/gcode/linuxcnc_g76_missing_j_word_error.ngc @@ -0,0 +1,4 @@ +G20 G90 G18 +S500 M3 +G76 P0.05 Z-1 I-.075 K0.045 Q29.5 L2 E0.045 +M30 diff --git a/tests/gcode/linuxcnc_g76_missing_k_word_error.ngc b/tests/gcode/linuxcnc_g76_missing_k_word_error.ngc new file mode 100644 index 0000000..de4d4b0 --- /dev/null +++ b/tests/gcode/linuxcnc_g76_missing_k_word_error.ngc @@ -0,0 +1,4 @@ +G20 G90 G18 +S500 M3 +G76 P0.05 Z-1 I-.075 J0.008 Q29.5 L2 E0.045 +M30 diff --git a/tests/gcode/linuxcnc_g76_missing_p_word_error.ngc b/tests/gcode/linuxcnc_g76_missing_p_word_error.ngc new file mode 100644 index 0000000..d7dba71 --- /dev/null +++ b/tests/gcode/linuxcnc_g76_missing_p_word_error.ngc @@ -0,0 +1,4 @@ +G20 G90 G18 +S500 M3 +G76 Z-1 I-.075 J0.008 K0.045 Q29.5 L2 E0.045 +M30 diff --git a/tests/gcode/linuxcnc_g96_missing_s_word_error.ngc b/tests/gcode/linuxcnc_g96_missing_s_word_error.ngc new file mode 100644 index 0000000..49c90d5 --- /dev/null +++ b/tests/gcode/linuxcnc_g96_missing_s_word_error.ngc @@ -0,0 +1,3 @@ +G21 G90 G17 +G96 D2500 +M30