From e185f40de31e78548253646f265b6bf204574559 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 7 Jun 2026 16:46:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E6=8E=A8=E8=8D=90=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=EF=BC=8C=E7=BB=A7=E7=BB=AD=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:已接入 LinuxCNC spindle orient canonical 边界事件记录,并新增 M19 R/P/Q 回归 fixture;原生 probe 验证通过。 --- wasm-port/docs/porting-steps-standalone.md | 6 ++++++ .../linuxcnc_interp_minimal_runtime.cpp | 17 +++++++++++++++-- .../tests/fixtures/canon/spindle_orient.events | 4 ++++ .../tests/fixtures/gcode/spindle_orient.ngc | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 wasm-port/tests/fixtures/canon/spindle_orient.events create mode 100644 wasm-port/tests/fixtures/gcode/spindle_orient.ngc diff --git a/wasm-port/docs/porting-steps-standalone.md b/wasm-port/docs/porting-steps-standalone.md index b5d77ed..d82e70e 100644 --- a/wasm-port/docs/porting-steps-standalone.md +++ b/wasm-port/docs/porting-steps-standalone.md @@ -415,6 +415,12 @@ Current verified progress: `tests/fixtures/gcode/nurbs_g6_semantics.ngc` and `tests/fixtures/canon/nurbs_g6_semantics.events` pin `G6.2` order, interpolation mode, control-point, weight, and K segment handling. +- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records + spindle-orient canonical boundary calls emitted by vendored LinuxCNC + conversion and queue code: `ORIENT_SPINDLE` and + `WAIT_SPINDLE_ORIENT_COMPLETE`. `tests/fixtures/gcode/spindle_orient.ngc` + and `tests/fixtures/canon/spindle_orient.events` pin `M19 R/P/Q` behavior + from `interp_convert.cc::convert_m()` and `interp_queue.cc`. - `tests/fixtures/gcode_errors/g1_zero_feed.ngc` and `tests/fixtures/canon_errors/g1_zero_feed.expected` pin the negative `G1` zero-feed case. The source basis is LinuxCNC diff --git a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp index 67c0c56..01607df 100644 --- a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp +++ b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp @@ -234,8 +234,21 @@ void STOP_SPINDLE_TURNING(int spindle) standalone::push_canon_event(oss.str()); } void SPINDLE_RETRACT() {} -void ORIENT_SPINDLE(int, double, int) {} -void WAIT_SPINDLE_ORIENT_COMPLETE(int, double) {} +void ORIENT_SPINDLE(int spindle, double orientation, int mode) +{ + std::ostringstream oss; + oss << "ORIENT_SPINDLE spindle=" << spindle + << " orientation=" << orientation + << " mode=" << mode; + standalone::push_canon_event(oss.str()); +} +void WAIT_SPINDLE_ORIENT_COMPLETE(int spindle, double timeout) +{ + std::ostringstream oss; + oss << "WAIT_SPINDLE_ORIENT_COMPLETE spindle=" << spindle + << " timeout=" << timeout; + standalone::push_canon_event(oss.str()); +} void LOCK_SPINDLE_Z() {} void USE_SPINDLE_FORCE() {} void USE_NO_SPINDLE_FORCE() {} diff --git a/wasm-port/tests/fixtures/canon/spindle_orient.events b/wasm-port/tests/fixtures/canon/spindle_orient.events new file mode 100644 index 0000000..781ca23 --- /dev/null +++ b/wasm-port/tests/fixtures/canon/spindle_orient.events @@ -0,0 +1,4 @@ +canon_event=SELECT_PLANE plane=1 +canon_event=STRAIGHT_TRAVERSE line=1 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=ORIENT_SPINDLE spindle=0 orientation=45 mode=2 +canon_event=WAIT_SPINDLE_ORIENT_COMPLETE spindle=0 timeout=1.5 diff --git a/wasm-port/tests/fixtures/gcode/spindle_orient.ngc b/wasm-port/tests/fixtures/gcode/spindle_orient.ngc new file mode 100644 index 0000000..6070bba --- /dev/null +++ b/wasm-port/tests/fixtures/gcode/spindle_orient.ngc @@ -0,0 +1,2 @@ +G90 G17 G0 X0 Y0 Z0 +M19 R45 P2 Q1.5