继续按 align-linuxcnc 约束:补主轴选择和 M19 校验源码覆盖,测试通过

This commit is contained in:
cnc
2026-06-02 19:47:52 +08:00
parent e875496fe0
commit 4d0cf788b1
9 changed files with 34 additions and 4 deletions

View File

@@ -197,9 +197,9 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
| Tool length offset `G43/G43.1/G43.2/G49` | covered with nonzero tool-table offset, dynamic replacement, additive axis offsets, `G43.2 H...`, and clear through LinuxCNC native/source backends | `tests/gcode/linuxcnc_tool_length.ngc`, `tests/gcode/linuxcnc_dynamic_tool_length.ngc` |
| 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 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_m61_negative_q_error.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 orientation `M19 R... P... Q...` | covered with Canon `ORIENT_SPINDLE` and `WAIT_SPINDLE_ORIENT_COMPLETE` preserved as temporary mode state events, including source-linked `convert_m()` rejection of nonpositive `Q` waits | `tests/gcode/linuxcnc_spindle_orient.ngc`, `tests/gcode/linuxcnc_m19_zero_q_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 |
| 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` |

View File

@@ -200,9 +200,14 @@ CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_io_controls.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_io_controls.json"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc convert_m()
# validates M62-M68 input/output words, M61 Q tool numbers, and M19 Q wait
# values before issuing Canon output/input, tool, or spindle-orient calls.
# validates M62-M68 input/output words, M3/M4/M5/M19 spindle selectors, M61 Q
# tool numbers, and M19 Q wait values before issuing Canon output/input, tool,
# or spindle-orient calls. LinuxCNC src/emc/rs274ngc/interp_check.cc
# check_other_codes() validates M19 P/R words before conversion.
convert_m_error_cases=(
"linuxcnc_m3_spindle_dollar_out_of_range_error|Spindle (\$) number out of range in M3 Command"
"linuxcnc_m4_spindle_dollar_out_of_range_error|Spindle (\$) number out of range in M4 Command"
"linuxcnc_m5_spindle_dollar_out_of_range_error|Spindle (\$) number out of range in M5 Command"
"linuxcnc_m62_missing_p_word_error|No valid P word with M62"
"linuxcnc_m63_missing_p_word_error|No valid P word with M63"
"linuxcnc_m64_missing_p_word_error|No valid P word with M64"
@@ -213,6 +218,10 @@ convert_m_error_cases=(
"linuxcnc_m66_analog_wait_error|Can't select analog input with wait type != immediate return"
"linuxcnc_m67_missing_e_word_error|Invalid analog index with M67"
"linuxcnc_m68_missing_e_word_error|Invalid analog index with M68"
"linuxcnc_m19_spindle_dollar_out_of_range_error|Spindle (\$) number out of range in M19 Command"
"linuxcnc_m19_p_not_integer_error|P value not an integer with M19 G2 or G3"
"linuxcnc_m19_p_out_of_range_error|P value must be 0,1,or 2 with M19"
"linuxcnc_m19_r_out_of_range_error|R value must be within 0..360 with M19"
"linuxcnc_m19_zero_q_error|Q word with M19 requires a value > 0"
"linuxcnc_m61_negative_q_error|Need non-negative Q-word to specify tool number with M61"
)

View File

@@ -0,0 +1,3 @@
G21 G90 G17
M19 R45 P1.5
M30

View File

@@ -0,0 +1,3 @@
G21 G90 G17
M19 R45 P3
M30

View File

@@ -0,0 +1,3 @@
G21 G90 G17
M19 R361 P1
M30

View File

@@ -0,0 +1,3 @@
G21 G90 G17
M19 R45 $1 Q2
M30

View File

@@ -0,0 +1,3 @@
G21 G90 G17
M3 $1
M30

View File

@@ -0,0 +1,3 @@
G21 G90 G17
M4 $1
M30

View File

@@ -0,0 +1,3 @@
G21 G90 G17
M5 $1
M30